repo
stringlengths 26
115
| file
stringlengths 54
212
| language
stringclasses 2
values | license
stringclasses 16
values | content
stringlengths 19
1.07M
|
---|---|---|---|---|
https://github.com/Myriad-Dreamin/typst.ts | https://raw.githubusercontent.com/Myriad-Dreamin/typst.ts/main/packages/typst.node/npm/linux-arm-gnueabihf/README.md | markdown | Apache License 2.0 | # `@myriaddreamin/typst-ts-node-compiler-linux-arm-gnueabihf`
This is the **armv7-unknown-linux-gnueabihf** binary for `@myriaddreamin/typst-ts-node-compiler`
|
https://github.com/fyuniv/TypstDevcontainerTesting | https://raw.githubusercontent.com/fyuniv/TypstDevcontainerTesting/main/main.typ | typst |
#set par(justify: true)
#set text(font: "Inter")
Analyze and act on achievement data by creating an instructional plan using achievement data
Analyzing student data such as assessment scores, attendance records, or feedback helps to identify individual or collective areas of strength and areas for improvement. This information enables you to tailor your instructional plan to address the specific needs of your students. Individual student data can also guide you in personalizing instruction. By understanding each student's strengths and weaknesses, you can tailor your teaching methods, assignments, and assessments to meet the diverse needs of your students. Ongoing data collection and analysis allow you to monitor student progress throughout the instructional period. Data can inform you about areas where students are struggling or excelling, and you can use this information to provide additional support and guidance for improvement.
Once you've implemented your practice, you'll be ready to write a reflection on the experience.
= Reflection
. item]
Looks great!
Next $x$
Now let's try an equation
$ x^2 + y^2 = z^2 $ |
|
https://github.com/lucannez64/Notes | https://raw.githubusercontent.com/lucannez64/Notes/master/Protocole%20de%20dilution.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: "Protocole de dilution",
authors: (
"<NAME>",
),
date: "10 Août, 2024",
)
#set heading(numbering: "1.1.")
\#protocole \#premiere \#physique \#theme1 BackLinks :
#link("Physique Protocole.pdf")[Physique Protocole]
#link("Physique th%C3%A8me 1.pdf")[Physique thème 1]
Verser votre solution mère dans un bécher
Pourquoi ? Il est plus aisé de prélever un liquide dans un bécher.
Pipette jaugée 3/ Rincer une pipette jaugée de V mL avec la solution
mère puis jeter le prélèvement.
Pourquoi ? Afin de s’assurer que la pipette ne soit pas polluée par
d’autres solutions.
4/ Prélever 10,0 mL de la solution mère dans le bécher à l’aide de la
pipette jaugée en faisant attention à la jauge.
Fiole jaugée : instrument de mesure du volume 5/ Transvaser-la dans une
fiole jaugée de V mL
6/ Complétez avec l’eau distillée jusqu’au trait de jauge ; Bouchez puis
secouez pour homogénéiser.
|
|
https://github.com/ivaquero/book-control | https://raw.githubusercontent.com/ivaquero/book-control/main/11-反馈线性化控制.typ | typst | #import "@local/scibook:0.1.0": *
#show: doc => conf(
title: "反馈线性化控制",
author: ("ivaquero"),
header-cap: "现代控制理论",
footer-cap: "github@ivaquero",
outline-on: false,
doc,
)
= 非线性系统稳定性
<非线性系统稳定性>
== Lyapunov 方法
<Lyapunov-方法>
已知
#figure(
table(
columns: 4,
align: center + horizon,
inset: 4pt,
stroke: frame(rgb("000")),
[∀x ∈ D - {0}], [Abbr.], [V(0)], [V(x)],
[正定], [PD], [0], [$>$],
[半正定], [PSD], [0], [$≥$],
[负定], [ND], [0], [$<$],
[半负定], [NSD], [0], [$≤$],
),
caption: [Lyapunov 稳定性],
supplement: "表",
kind: table,
)
#theorem("Lyapunov 第二方法")[
系统
$ dot(𝒙) = f(x_0) $
其中,$x_0$是平衡点,即$dot(𝒙)(0) = 0$。
若$∃$函数$V(x)$,且满足
- $V(x)$正定且$dot(V)(x)$半负定,则称$x_0$稳定
- $V(x)$正定且$dot(V)(x)$负定,则称$x_0$渐近稳定
]
== 无摩擦单摆
对如下单摆系统,有
$ ∑F_x = m a_x = l dot.double(θ) $
#figure(
image("images/model/pendulum.drawio.png", width: 10%),
caption: "钟摆",
supplement: "图",
)
即
$ -m g sin θ = m l dot.double(θ) $
整理,得
$ dot.double(θ) + frac(g, L) sin θ = 0 $
令
- $x_1 = θ$
- $x_2 = dot(x)_1 = dot(θ)$
- $dot(x)_2 = -frac(g, L) sin(x_1)$
又
$ E = K("kinetic") + P("potential") $
于是令
$
V &= E = frac(1, 2) m v^2 + m g h \
&= frac(1, 2)m(l x_2)^2 + m g l(1 - cos(x_1))
$
求导,可得
$
dot(V)(x) = grad V_f &=
mat(delim: "[", pdv(V, x_1), pdv(V, x_2))
mat(delim: "[", f_1; f_2) \ &=
mat(delim: "[", m g l sin(x_1) & m l^2 x_2)
mat(delim: "[", x_2 \ -frac(g, L) sin(x_1)) \
&= 0
$
又
- $V(0) = 0$
- $V(x) > 0$
故,该系统渐近稳定。其意味着
- $x_1, x_2$有界
- $x_1, x_2$不趋近于$0$
== 有摩擦单摆
对有摩擦单摆系统
$ dot.double(θ) + frac(g, L) sin θ + frac(k, m) dot(θ) = 0 $
令
- $dot(x)_1 = x_2$
- $dot(x)_2 = dot.double(θ) = -frac(g, L)sin(x_1) - frac(k, m)x_2$
令$V = E = K("kinetic") + P("potential")$,求导,可得
$
dot(V)(x) = grad V_f &=
mat(delim: "[", pdv(V, x_1) & pdv(V, x_2))
mat(delim: "[", f_1; f_2) \ &=
mat(delim: "[", m g l sin(x_1), m l^2 x_2)
mat(delim: "[", x_2; -frac(g, L)sin(x_1) - frac(k, m)x_2) \
&= k l^2 x_2^2
$
显然,$dot(V)(x)$半负定。
#theorem("LaSalle's 不变性原理")[
系统
$ dot(𝒙) = f(x_0) $
其中,$x_0$是平衡点,即$dot(𝒙)(0) = 0$。
若$∃$函数$V(x)$,且满足
- $V(x)$正定,$∀x ∈ D$且${0} ∈ D$
- $dot(V)(x)$半负定,$∀x ∈ R ⊂ D$
- $dot(V)(x) ≠ 0, ∀x ≠ 0$
称系统渐近稳定
]
== 非线性反馈系统
<非线性反馈系统>
对系统
$ dot(x) = f(x, u) $
假设,输入$u = ϕ (x)$,于是可得
$ dot(x) = f(x, ϕ (x)) $
#figure(
image("./images/block/feedback.drawio.png", width: 40%),
caption: [反馈],
supplement: "图",
)
考虑系统
$ dot(x) = f(x, u) = a x^2 + u, u = ϕ (x) $
不难看出,$f(0, 0) = 0$,若想令$(0, 0)$为渐近稳定平衡点,则可以令
$ u = -a x^2 - x $
此时,$x(t) = C e^(-t)$。简单说,控制函数中的$-a x^2$消除了非线性,$-x$保证了渐近稳定。
考虑系统
$ dot(x) = x^2 - x^3 + u $
令$V(x) = 1/2 x^2$,则易得
- $V(0) = 0$
- $V(x)$正定
求导,得
$ dot(V)= pdv(V, x) dv(x, t) = x dot(x) = x(x^2 - x^3 + u) = x^3 - x^4 + x u $
由于$-x^4$负定,则为得到稳定点,简单方法是使$x^3 + x u$负定或为$0$,显然可令
- $u = x^3 - x^2 - x$
- $u = -x^2 - x$
- $u = -x^2$
其中,$-x$项会明显加快收敛速度。
= 反步设计
<反步设计>
== 链式系统
<链式系统>
对非线性弹簧系统
$ m dot.double(x) + α x^3 = F $
#figure(
image("./images/model/vibration-nl.drawio.png", width: 40%),
caption: [非线性弹簧系统],
supplement: "图",
)
令
- 输入$u = F$
- 位移$x_1 = x$
- 速度$x_2 = x ̇$
- 目标$x_(1 d)$
于是有
$
dot(x)_1 = dot(x) = x_2\
dot(x)_2 = dot.double(x) = -α / m x_1^3 + 1 / m u
$
显然,通过控制$u$,可以控制$x_2$,进而控制$x_1$,所以,这是一个链式系统。
令$e = x_(1 d) - x_1$,求导得
$ dot(e) = dot(x)_(1 d) - dot(x)_1 = dot(x)_(1 d) - x_2 $
又令$V = 1/2 e^2$,则
$ dot(V)_1 = pdv(V_1, e)⋅dv(e, t) = e dot(e) = e (dot(x)_(1 d) - x_2) $
== 引入中间输入
<引入中间输入>
若希望$dot(V)_1$负定,则可引入中间输入$x_(2 d)$,使$x_1 → x_(1 d)$
$ x_(2 d) = dot(x)_(1 d) + k_1 e $
此时,新的误差函数为
$ δ = x_(2 d) - x_2 $
于是
$
dot(V)_1 &= e (dot(x)_(1 d) - (x_(2 d) - δ))\
&= e (-k_1 e + δ) = -k_1 e^2 + δ e
$
进而有
$
dot(δ) &= dot(x)_(2 d) - dot(x)_2\
&= dot.double(x)(1 d) + k_1 dot(e) - (- α / m x_1^3 + 1 / m u)\
&= dot.double(x)(1 d) + k_1 (dot(x)_(1 d) - x_2) + α / m x_1^3 - 1 / m u
$
又$V_1$正定,现令$V_2 = V_1 + 1/2 δ^2$,则
$
dot(V)_2 &= dot(V)_1 + δ dot(δ)\
&= -k_1 e^2 + e δ + δ dot(δ)\
&= -k_1 e^2 + δ(e + dot(δ))
$
== 控制中间输入
<控制中间输入>
现在,需要设计输入$u$,使$x_2 → x_(2 d)$。可令$e + dot(δ) = -k_2 δ$,得
$
e + dot.double(x)(1 d) + k_1 (dot(x)_(1 d) - x_2) + α / m x_1^3 - 1 / m u = -k_2 δ
$
最终,得
$
u = m e + m dot.double(x)(1 d) + m k_1 (dot(x)_(1 d) - x_2)) + α x_1^3 + m k_2 δ
$
$(6)$代入$(3)$,$(11)$代入$(10)$,得
$
mat(delim: "[", delim: "[", e ̇; dot(δ)) =
mat(delim: "[", delim: "[", - k_1, 1; - 1, - k_2)
mat(delim: "[", delim: "[", e; δ)
$
不难得出
- $λ_1 + λ_2 = -k_1 - k_2 < 0$
- $λ_1 λ_2 = k_1 k_2 > 0$
故,$∀λ < 0$。又$mat(delim: "[", delim: "[", e ̇; dot(δ)) = 0$,故,$mat(delim: "[", delim: "[", e; δ) = 0$,从而知,系统渐近稳定。
|
|
https://github.com/maxgraw/bachelor | https://raw.githubusercontent.com/maxgraw/bachelor/main/apps/document/src/5-implementation/comparison.typ | typst | Im Folgenden wird die Implementierung des Systems mit den zuvor definierten Anforderungen verglichen. Es wird aufgezeigt, inwieweit diese Anforderungen umgesetzt wurden und ob sie vollständig erfüllt wurden. Anschließend wird die Implementierung mit dem ursprünglichen Wireframe verglichen, um zu überprüfen, ob die geplanten Designs und Strukturen erfolgreich umgesetzt wurden.
Die Entwicklung des Systems basierte auf spezifischen Anforderungen. Zunächst wird die Fähigkeit der Anwendung betrachtet, 3D-Modelle und die dazugehörigen Metadaten zu importieren. Der Importprozess wurde robust gestaltet, um eine einfache und zuverlässige Integration neuer Modelle zu ermöglichen. Dies wurde durch Tests und Validierungen im Rahmen der Integration in das Shopsystem von <NAME> bestätigt. Ein zentraler Aspekt der Anwendung ist die Darstellung der 3D-Modelle in der virtuellen Szene. Die Anwendung ermöglicht eine präzise und realitätsgetreue Wiedergabe der geometrischen Eigenschaften sowie der Texturen und Materialien der Modelle. Die Implementierung der StackCube-Modelle stellte sicher, dass die 3D-Modelle korrekt dargestellt werden. Zudem wurde die visuelle Qualität durch die Nutzung von Schatten- und Lichteffekten verbessert. Ein weiteres wichtiges Merkmal ist die Integration und Positionierung importierter 3D-Modelle in einer bestehenden virtuellen Szene. Die Implementierung erlaubt das Scannen der Szene nach nutzbaren Flächen und das Platzieren von 3D-Modellen an ausgewählten Positionen. Jedoch ist eine nachträgliche Positionsänderung der Möbelstücke nicht möglich. Die Anwendung bietet Funktionen zum Arrangieren der 3D-Modelle innerhalb der Szene. Das System ermöglicht das Anhängen von Möbelstücken an bereits platzierte Möbelstücke, wobei zwischen vordefinierten Positionen gewählt werden kann. Ein weiteres wesentliches Feature ist die Selektion von 3D-Modellen innerhalb der Szene. Diese Funktion erlaubt es Nutzern, einzelne Modelle auszuwählen und Aktionen wie Verschieben oder Löschen durchzuführen. Die Selektion der Modelle funktioniert zuverlässig und ermöglicht eine weitere Interaktion mit den ausgewählten Modellen. Zusätzlich enthält die Anwendung eine Funktion zum irreversiblen Entfernen von 3D-Modellen aus der Szene. Dieser Prozess stellt sicher, dass die Modelle vollständig und sicher gelöscht werden. Auch diese Funktion wurde erfolgreich implementiert. Abschließend wurde die Fähigkeit der Anwendung, Metadaten der hinzugefügten 3D-Modelle in verschiedenen Formaten zu exportieren, untersucht. Dies umfasst Informationen wie Modellname, Position, Orientierung und benutzerdefinierte Metadaten. Innerhalb der Integration mit dem Shopsystem von <NAME> wurde ein erfolgreicher Export der erforderlichen Metadaten implementiert.
Bei der Gegenüberstellung der Implementierung mit dem ursprünglichen Wireframe lässt sich feststellen, dass die grundlegende Menü- und Informationsdarstellung beibehalten und erfolgreich umgesetzt wurde. Die Interfaces orientieren sich deutlich an den im Wireframe vorgegebenen Strukturen.
Die Menüdarstellung folgt den im Wireframe festgelegten Vorgaben. Die Anordnung der Menüpunkte und die visuelle Gestaltung entsprechen den entworfenen Konzepten, wodurch eine intuitive Navigation gewährleistet wird. Auch die Informationsdarstellung wurde gemäß den Wireframe-Vorgaben umgesetzt. Die Positionierung und Darstellung von Informationen, wie Modellnamen, Metadaten und Benutzeraktionen, wurden wie geplant realisiert. Dies ermöglicht eine konsistente und benutzerfreundliche Interaktion innerhalb der Anwendung. Die Implementierung der Interfaces zeigt eine klare Orientierung an den Wireframes, wie in den Abbildungen ersichtlich ist. Dies stellt sicher, dass die Benutzererfahrung den ursprünglich definierten Designprinzipien entspricht und die Erwartungen der Nutzer erfüllt. Die Implementierung des Systems hält sich strikt an die im Wireframe festgelegten Designs für Menü- und Informationsdarstellungen. Dies gewährleistet eine konsistente und intuitive Benutzeroberfläche, die den Anforderungen und Erwartungen der Nutzer entspricht.
#grid(
columns: (1fr, 1fr, 1fr),
rows: (auto),
gutter: 20pt,
figure(
image("../media/implementation/view_one.jpeg", width: 100%),
caption: [Menü "Auswahl" sichtbar],
),
figure(
image("../media/implementation/view_two.jpeg", width: 100%),
caption: [Möbelstück wird platziert],
),
figure(
image("../media/implementation/view_three.jpeg", width: 100%),
caption: [Menü "Löschen" und "Möbelstück anhängen" sichtbar],
),
)
Zusammenfassend lässt sich feststellen, dass die Implementierung des Systems alle definierten Anforderungen erfüllt. Allerdings wurden während der Implementierung einige Herausforderungen und Probleme identifiziert. Die größten technischen Herausforderungen ergaben sich aus dem fehlerhaften Tracking sowie der Tipp-Registrierung. Augmented Reality ist eine Technologie, die trotz ihrer Fortschritte immer noch fehleranfällig ist. Probleme mit den Lichtverhältnissen können dazu führen, dass das Erkennen von Flächen gestört wird. Dies kann zur Folge haben, dass der Cursor nicht angezeigt wird, was zu Verwirrung bei den Nutzern führt. Um dieses Problem zu entschärfen, wurde eine Textanzeige implementiert, die "Kamera bewegen" anzeigt, wenn keine Fläche erkannt wird. Wie bereits zuvor beschrieben, ermöglicht die Nutzung von WebXR die geräteübergreifende Nutzung der Anwendung. Dies stellt jedoch auch Herausforderungen im Hinblick auf die unterschiedlichen Kapazitäten der Geräte dar. Android-Smartphones weisen ein breites Spektrum hinsichtlich Leistung, Kameras und weiterer Sensoren auf. Dies kann zu Inkompatibilitäten führen. Im Rahmen dieser Arbeit wurde die Anwendung hauptsächlich auf einem Gerät getestet, da es aus zeitlichen und finanziellen Gründen nicht möglich war, eine Vielzahl an Geräten zu testen. |
|
https://github.com/LDemetrios/Typst4k | https://raw.githubusercontent.com/LDemetrios/Typst4k/master/src/test/resources/suite/visualize/pattern.typ | typst | // Test patterns.
--- pattern-line ---
// Tests that simple patterns work.
#set page(width: auto, height: auto, margin: 0pt)
#let pat = pattern(size: (10pt, 10pt), line(stroke: 4pt, start: (0%, 0%), end: (100%, 100%)))
#rect(width: 50pt, height: 50pt, fill: pat)
--- pattern-lines ---
#set page(width: auto, height: auto, margin: 0pt)
#let pat = pattern(size: (10pt, 10pt), {
place(line(stroke: 4pt, start: (0%, 0%), end: (100%, 100%)))
place(line(stroke: 4pt, start: (100%,0%), end: (200%, 100%)))
place(line(stroke: 4pt, start: (0%,100%), end: (100%, 200%)))
place(line(stroke: 4pt, start: (-100%,0%), end: (0%, 100%)))
place(line(stroke: 4pt, start: (0%,-100%), end: (100%, 0%)))
})
#rect(width: 50pt, height: 50pt, fill: pat)
--- pattern-relative-self ---
// Test with relative set to `"self"`
#let pat(..args) = pattern(size: (30pt, 30pt), ..args)[
#set line(stroke: green)
#place(top + left, line(start: (0%, 0%), end: (100%, 100%), stroke: 1pt))
#place(top + left, line(start: (0%, 100%), end: (100%, 0%), stroke: 1pt))
]
#set page(fill: pat(), width: 100pt, height: 100pt)
#rect(
width: 100%,
height: 100%,
fill: pat(relative: "self"),
stroke: 1pt + green,
)
--- pattern-relative-parent ---
// Test with relative set to `"parent"`
#let pat(fill, ..args) = pattern(size: (30pt, 30pt), ..args)[
#rect(width: 100%, height: 100%, fill: fill, stroke: none)
#place(top + left, line(start: (0%, 0%), end: (100%, 100%), stroke: 1pt))
#place(top + left, line(start: (0%, 100%), end: (100%, 0%), stroke: 1pt))
]
#set page(fill: pat(white), width: 100pt, height: 100pt)
#rect(fill: pat(none, relative: "parent"), width: 100%, height: 100%, stroke: 1pt)
--- pattern-small ---
// Tests small patterns for pixel accuracy.
#box(
width: 8pt,
height: 1pt,
fill: pattern(size: (1pt, 1pt), square(size: 1pt, fill: black))
)
#v(-1em)
#box(
width: 8pt,
height: 1pt,
fill: pattern(size: (2pt, 1pt), square(size: 1pt, fill: black))
)
--- pattern-zero-sized ---
// Error: 15-52 pattern tile size must be non-zero
// Hint: 15-52 try setting the size manually
#line(stroke: pattern(path((0pt, 0pt), (1em, 0pt))))
--- pattern-spacing-negative ---
// Test with spacing set to `(-10pt, -10pt)`
#let pat(..args) = pattern(size: (30pt, 30pt), ..args)[
#square(width: 100%, height: 100%, stroke: 1pt, fill: blue)
]
#set page(width: 100pt, height: 100pt)
#rect(fill: pat(spacing: (-10pt, -10pt)), width: 100%, height: 100%, stroke: 1pt)
--- pattern-spacing-zero ---
// Test with spacing set to `(0pt, 0pt)`
#let pat(..args) = pattern(size: (30pt, 30pt), ..args)[
#square(width: 100%, height: 100%, stroke: 1pt, fill: blue)
]
#set page(width: 100pt, height: 100pt)
#rect(fill: pat(spacing: (0pt, 0pt)), width: 100%, height: 100%, stroke: 1pt)
--- pattern-spacing-positive ---
// Test with spacing set to `(10pt, 10pt)`
#let pat(..args) = pattern(size: (30pt, 30pt), ..args)[
#square(width: 100%, height: 100%, stroke: 1pt, fill: blue)
]
#set page(width: 100pt, height: 100pt)
#rect(fill: pat(spacing: (10pt, 10pt,)), width: 100%, height: 100%, stroke: 1pt)
--- pattern-stroke ---
// Test pattern on strokes
#align(
center + top,
square(
size: 50pt,
fill: pattern(
size: (5pt, 5pt),
align(horizon + center, circle(fill: blue, radius: 2.5pt))
),
stroke: 7.5pt + pattern(
size: (5pt, 5pt),
align(horizon + center, circle(fill: red, radius: 2.5pt))
)
)
)
--- pattern-stroke-relative-parent ---
// Test pattern on strokes with relative set to `"parent"`
// The pattern on the circle should align with the pattern on the square.
#align(
center + top,
block(
width: 50pt,
height: 50pt,
fill: pattern(size: (5pt, 5pt), circle(radius: 2.5pt, fill: blue)),
align(center + horizon, circle(
radius: 15pt,
stroke: 7.5pt + pattern(
size: (5pt, 5pt), circle(radius: 2.5pt, fill: red), relative: "parent"
),
))
)
)
--- pattern-text ---
// Test a pattern on some text
// You shouldn't be able to see the text, if you can then
// that means that the transform matrices are not being
// applied to the text correctly.
#let pat = pattern(
size: (30pt, 30pt),
relative: "parent",
square(size: 30pt, fill: gradient.conic(..color.map.rainbow))
);
#set page(
width: 140pt,
height: 140pt,
fill: pat
)
#rotate(45deg, scale(x: 50%, y: 70%, rect(
width: 100%,
height: 100%,
stroke: 1pt,
)[
#lorem(10)
#set text(fill: pat)
#lorem(10)
]))
|
|
https://github.com/Myriad-Dreamin/typst.ts | https://raw.githubusercontent.com/Myriad-Dreamin/typst.ts/main/fuzzers/corpora/layout/repeat_04.typ | typst | Apache License 2.0 |
#import "/contrib/templates/std-tests/preset.typ": *
#show: test-page
// Test single repeat in both directions.
A#box(width: 1fr, repeat(rect(width: 6em, height: 0.7em)))B
#set align(center)
A#box(width: 1fr, repeat(rect(width: 6em, height: 0.7em)))B
#set text(dir: rtl)
ريجين#box(width: 1fr, repeat(rect(width: 4em, height: 0.7em)))سون
|
https://github.com/mkpoli/roremu | https://raw.githubusercontent.com/mkpoli/roremu/master/README.md | markdown | The Unlicense | # roremu
日本語のダミーテキスト(Lipsum)生成ツール。
Blind text (Lorem ipsum) generator for Japanese.
## 用法 / Usage
```typst
#import "@preview/roremu:0.1.0": roremu
#roremu(8) # 吾輩は猫である。
#roremu(8, offset: 8) #名前はまだ無い。
#roremu(17, custom-text: "私はその人を常に先生と呼んでいた。")
```
## テキスト / Text Source
夏目漱石『[吾輩は猫である](https://ja.wikipedia.org/wiki/%E5%90%BE%E8%BC%A9%E3%81%AF%E7%8C%AB%E3%81%A7%E3%81%82%E3%82%8B)』([青空文庫版](https://www.aozora.gr.jp/cards/000148/card789.html)より抜粋、ルビ抜き)
## 名称由来 / Why “roremu”?
lorem「ロレム」のローマ字表記。
“roremu” is the romanization of ロレム (lorem).
## ライセンス / License
Unlicense
|
https://github.com/PgBiel/typst-tablex | https://raw.githubusercontent.com/PgBiel/typst-tablex/main/tablex.typ | typst | MIT License | // Welcome to tablex!
// Feel free to contribute with any features you think are missing.
// Version: v0.0.8
// -- table counter --
#let _tablex-table-counter = counter("_tablex-table-counter")
// -- compat --
// get the types of things so we can compare with them
// (0.2.0-0.7.0: they're strings; 0.8.0+: they're proper types)
#let _array-type = type(())
#let _dict-type = type((a: 5))
#let _bool-type = type(true)
#let _str-type = type("")
#let _color-type = type(red)
#let _stroke-type = type(red + 5pt)
#let _length-type = type(5pt)
#let _rel-len-type = type(100% + 5pt)
#let _ratio-type = type(100%)
#let _int-type = type(5)
#let _float-type = type(5.0)
#let _fraction-type = type(5fr)
#let _function-type = type(x => x)
#let _content-type = type([])
// note: since 0.8.0, alignment and 2d alignment are the same
// but keep it like this for pre-0.8.0
#let _align-type = type(left)
#let _2d-align-type = type(top + left)
// If types aren't strings, this means we're using 0.8.0+.
#let using-typst-v080-or-later = str(type(_str-type)) == "type"
// Attachments use "t" and "b" instead of "top" and "bottom" since v0.3.0.
#let using-typst-v030-or-later = using-typst-v080-or-later or $a^b$.body.has("t")
// This is true if types have fields in the current Typst version.
// This means we can use stroke.thickness, length.em, and so on.
#let typst-fields-supported = using-typst-v080-or-later
// This is true if calc.rem exists in the current Typst version.
// Otherwise, we use a polyfill.
#let typst-calc-rem-supported = using-typst-v030-or-later
// Remainder operation.
#let calc-mod = if typst-calc-rem-supported {
calc.rem
} else {
(a, b) => calc.floor(a) - calc.floor(b * calc.floor(a / b))
}
// Returns the sign of the operand.
// -1 for negative, 1 for positive or zero.
#let calc-sign(x) = {
// For positive: true - false = 1 - 0 = 1
// For zero: true - false = 1 - 0 = 1
// For negative: false - true = 0 - 1 = -1
int(0 <= x) - int(x < 0)
}
// Polyfill for array sum (.sum() is Typst 0.3.0+).
#let array-sum(arr, zero: 0) = {
arr.fold(zero, (a, x) => a + x)
}
// -- common validators --
// Converts the 'fit-spans' argument to a (x: bool, y: bool) dictionary.
// Optionally use a default dictionary to fill missing arguments with.
// This is in the common section as it is needed by the grid section as well.
#let validate-fit-spans(fit-spans, default: (x: false, y: false), error-prefix: none) = {
if type(error-prefix) == _str-type {
error-prefix = " " + error-prefix
} else {
error-prefix = ""
}
if type(fit-spans) == _bool-type {
fit-spans = (x: fit-spans, y: fit-spans)
}
if type(fit-spans) == _dict-type {
assert(fit-spans.len() > 0, message: "Tablex error:" + error-prefix + " 'fit-spans', if a dictionary, must not be empty.")
assert(fit-spans.keys().all(k => k in ("x", "y")), message: "Tablex error:" + error-prefix + " 'fit-spans', if a dictionary, must only have the keys x and y.")
assert(fit-spans.values().all(v => type(v) == _bool-type), message: "Tablex error:" + error-prefix + " keys 'x' and 'y' in the 'fit-spans' dictionary must be booleans (true/false).")
for key in ("x", "y") {
if key in default and key not in fit-spans {
fit-spans.insert(key, default.at(key))
}
}
} else {
panic("Tablex error:" + error-prefix + " Expected 'fit-spans' to be either a boolean or dictionary, found '" + str(type(fit-spans)) + "'")
}
fit-spans
}
// ------------
// -- types --
#let hlinex(
start: 0, end: auto, y: auto,
stroke: auto,
stop-pre-gutter: auto, gutter-restrict: none,
stroke-expand: true,
expand: none
) = (
tablex-dict-type: "hline",
start: start,
end: end,
y: y,
stroke: stroke,
stop-pre-gutter: stop-pre-gutter,
gutter-restrict: gutter-restrict,
stroke-expand: stroke-expand,
expand: expand,
parent: none, // if hline was broken into multiple
)
#let vlinex(
start: 0, end: auto, x: auto,
stroke: auto,
stop-pre-gutter: auto, gutter-restrict: none,
stroke-expand: true,
expand: none
) = (
tablex-dict-type: "vline",
start: start,
end: end,
x: x,
stroke: stroke,
stop-pre-gutter: stop-pre-gutter,
gutter-restrict: gutter-restrict,
stroke-expand: stroke-expand,
expand: expand,
parent: none,
)
#let cellx(content,
x: auto, y: auto,
rowspan: 1, colspan: 1,
fill: auto, align: auto,
inset: auto,
fit-spans: auto
) = (
tablex-dict-type: "cell",
content: content,
rowspan: rowspan,
colspan: colspan,
align: align,
fill: fill,
inset: inset,
fit-spans: fit-spans,
x: x,
y: y,
)
#let occupied(x: 0, y: 0, parent_x: none, parent_y: none) = (
tablex-dict-type: "occupied",
x: x,
y: y,
parent_x: parent_x,
parent_y: parent_y
)
// -- end: types --
// -- type checks, transformers and validators --
// Is this a valid dict created by this library?
#let is-tablex-dict(x) = (
type(x) == _dict-type
and "tablex-dict-type" in x
)
#let is-tablex-dict-type(x, ..dict_types) = (
is-tablex-dict(x)
and x.tablex-dict-type in dict_types.pos()
)
#let is-tablex-cell(x) = is-tablex-dict-type(x, "cell")
#let is-tablex-hline(x) = is-tablex-dict-type(x, "hline")
#let is-tablex-vline(x) = is-tablex-dict-type(x, "vline")
#let is-some-tablex-line(x) = is-tablex-dict-type(x, "hline", "vline")
#let is-tablex-occupied(x) = is-tablex-dict-type(x, "occupied")
#let table-item-convert(item, keep_empty: true) = {
if type(item) == _function-type { // dynamic cell content
cellx(item)
} else if keep_empty and item == () {
item
} else if type(item) != _dict-type or "tablex-dict-type" not in item {
cellx[#item]
} else {
item
}
}
#let rowspanx(length, content, ..cell_options) = {
if is-tablex-cell(content) {
(..content, rowspan: length, ..cell_options.named())
} else {
cellx(
content,
rowspan: length,
..cell_options.named())
}
}
#let colspanx(length, content, ..cell_options) = {
if is-tablex-cell(content) {
(..content, colspan: length, ..cell_options.named())
} else {
cellx(
content,
colspan: length,
..cell_options.named())
}
}
// Get expected amount of cell positions
// in the table (considering colspan and rowspan)
#let get-expected-grid-len(items, col_len: 0) = {
let len = 0
// maximum explicit 'y' specified
let max_explicit_y = items
.filter(c => c.y != auto)
.fold(0, (acc, cell) => {
if (is-tablex-cell(cell)
and type(cell.y) in (_int-type, _float-type)
and cell.y > acc) {
cell.y
} else {
acc
}
})
for item in items {
if is-tablex-cell(item) and item.x == auto and item.y == auto {
// cell occupies (colspan * rowspan) spaces
len += item.colspan * item.rowspan
} else if type(item) == _content-type {
len += 1
}
}
let rows(len) = calc.ceil(len / col_len)
while rows(len) < max_explicit_y {
len += col_len
}
len
}
// Check if this length is infinite.
#let is-infinite-len(len) = {
type(len) in (_ratio-type, _fraction-type, _rel-len-type, _length-type) and "inf" in repr(len)
}
// Check if this is a valid color (color, gradient or pattern).
#let is-color(val) = {
type(val) == _color-type or str(type(val)) in ("gradient", "pattern")
}
#let validate-cols-rows(columns, rows, items: ()) = {
if type(columns) == _int-type {
assert(columns >= 0, message: "Error: Cannot have a negative amount of columns.")
columns = (auto,) * columns
}
if type(rows) == _int-type {
assert(rows >= 0, message: "Error: Cannot have a negative amount of rows.")
rows = (auto,) * rows
}
if type(columns) != _array-type {
columns = (columns,)
}
if type(rows) != _array-type {
rows = (rows,)
}
// default empty column to a single auto column
if columns.len() == 0 {
columns = (auto,)
}
// default empty row to a single auto row
if rows.len() == 0 {
rows = (auto,)
}
let col_row_is_valid(col_row) = (
(not is-infinite-len(col_row)) and (col_row == auto or type(col_row) in (
_fraction-type, _length-type, _rel-len-type, _ratio-type
))
)
if not columns.all(col_row_is_valid) {
panic("Invalid column sizes (must all be 'auto' or a valid, finite length specifier).")
}
if not rows.all(col_row_is_valid) {
panic("Invalid row sizes (must all be 'auto' or a valid, finite length specifier).")
}
let col_len = columns.len()
let grid_len = get-expected-grid-len(items, col_len: col_len)
let expected_rows = calc.ceil(grid_len / col_len)
// more cells than expected => add rows
if rows.len() < expected_rows {
let missing_rows = expected_rows - rows.len()
rows += (rows.last(),) * missing_rows
}
(columns: columns, rows: rows, items: ())
}
// -- end: type checks and validators --
// -- utility functions --
// Which positions does a cell occupy
// (Usually just its own, but increases if colspan / rowspan
// is greater than 1)
#let positions-spanned-by(cell, x: 0, y: 0, x_limit: 0, y_limit: none) = {
let result = ()
let rowspan = if "rowspan" in cell { cell.rowspan } else { 1 }
let colspan = if "colspan" in cell { cell.colspan } else { 1 }
if rowspan < 1 {
panic("Cell rowspan must be 1 or greater (bad cell: " + repr((x, y)) + ")")
} else if colspan < 1 {
panic("Cell colspan must be 1 or greater (bad cell: " + repr((x, y)) + ")")
}
let max_x = x + colspan
let max_y = y + rowspan
if x_limit != none {
max_x = calc.min(x_limit, max_x)
}
if y_limit != none {
max_y = calc.min(y_limit, max_y)
}
for x in range(x, max_x) {
for y in range(y, max_y) {
result.push((x, y))
}
}
result
}
// initialize an array with a certain element or init function, repeated
#let init-array(amount, element: none, init_function: none) = {
let nones = ()
if init_function == none {
init_function = () => element
}
range(amount).map(i => init_function())
}
// Default 'x' to a certain value if it is equal to the forbidden value
// ('none' by default)
#let default-if-not(x, default, if_isnt: none) = {
if x == if_isnt {
default
} else {
x
}
}
// Default 'x' to a certain value if it is none
#let default-if-none(x, default) = default-if-not(x, default, if_isnt: none)
// Default 'x' to a certain value if it is auto
#let default-if-auto(x, default) = default-if-not(x, default, if_isnt: auto)
// Default 'x' to a certain value if it is auto or none
#let default-if-auto-or-none(x, default) = if x in (auto, none) {
default
} else {
x
}
// The max between a, b, or the other one if either is 'none'.
#let max-if-not-none(a, b) = if a in (none, auto) {
b
} else if b in (none, auto) {
a
} else {
calc.max(a, b)
}
// Gets the topmost parent of a line.
#let get-top-parent(line) = {
let previous = none
let current = line
while current != none {
previous = current
current = previous.parent
}
previous
}
// Typst 0.9.0 uses a minus sign ("−"; U+2212 MINUS SIGN) for negative numbers.
// Before that, it used a hyphen minus ("-"; U+002D HYPHEN MINUS), so we use
// regex alternation to match either of those.
#let NUMBER-REGEX-STRING = "(?:−|-)?\\d*\\.?\\d+"
// Check if the given length has type '_length-type' and no 'em' component.
#let is-purely-pt-len(len) = {
type(len) == _length-type and "em" not in repr(len)
}
// Measure a length in pt by drawing a line and using the measure() function.
// This function will work for negative lengths as well.
//
// Note that for ratios, the measurement will be 0pt due to limitations of
// the "draw and measure" technique (wrapping the line in a box still returns 0pt;
// not sure if there is any viable way to measure a ratio). This also affects
// relative lengths — this function will only be able to measure the length component.
//
// styles: from style()
#let measure-pt(len, styles) = {
if typst-fields-supported {
// We can use fields to separate em from pt.
let pt = len.abs
let em = len.em
// Measure with abs (and later multiply by the sign) so negative em works.
// Otherwise it would return 0pt, and we would need to measure again with abs.
let measured-em = calc-sign(em) * measure(box(width: calc.abs(em) * 1em), styles).width
return pt + measured-em
}
// Fields not supported, so we have to measure twice when em can be negative.
let measured-pt = measure(box(width: len), styles).width
// If the measured length is positive, `len` must have overall been positive.
// There's nothing else to be done, so return the measured length.
if measured-pt > 0pt {
return measured-pt
}
// If we've reached this point, the previously measured length must have been `0pt`
// (drawing a line with a negative length will draw nothing, so measuring it will return `0pt`).
// Hence, `len` must either be `0pt` or negative.
// We multiply `len` by -1 to get a positive length, draw a line and measure it, then negate
// the measured length. This nicely handles the `0pt` case as well.
measured-pt = -measure(box(width: -len), styles).width
return measured-pt
}
// Convert a length of type length to pt.
//
// styles: from style()
#let convert-length-type-to-pt(len, styles: none) = {
// repr examples: "1pt", "1em", "0.5pt", "0.5em", "1pt + 1em", "-0.5pt + -0.5em"
if is-purely-pt-len(len) {
// No need to do any conversion because it must already be in pt.
return len
}
// At this point, we will need to draw a line for measurement,
// so we need the styles.
if styles == none {
panic("Cannot convert length to pt ('styles' not specified).")
}
return measure-pt(len, styles)
}
// Convert a ratio type length to pt
//
// page-size: equivalent to 100%
#let convert-ratio-type-to-pt(len, page-size) = {
assert(
is-purely-pt-len(page-size),
message: "'page-size' should be a purely pt length"
)
if page-size == none {
panic("Cannot convert ratio to pt ('page-size' not specified).")
}
if is-infinite-len(page-size) {
return 0pt // page has 'auto' size => % should return 0
}
((len / 1%) / 100) * page-size + 0pt // e.g. 100% / 1% = 100; / 100 = 1; 1 * page-size
}
// Convert a fraction type length to pt
//
// frac-amount: amount of 'fr' specified
// frac-total: total space shared by fractions
#let convert-fraction-type-to-pt(len, frac-amount, frac-total) = {
assert(
is-purely-pt-len(frac-total),
message: "'frac-total' should be a purely pt length"
)
if frac-amount == none {
panic("Cannot convert fraction to pt ('frac-amount' not specified).")
}
if frac-total == none {
panic("Cannot convert fraction to pt ('frac-total' not specified).")
}
if frac-amount <= 0 or is-infinite-len(frac-total) {
return 0pt
}
let len-per-frac = frac-total / frac-amount
(len-per-frac * (len / 1fr)) + 0pt
}
// Convert a relative type length to pt
//
// styles: from style()
// page-size: equivalent to 100% (optional because the length may not have a ratio component)
#let convert-relative-type-to-pt(len, styles, page-size: none) = {
if typst-fields-supported or eval(repr(0.00005em)) != 0.00005em {
// em repr changed in 0.11.0 => need to use fields here
// or use fields if they're supported anyway
return convert-ratio-type-to-pt(len.ratio, page-size) + convert-length-type-to-pt(len.length, styles: styles)
}
// We will need to draw a line for measurement later,
// so we need the styles.
if styles == none {
panic("Cannot convert relative length to pt ('styles' not specified).")
}
// Note on precision: the `repr` for em components is precise, unlike
// other length components, which are rounded to a precision of 2.
// This is true up to Typst 0.9.0 and possibly later versions.
let em-regex = regex(NUMBER-REGEX-STRING + "em")
let em-part-repr = repr(len).find(em-regex)
// Calculate the length minus its em component.
// E.g., 1% + 1pt + 1em -> 1% + 1pt
let (em-part, len-minus-em) = if em-part-repr == none {
(0em, len)
} else {
// SAFETY: guaranteed to be a purely em length by regex
let em-part = eval(em-part-repr)
(em-part, len - em-part)
}
// This will give only the pt part of the length.
// E.g., 1% + 1pt -> 1pt
// See the documentation on measure-pt for more information.
let pt-part = measure-pt(len-minus-em, styles)
// Since we have the values of the em and pt components,
// we can calculate the ratio part.
let ratio-part = len-minus-em - pt-part
let ratio-part-pt = if ratio-part == 0% {
// No point doing `convert-ratio-type-to-pt` if there's no ratio component.
0pt
} else {
convert-ratio-type-to-pt(ratio-part, page-size)
}
// The length part is the pt part + em part.
// Note: we cannot use `len - ratio-part` as that returns a `_rel-len-type` value,
// not a `_length-type` value.
let length-part-pt = convert-length-type-to-pt(pt-part + em-part, styles: styles)
ratio-part-pt + length-part-pt
}
// Convert a certain (non-relative) length to pt
//
// styles: from style()
// page-size: equivalent to 100%
// frac-amount: amount of 'fr' specified
// frac-total: total space shared by fractions
#let convert-length-to-pt(
len,
styles: none, page-size: none, frac-amount: none, frac-total: none
) = {
page-size = 0pt + page-size
if is-infinite-len(len) {
0pt // avoid the destruction of the universe
} else if type(len) == _length-type {
convert-length-type-to-pt(len, styles: styles)
} else if type(len) == _ratio-type {
convert-ratio-type-to-pt(len, page-size)
} else if type(len) == _fraction-type {
convert-fraction-type-to-pt(len, frac-amount, frac-total)
} else if type(len) == _rel-len-type {
convert-relative-type-to-pt(len, styles, page-size: page-size)
} else {
panic("Cannot convert '" + type(len) + "' to length.")
}
}
// Convert a stroke to its thickness
#let stroke-len(stroke, stroke-auto: 1pt, styles: none) = {
let no-ratio-error = "Tablex error: Stroke cannot be a ratio or relative length (i.e. have a percentage like '53%'). Try using the layout() function (or similar) to convert the percentage to 'pt' instead."
let stroke = default-if-auto(stroke, stroke-auto)
if type(stroke) == _length-type {
convert-length-to-pt(stroke, styles: styles)
} else if type(stroke) in (_rel-len-type, _ratio-type) {
panic(no-ratio-error)
} else if is-color(stroke) {
1pt
} else if type(stroke) == _stroke-type {
if typst-fields-supported {
// No need for any repr() parsing, just use the thickness field.
let thickness = default-if-auto(stroke.thickness, 1pt)
return convert-length-to-pt(thickness, styles: styles)
}
// support:
// - 2pt / 2em / 2cm / 2in + color
// - 2.5pt / 2.5em / ... + color
// - 2pt + 3em + color
let len-regex = "(?:" + NUMBER-REGEX-STRING + "(?:em|pt|cm|in|%)(?:\\s+\\+\\s+" + NUMBER-REGEX-STRING + "em)?)"
let r = regex("^" + len-regex)
let s = repr(stroke).find(r)
if s == none {
// for more complex strokes, built through dictionaries
// => "thickness: 5pt" field
// note: on typst v0.7.0 or later, can just use 's.thickness'
let r = regex("thickness: (" + len-regex + ")")
s = repr(stroke).match(r)
if s != none {
s = s.captures.first(); // get the first match (the thickness)
}
}
if s == none {
1pt // okay it's probably just a color then
} else {
let len = eval(s)
if type(len) == _length-type {
convert-length-to-pt(len, styles: styles)
} else if type(len) in (_rel-len-type, _ratio-type) {
panic(no-ratio-error)
} else {
1pt // should be unreachable
}
}
} else if type(stroke) == _dict-type and "thickness" in stroke {
let thickness = stroke.thickness
if type(thickness) == _length-type {
convert-length-to-pt(thickness, styles: styles)
} else if type(thickness) in (_rel-len-type, _ratio-type) {
panic(no-ratio-error)
} else {
1pt
}
} else {
1pt
}
}
// --- end: utility functions ---
// --- grid functions ---
#let create-grid(width, initial_height) = (
tablex-dict-type: "grid",
items: init-array(width * initial_height),
width: width
)
#let is-tablex-grid(value) = is-tablex-dict-type("grid")
// Gets the index of (x, y) in a grid's array.
#let grid-index-at(x, y, grid: none, width: none) = {
width = default-if-none(grid, (width: width)).width
width = calc.floor(width)
(y * width) + calc-mod(x, width)
}
// Gets the cell at the given grid x, y position.
// Width (amount of columns) per line must be known.
// E.g. grid-at(grid, 5, 2, width: 7) => 5th column, 2nd row (7 columns per row)
#let grid-at(grid, x, y) = {
let index = grid-index-at(x, y, width: grid.width)
if index < grid.items.len() {
grid.items.at(index)
} else {
none
}
}
// Returns 'true' if the cell at (x, y)
// exists in the grid.
#let grid-has-pos(grid, x, y) = (
grid-index-at(x, y, grid: grid) < grid.items.len()
)
// How many rows are in this grid? (Given its width)
#let grid-count-rows(grid) = (
calc.floor(grid.items.len() / grid.width)
)
// Converts a grid array index to (x, y)
#let grid-index-to-pos(grid, index) = (
(calc-mod(index, grid.width), calc.floor(index / grid.width))
)
// Fetches an entire row of cells (all positions with the given y).
#let grid-get-row(grid, y) = {
let len = grid.items.len()
// position of the first cell in that row.
let first-row-pos = grid-index-at(0, y, grid: grid)
if len <= first-row-pos {
// grid isn't large enough, so no row to return
(none,) * grid.width
} else {
// position right after the last cell in this row
let next-row-pos = first-row-pos + grid.width
let cell-row = grid.items.slice(first-row-pos, calc.min(len, next-row-pos))
let cell-row-len = cell-row.len()
if cell-row-len < grid.width {
// the row isn't complete because the grid wasn't large enough.
let missing-cells = (none,) * (grid.width - cell-row-len)
cell-row += missing-cells
}
cell-row
}
}
// Fetches an entire column of cells (all positions with the given x).
#let grid-get-column(grid, x) = {
range(grid-count-rows(grid)).map(y => grid-at(grid, x, y))
}
// Expand grid to the given coords (add the missing cells)
#let grid-expand-to(grid, x, y, fill_with: (grid) => none) = {
let rows = grid-count-rows(grid)
let rowws = rows
// quickly add missing rows
while rows < y {
grid.items += (fill_with(grid),) * grid.width
rows += 1
}
let now = grid-index-to-pos(grid, grid.items.len() - 1)
// now columns and/or last missing row
while not grid-has-pos(grid, x, y) {
grid.items.push(fill_with(grid))
}
let new = grid-index-to-pos(grid, grid.items.len() - 1)
grid
}
// if occupied (extension of a cell) => get the cell that generated it.
// if a normal cell => return it, untouched.
#let get-parent-cell(cell, grid: none) = {
if is-tablex-occupied(cell) {
grid-at(grid, cell.parent_x, cell.parent_y)
} else if is-tablex-cell(cell) {
cell
} else {
panic("Cannot get parent table cell of a non-cell object: " + repr(cell))
}
}
// Return the next position available on the grid
#let next-available-position(
grid, x: 0, y: 0, x_limit: 0, y_limit: 0
) = {
let cell = (x, y)
let there_is_next(cell_pos) = {
let grid_cell = grid-at(grid, ..cell_pos)
grid_cell != none
}
while there_is_next(cell) {
x += 1
if x >= x_limit {
x = 0
y += 1
}
cell = (x, y)
if y >= y_limit { // last row reached - stop
break
}
}
cell
}
// Organize cells in a grid from the given items,
// and also get all given lines
#let generate-grid(items, x_limit: 0, y_limit: 0, map-cells: none, fit-spans: none) = {
// init grid as a matrix
// y_limit x x_limit
let grid = create-grid(x_limit, y_limit)
let grid-index-at = grid-index-at.with(width: x_limit)
let hlines = ()
let vlines = ()
let prev_x = 0
let prev_y = 0
let x = 0
let y = 0
let first_cell_reached = false // if true, hline should always be placed after the current row
let row_wrapped = false // if true, a vline should be added to the end of a row
let range_of_items = range(items.len())
let new_empty_cell(grid, index: auto) = {
let empty_cell = cellx[]
let index = default-if-auto(index, grid.items.len())
let new_cell_pos = grid-index-to-pos(grid, index)
empty_cell.x = new_cell_pos.at(0)
empty_cell.y = new_cell_pos.at(1)
empty_cell
}
// go through all input
for i in range_of_items {
let item = items.at(i)
// allow specifying () to change vline position
if type(item) == _array-type and item.len() == 0 {
if x == 0 and y == 0 { // increment vline's secondary counter
prev_x += 1
}
continue // ignore all '()'
}
let item = table-item-convert(item)
if is-some-tablex-line(item) { // detect lines' x, y
if is-tablex-hline(item) {
let this_y = if first_cell_reached {
prev_y + 1
} else {
prev_y
}
item.y = default-if-auto(item.y, this_y)
hlines.push(item)
} else if is-tablex-vline(item) {
if item.x == auto {
if x == 0 and y == 0 { // placed before any elements
item.x = prev_x
prev_x += 1 // use this as a 'secondary counter'
// in the meantime
if prev_x > x_limit + 1 {
panic("Error: Specified way too many vlines or empty () cells before the first row of the table. (Note that () is used to separate vline()s at the beginning of the table.) Please specify at most " + str(x_limit + 1) + " empty cells or vlines before the first cell of the table.")
}
} else if row_wrapped {
item.x = x_limit // allow v_line at the last column
row_wrapped = false
} else {
item.x = x
}
}
vlines.push(item)
} else {
panic("Invalid line received (must be hline or vline).")
}
items.at(i) = item // override item with the new x / y coord set
continue
}
let cell = item
assert(is-tablex-cell(cell), message: "All table items must be cells or lines.")
first_cell_reached = true
let this_x = default-if-auto(cell.x, x)
let this_y = default-if-auto(cell.y, y)
if cell.x == none or cell.y == none {
panic("Error: Received cell with 'none' as x or y.")
}
if this_x == none or this_y == none {
panic("Internal tablex error: Grid wasn't large enough to fit the given cells. (Previous position: " + repr((prev_x, prev_y)) + ", new cell: " + repr(cell) + ")")
}
cell.x = this_x
cell.y = this_y
if type(map-cells) == _function-type {
cell = table-item-convert(map-cells(cell))
}
assert(is-tablex-cell(cell), message: "Tablex error: 'map-cells' returned something that isn't a valid cell.")
if row_wrapped {
row_wrapped = false
}
let content = cell.content
let content = if type(content) == _function-type {
let res = content(this_x, this_y)
if is-tablex-cell(res) {
cell = res
this_x = cell.x
this_y = cell.y
[#res.content]
} else {
[#res]
}
} else {
[#content]
}
if this_x == none or this_y == none {
panic("Error: Cell with function as content returned another cell with 'none' as x or y!")
}
if type(this_x) != _int-type or type(this_y) != _int-type {
panic("Error: Cell coordinates must be integers. Invalid pair: " + repr((this_x, this_y)))
}
cell.content = content
// resolve 'fit-spans' option for this cell
if "fit-spans" not in cell {
cell.fit-spans = auto
} else if cell.fit-spans != auto {
cell.fit-spans = validate-fit-spans(cell.fit-spans, default: fit-spans, error-prefix: "At cell (" + str(this_x) + ", " + str(this_y) + "):")
}
// up to which 'y' does this cell go
let max_x = this_x + cell.colspan - 1
let max_y = this_y + cell.rowspan - 1
if this_x >= x_limit {
panic("Error: Cell at " + repr((this_x, this_y)) + " is placed at an inexistent column.")
}
if max_x >= x_limit {
panic("Error: Cell at " + repr((this_x, this_y)) + " has a colspan of " + repr(cell.colspan) + ", which would exceed the available columns.")
}
let cell_positions = positions-spanned-by(cell, x: this_x, y: this_y, x_limit: x_limit, y_limit: none)
for position in cell_positions {
let (px, py) = position
let currently_there = grid-at(grid, px, py)
if currently_there != none {
let parent_cell = get-parent-cell(currently_there, grid: grid)
panic("Error: Multiple cells attempted to occupy the cell position at " + repr((px, py)) + ": one starting at " + repr((this_x, this_y)) + ", and one starting at " + repr((parent_cell.x, parent_cell.y)))
}
// initial position => assign it to the cell's x/y
if position == (this_x, this_y) {
cell.x = this_x
cell.y = this_y
// expand grid to allow placing this cell (including colspan / rowspan)
let grid_expand_res = grid-expand-to(grid, grid.width - 1, max_y)
grid = grid_expand_res
y_limit = grid-count-rows(grid)
let index = grid-index-at(this_x, this_y)
if index > grid.items.len() {
panic("Internal tablex error: Could not expand grid to include cell at " + repr((this_x, this_y)))
}
grid.items.at(index) = cell
items.at(i) = cell
// other secondary position (from colspan / rowspan)
} else {
let index = grid-index-at(px, py)
grid.items.at(index) = occupied(x: px, y: py, parent_x: this_x, parent_y: this_y) // indicate this position's parent cell (to join them later)
}
}
let next_pos = next-available-position(grid, x: this_x, y: this_y, x_limit: x_limit, y_limit: y_limit)
prev_x = this_x
prev_y = this_y
x = next_pos.at(0)
y = next_pos.at(1)
if prev_y != y {
row_wrapped = true // we changed rows!
}
}
// for missing cell positions: add empty cell
for (index, item) in grid.items.enumerate() {
if item == none {
grid.items.at(index) = new_empty_cell(grid, index: index)
}
}
// while there are incomplete rows for some reason, add empty cells
while calc-mod(grid.items.len(), grid.width) != 0 {
grid.items.push(new_empty_cell(grid))
}
(
grid: grid,
items: grid.items,
hlines: hlines,
vlines: vlines,
new_row_count: grid-count-rows(grid)
)
}
// -- end: grid functions --
// -- col/row size functions --
// Makes a cell's box, using the given options
// cell - The cell data (including content)
// width, height - The cell's dimensions
// inset - The table's inset
// align_default - The default alignment if the cell doesn't specify one
// fill_default - The default fill color / etc if the cell doesn't specify one
#let make-cell-box(
cell,
width: 0pt, height: 0pt, inset: 5pt,
align_default: left,
fill_default: none) = {
let align_default = if type(align_default) == _function-type {
align_default(cell.x, cell.y) // column, row
} else {
align_default
}
let fill_default = if type(fill_default) == _function-type {
fill_default(cell.x, cell.y) // row, column
} else {
fill_default
}
let content = cell.content
let inset = default-if-auto(cell.inset, inset)
// use default align (specified in
// table 'align:')
// when the cell align is 'auto'
let cell_align = default-if-auto(cell.align, align_default)
// same here for fill
let cell_fill = default-if-auto(cell.fill, fill_default)
if type(cell_fill) == _array-type {
let fill_len = cell_fill.len()
if fill_len == 0 {
// no fill values specified
// => no fill
cell_fill = none
} else if cell.x == auto {
// for some reason the cell x wasn't yet
// determined => just take the last
// fill value
cell_fill = cell_fill.last()
} else {
// use mod to make the fill value pattern
// repeat if there are more columns than
// fill values.
cell_fill = cell_fill.at(calc-mod(cell.x, fill_len))
}
}
if cell_fill != none and not is-color(cell_fill) {
panic("Tablex error: Invalid fill specified (must be either a function (column, row) -> fill, a color, an array of valid fill values, or 'none').")
}
if type(cell_align) == _array-type {
let align_len = cell_align.len()
if align_len == 0 {
// no alignment values specified
// => inherit from outside
cell_align = auto
} else if cell.x == auto {
// for some reason the cell x wasn't yet
// determined => just take the last
// alignment value
cell_align = cell_align.last()
} else {
// use mod to make the align value pattern
// repeat if there are more columns than
// align values.
cell_align = cell_align.at(calc-mod(cell.x, align_len))
}
}
if cell_align != auto and type(cell_align) not in (_align-type, _2d-align-type) {
panic("Tablex error: Invalid alignment specified (must be either a function (column, row) -> alignment, an alignment value - such as 'left' or 'center + top' -, an array of alignment values (one for each column), or 'auto').")
}
let aligned_cell_content = if cell_align == auto {
[#content]
} else {
align(cell_align)[#content]
}
if is-infinite-len(inset) {
panic("Tablex error: inset must not be infinite")
}
box(
width: width, height: height,
inset: inset, fill: cell_fill,
// avoid #set problems
baseline: 0pt,
outset: 0pt, radius: 0pt, stroke: none,
aligned_cell_content)
}
// Sums the sizes of fixed-size tracks (cols/rows). Anything else
// (auto, 1fr, ...) is ignored.
#let sum-fixed-size-tracks(tracks) = {
tracks.fold(0pt, (acc, el) => {
if type(el) == _length-type {
acc + el
} else {
acc
}
})
}
// Calculate the size of fraction tracks (cols/rows) (1fr, 2fr, ...),
// based on the remaining sizes (after fixed-size and auto columns)
#let determine-frac-tracks(tracks, remaining: 0pt, gutter: none) = {
let frac-tracks = tracks.enumerate().filter(t => type(t.at(1)) == _fraction-type)
let amount-frac = frac-tracks.fold(0, (acc, el) => acc + (el.at(1) / 1fr))
if type(gutter) == _fraction-type {
amount-frac += (gutter / 1fr) * (tracks.len() - 1)
}
let frac-width = if amount-frac > 0 and not is-infinite-len(remaining) {
remaining / amount-frac
} else {
0pt
}
if type(gutter) == _fraction-type {
gutter = frac-width * (gutter / 1fr)
}
for (i, size) in frac-tracks {
tracks.at(i) = frac-width * (size / 1fr)
}
(tracks: tracks, gutter: gutter)
}
// Gets the last (rightmost) auto column a cell is inserted in, for
// due expansion
#let get-colspan-last-auto-col(cell, columns: none) = {
let cell-cols = range(cell.x, cell.x + cell.colspan)
let last_auto_col = none
for (i, col) in columns.enumerate() {
if i in cell-cols and col == auto {
last_auto_col = max-if-not-none(last_auto_col, i)
}
}
last_auto_col
}
// Gets the last (bottom-most) auto row a cell is inserted in, for
// due expansion
#let get-rowspan-last-auto-row(cell, rows: none) = {
let cell-rows = range(cell.y, cell.y + cell.rowspan)
let last_auto_row = none
for (i, row) in rows.enumerate() {
if i in cell-rows and row == auto {
last_auto_row = max-if-not-none(last_auto_row, i)
}
}
last_auto_row
}
// Given a cell that may span one or more columns, sums the
// sizes of the columns it spans, when those columns have fixed sizes.
// Useful to subtract from the total width to find out how much more
// should an auto column extend to have that cell fit in the table.
#let get-colspan-fixed-size-covered(cell, columns: none) = {
let cell-cols = range(cell.x, cell.x + cell.colspan)
let size = 0pt
for (i, col) in columns.enumerate() {
if i in cell-cols and type(col) == _length-type {
size += col
}
}
size
}
// Given a cell that may span one or more rows, sums the
// sizes of the rows it spans, when those rows have fixed sizes.
// Useful to subtract from the total height to find out how much more
// should an auto row extend to have that cell fit in the table.
#let get-rowspan-fixed-size-covered(cell, rows: none) = {
let cell-rows = range(cell.y, cell.y + cell.rowspan)
let size = 0pt
for (i, row) in rows.enumerate() {
if i in cell-rows and type(row) == _length-type {
size += row
}
}
size
}
// calculate the size of auto columns (based on the max width of their cells)
#let determine-auto-columns(grid: (), styles: none, columns: none, inset: none, align: auto, fit-spans: none, page-width: 0pt) = {
assert(styles != none, message: "Cannot measure auto columns without styles")
let total_auto_size = 0pt
let auto_sizes = ()
let new_columns = columns
let all-frac-columns = columns.enumerate().filter(i-col => type(i-col.at(1)) == _fraction-type).map(i-col => i-col.at(0))
for (i, col) in columns.enumerate() {
if col == auto {
// max cell width
let col_size = grid-get-column(grid, i)
.fold(0pt, (max, cell) => {
if cell == none {
panic("Not enough cells specified for the given amount of rows and columns.")
}
let pcell = get-parent-cell(cell, grid: grid) // in case this is a colspan
let last-auto-col = get-colspan-last-auto-col(pcell, columns: columns)
let fit-this-span = if "fit-spans" in pcell and pcell.fit-spans != auto {
pcell.fit-spans.x
} else {
fit-spans.x
}
let this-cell-can-expand-columns = pcell.colspan == 1 or not fit-this-span
// only expand the last auto column of a colspan,
// and only the amount necessary that isn't already
// covered by fixed size columns.
// However, ignore this cell if it is a colspan with
// `fit-spans.x == true` (it requests to not expand
// columns).
if last-auto-col == i and this-cell-can-expand-columns {
let cell-spans-all-frac-columns = pcell.colspan > 1 and all-frac-columns.len() > 0 and all-frac-columns.all(i => pcell.x <= i and i < (pcell.x + pcell.colspan))
if cell-spans-all-frac-columns and page-width != 0pt and not is-infinite-len(page-width) {
// HEURISTIC (only effective when the page width isn't 'auto' / infinite):
// If this cell can expand auto cols, but it already
// spans all fractional columns, then don't expand
// this auto column, as the cell would already have
// all remaining available space for itself anyway
// through the fractional columns spanned.
// Effectively, ignore this colspan - it will already
// have the max space possible, since, eventually,
// auto columns will be reduced to fit in the available
// size.
// For 'auto'-width pages, fractional columns will
// always have 0pt width, so this doesn't apply.
return max
}
// take extra inset as extra width or height on 'auto'
let cell_inset = default-if-auto(pcell.inset, inset)
// simulate wrapping this cell in the final box,
// but with unlimited width and height available
// so we can measure its width.
let cell-box = make-cell-box(
pcell,
width: auto, height: auto,
inset: cell_inset, align_default: auto
)
let width = measure(cell-box, styles).width// + 2*cell_inset // the box already considers inset
// here, we are excluding from the width of this cell
// at this column all width that was already covered by
// previous columns, so we need to specify 'new_columns'
// instead of 'columns' as the previous auto columns
// also have a fixed size now (we know their width).
let fixed_size = get-colspan-fixed-size-covered(pcell, columns: new_columns)
calc.max(max, width - fixed_size, 0pt)
} else {
max
}
})
total_auto_size += col_size
auto_sizes.push((i, col_size))
new_columns.at(i) = col_size
}
}
(total: total_auto_size, sizes: auto_sizes, columns: new_columns)
}
// Try to reduce the width of auto columns so that the table fits within the
// page width.
// Fair version of the algorithm, tries to shrink the minimum amount of columns
// possible. The same algorithm used by native tables.
// Auto columns that are too wide will receive equal amounts of the remaining
// width (the "fair-share").
#let fit-auto-columns(available: 0pt, auto-cols: none, columns: none) = {
if is-infinite-len(available) {
// infinite space available => don't modify columns
return columns
}
// Remaining space to share between auto columns.
// Starts as all of the available space (excluding fixed-width columns).
// Will reduce as we exclude auto columns from being resized.
let remaining = available
let auto-cols-to-resize = auto-cols.len()
if auto-cols-to-resize <= 0 {
return columns
}
// The fair-share must be the largest possible (to ensure maximum fairness)
// such that we can shrink the minimum amount of columns possible and, at the
// same time, ensure that the table won't cross the page width.
// To do this, we will try to divide the space evenly between each auto column
// to be resized.
// If one or more auto columns are smaller than that, then they don't need to be
// resized, so we will increase the fair share and check other columns, until
// either none needs to be resized (all are smaller than the fair share)
// or all columns to be resized are larger than the fair share.
let last-share
let fair-share = none
let fair-share-should-change = true
// 1. Rule out auto columns from resizing, and determine the final fair share
// (the largest possible such that no columns are smaller than it).
// One iteration of this 'while' runs for each attempt at a value for the fair
// share. Once no non-excluded columns are smaller than the fair share
// (which would otherwise lead to them being excluded from being resized, and the
// fair share would increase), the loop stops, and we can resize down all columns
// larger than the fair share.
// The loop also stops if all auto columns would be smaller than the fair share,
// and thus there is nothing to resize.
while fair-share-should-change and auto-cols-to-resize > 0 {
last-share = fair-share
fair-share = remaining / auto-cols-to-resize
fair-share-should-change = false
for (_, col) in auto-cols {
// 1. If it is smaller than the fair share,
// then it can keep its size, and we should
// update the fair share.
// 2. If it is larger than the last fair share,
// then it wasn't already excluded in any previous
// iterations.
if col <= fair-share and (last-share == none or col > last-share) {
remaining -= col
auto-cols-to-resize -= 1
fair-share-should-change = true
}
}
}
// 2. Resize any columns larger than the calculated fair share to the fair share.
for (i, col) in auto-cols {
if col > fair-share {
columns.at(i) = fair-share
}
}
columns
}
#let determine-column-sizes(grid: (), page_width: 0pt, styles: none, columns: none, inset: none, align: auto, col-gutter: none, fit-spans: none) = {
let columns = columns.map(c => {
if type(c) in (_length-type, _rel-len-type, _ratio-type) {
convert-length-to-pt(c, styles: styles, page-size: page_width)
} else if c == none {
0pt
} else {
c
}
})
// what is the fixed size of the gutter?
// (calculate it later if it's fractional)
let fixed-size-gutter = if type(col-gutter) == _length-type {
col-gutter
} else {
0pt
}
let total_fixed_size = sum-fixed-size-tracks(columns) + fixed-size-gutter * (columns.len() - 1)
let available_size = page_width - total_fixed_size
// page_width == 0pt => page width is 'auto'
// so we don't have to restrict our table's size
if available_size >= 0pt or page_width == 0pt {
let auto_cols_result = determine-auto-columns(grid: grid, styles: styles, columns: columns, inset: inset, align: align, fit-spans: fit-spans, page-width: page_width)
let total_auto_size = auto_cols_result.total
let auto_sizes = auto_cols_result.sizes
columns = auto_cols_result.columns
let remaining_size = available_size - total_auto_size
if remaining_size >= 0pt {
let frac_res = determine-frac-tracks(
columns,
remaining: remaining_size,
gutter: col-gutter
)
columns = frac_res.tracks
fixed-size-gutter = frac_res.gutter
} else {
// don't shrink on width 'auto'
if page_width != 0pt {
columns = fit-auto-columns(
available: available_size,
auto-cols: auto_sizes,
columns: columns
)
}
columns = columns.map(c => {
if type(c) == _fraction-type {
0pt // no space left to be divided
} else {
c
}
})
}
} else {
columns = columns.map(c => {
if c == auto or type(c) == _fraction-type {
0pt // no space remaining!
} else {
c
}
})
}
(
columns: columns,
gutter: if col-gutter == none {
none
} else {
fixed-size-gutter
}
)
}
// calculate the size of auto rows (based on the max height of their cells)
#let determine-auto-rows(grid: (), styles: none, columns: none, rows: none, align: auto, inset: none, fit-spans: none) = {
assert(styles != none, message: "Cannot measure auto rows without styles")
let total_auto_size = 0pt
let auto_sizes = ()
let new_rows = rows
for (i, row) in rows.enumerate() {
if row == auto {
// max cell height
let row_size = grid-get-row(grid, i)
.fold(0pt, (max, cell) => {
if cell == none {
panic("Not enough cells specified for the given amount of rows and columns.")
}
let pcell = get-parent-cell(cell, grid: grid) // in case this is a rowspan
let last-auto-row = get-rowspan-last-auto-row(pcell, rows: rows)
let fit-this-span = if "fit-spans" in pcell and pcell.fit-spans != auto {
pcell.fit-spans.y
} else {
fit-spans.y
}
let this-cell-can-expand-rows = pcell.rowspan == 1 or not fit-this-span
// only expand the last auto row of a rowspan,
// and only the amount necessary that isn't already
// covered by fixed size rows.
// However, ignore this cell if it is a rowspan with
// `fit-spans.y == true` (it requests to not expand
// rows).
if last-auto-row == i and this-cell-can-expand-rows {
let width = get-colspan-fixed-size-covered(pcell, columns: columns)
// take extra inset as extra width or height on 'auto'
let cell_inset = default-if-auto(pcell.inset, inset)
let cell-box = make-cell-box(
pcell,
width: width, height: auto,
inset: cell_inset, align_default: align
)
// measure the cell's actual height,
// with its calculated width
// and with other constraints
let height = measure(cell-box, styles).height// + 2*cell_inset (box already considers inset)
// here, we are excluding from the height of this cell
// at this row all height that was already covered by
// other rows, so we need to specify 'new_rows' instead
// of 'rows' as the previous auto rows also have a fixed
// size now (we know their height).
let fixed_size = get-rowspan-fixed-size-covered(pcell, rows: new_rows)
calc.max(max, height - fixed_size, 0pt)
} else {
max
}
})
total_auto_size += row_size
auto_sizes.push((i, row_size))
new_rows.at(i) = row_size
}
}
(total: total_auto_size, sizes: auto_sizes, rows: new_rows)
}
#let determine-row-sizes(grid: (), page_height: 0pt, styles: none, columns: none, rows: none, align: auto, inset: none, row-gutter: none, fit-spans: none) = {
let rows = rows.map(r => {
if type(r) in (_length-type, _rel-len-type, _ratio-type) {
convert-length-to-pt(r, styles: styles, page-size: page_height)
} else {
r
}
})
let auto_rows_res = determine-auto-rows(
grid: grid, columns: columns, rows: rows, styles: styles, align: align, inset: inset, fit-spans: fit-spans
)
let auto_size = auto_rows_res.total
rows = auto_rows_res.rows
// what is the fixed size of the gutter?
// (calculate it later if it's fractional)
let fixed-size-gutter = if type(row-gutter) == _length-type {
row-gutter
} else {
0pt
}
let remaining = page_height - sum-fixed-size-tracks(rows) - auto_size - fixed-size-gutter * (rows.len() - 1)
if remaining >= 0pt { // split fractions in one page
let frac_res = determine-frac-tracks(rows, remaining: remaining, gutter: row-gutter)
(
rows: frac_res.tracks,
gutter: frac_res.gutter
)
} else {
(
rows: rows.map(r => {
if type(r) == _fraction-type { // no space remaining in this page or box
0pt
} else {
r
}
}),
gutter: if row-gutter == none {
none
} else {
fixed-size-gutter
}
)
}
}
// Determine the size of 'auto' and 'fr' columns and rows
#let determine-auto-column-row-sizes(
grid: (),
page_width: 0pt, page_height: 0pt,
styles: none,
columns: none, rows: none,
inset: none, gutter: none,
align: auto,
fit-spans: none,
) = {
let columns_res = determine-column-sizes(
grid: grid,
page_width: page_width, styles: styles, columns: columns,
inset: inset,
align: align,
col-gutter: gutter.col,
fit-spans: fit-spans
)
columns = columns_res.columns
gutter.col = columns_res.gutter
let rows_res = determine-row-sizes(
grid: grid,
page_height: page_height, styles: styles,
columns: columns, // so we consider available width
rows: rows,
inset: inset,
align: align,
row-gutter: gutter.row,
fit-spans: fit-spans
)
rows = rows_res.rows
gutter.row = rows_res.gutter
(
columns: columns,
rows: rows,
gutter: gutter
)
}
// -- end: col/row size functions --
// -- width/height utilities --
#let width-between(start: 0, end: none, columns: (), gutter: none, pre-gutter: false) = {
let col-gutter = default-if-none(default-if-none(gutter, (col: 0pt)).col, 0pt)
end = default-if-none(end, columns.len())
let col_range = range(start, calc.min(columns.len() + 1, end))
let sum = 0pt
for i in col_range {
sum += columns.at(i) + col-gutter
}
// if the end is after all columns, there is
// no gutter at the end.
if pre-gutter or end == columns.len() {
sum = calc.max(0pt, sum - col-gutter) // remove extra gutter from last col
}
sum
}
#let height-between(start: 0, end: none, rows: (), gutter: none, pre-gutter: false) = {
let row-gutter = default-if-none(default-if-none(gutter, (row: 0pt)).row, 0pt)
end = default-if-none(end, rows.len())
let row_range = range(start, calc.min(rows.len() + 1, end))
let sum = 0pt
for i in row_range {
sum += rows.at(i) + row-gutter
}
// if the end is after all rows, there is
// no gutter at the end.
if pre-gutter or end == rows.len() {
sum = calc.max(0pt, sum - row-gutter) // remove extra gutter from last row
}
sum
}
#let cell-width(x, colspan: 1, columns: (), gutter: none) = {
width-between(start: x, end: x + colspan, columns: columns, gutter: gutter, pre-gutter: true)
}
#let cell-height(y, rowspan: 1, rows: (), gutter: none) = {
height-between(start: y, end: y + rowspan, rows: rows, gutter: gutter, pre-gutter: true)
}
// override start and end for vlines and hlines (keep styling options and stuff)
#let v-or-hline-with-span(v_or_hline, start: none, end: none) = {
(
..v_or_hline,
start: start,
end: end,
parent: v_or_hline // the one that generated this
)
}
// check the subspan a hline or vline goes through inside a larger span
#let get-included-span(l_start, l_end, start: 0, end: 0, limit: 0) = {
if l_start in (none, auto) {
l_start = 0
}
if l_end in (none, auto) {
l_end = limit
}
l_start = calc.max(0, l_start)
l_end = calc.min(end, limit)
// ---- ==== or ==== ----
if l_end < start or l_start > end {
return none
}
// --##== ; ==##-- ; #### ; ... : intersection.
(calc.max(l_start, start), calc.min(l_end, end))
}
// restrict hlines and vlines to the cells' borders.
// i.e.
// | (vline)
// |
// (hline) ----====--- (= and || indicate intersection)
// | ||
// ---- <--- sample cell
#let v-and-hline-spans-for-cell(cell, hlines: (), vlines: (), x_limit: 0, y_limit: 0, grid: ()) = {
// only draw lines from the parent cell
if is-tablex-occupied(cell) {
return (
hlines: (),
vlines: ()
);
}
let hlines = hlines
.filter(h => {
let y = h.y
let in_top_or_bottom = y in (cell.y, cell.y + cell.rowspan)
let hline_hasnt_already_ended = (
h.end in (auto, none) // always goes towards the right
or h.end >= cell.x + cell.colspan // ends at or after this cell
)
(in_top_or_bottom
and hline_hasnt_already_ended)
})
.map(h => {
// get the intersection between the hline and the cell's x-span.
let span = get-included-span(h.start, h.end, start: cell.x, end: cell.x + cell.colspan, limit: x_limit)
if span == none { // no intersection!
none
} else {
v-or-hline-with-span(h, start: span.at(0), end: span.at(1))
}
})
.filter(x => x != none)
let vlines = vlines
.filter(v => {
let x = v.x
let at_left_or_right = x in (cell.x, cell.x + cell.colspan)
let vline_hasnt_already_ended = (
v.end in (auto, none) // always goes towards the bottom
or v.end >= cell.y + cell.rowspan // ends at or after this cell
)
(at_left_or_right
and vline_hasnt_already_ended)
})
.map(v => {
// get the intersection between the hline and the cell's x-span.
let span = get-included-span(v.start, v.end, start: cell.y, end: cell.y + cell.rowspan, limit: y_limit)
if span == none { // no intersection!
none
} else {
v-or-hline-with-span(v, start: span.at(0), end: span.at(1))
}
})
.filter(x => x != none)
(
hlines: hlines,
vlines: vlines
)
}
// Are two hlines the same?
// (Check to avoid double drawing)
#let is-same-hline(a, b) = (
is-tablex-hline(a)
and is-tablex-hline(b)
and a.y == b.y
and a.start == b.start
and a.end == b.end
and a.gutter-restrict == b.gutter-restrict
)
#let _largest-stroke-among-lines(lines, stroke-auto: 1pt, styles: none) = (
calc.max(0pt, ..lines.map(l => stroke-len(l.stroke, stroke-auto: stroke-auto, styles: styles)))
)
#let _largest-stroke-among-hlines-at-y(y, hlines: none, stroke-auto: 1pt, styles: none) = {
_largest-stroke-among-lines(hlines.filter(h => h.y == y), stroke-auto: stroke-auto, styles: styles)
}
#let _largest-stroke-among-vlines-at-x(x, vlines: none, stroke-auto: 1pt, styles: none) = {
_largest-stroke-among-lines(vlines.filter(v => v.x == x), stroke-auto: stroke-auto, styles: styles)
}
// -- end: width/height utilities --
// -- drawing --
#let parse-stroke(stroke) = {
if is-color(stroke) {
stroke + 1pt
} else if type(stroke) in (_length-type, _rel-len-type, _ratio-type, _stroke-type, _dict-type) or stroke in (none, auto) {
stroke
} else {
panic("Invalid stroke '" + repr(stroke) + "'.")
}
}
// How much should this line expand?
// If it's not at the edge of the parent line => don't expand
// spanned-tracks-len: row_len (if vline), col_len (if hline)
#let get-actual-expansion(line, spanned-tracks-len: 0) = {
// TODO: better handle negative expansion
if line.expand in (none, (none, none), auto, (auto, auto)) {
return (none, none)
}
if type(line.expand) != _array-type {
line.expand = (line.expand, line.expand)
}
let parent = get-top-parent(line)
let parent-start = default-if-auto-or-none(parent.start, 0)
let parent-end = default-if-auto-or-none(parent.end, spanned-tracks-len)
let start = default-if-auto-or-none(line.start, 0)
let end = default-if-auto-or-none(line.end, spanned-tracks-len)
let expansion = (none, none)
if start == parent-start { // starts where its parent starts
expansion.at(0) = default-if-auto(line.expand.at(0), 0pt) // => expand to the left
}
if end == parent-end { // ends where its parent ends
expansion.at(1) = default-if-auto(line.expand.at(1), 0pt) // => expand to the right
}
expansion
}
#let draw-hline(
hline,
initial_x: 0, initial_y: 0, columns: (), rows: (), stroke: auto, vlines: (), gutter: none, pre-gutter: false,
styles: none,
rightmost_x: 0, rtl: false,
) = {
let start = hline.start
let end = hline.end
let stroke-auto = parse-stroke(stroke)
let stroke = default-if-auto(hline.stroke, stroke)
let stroke = parse-stroke(stroke)
if default-if-auto-or-none(start, 0) == default-if-auto-or-none(end, columns.len()) { return }
if gutter != none and gutter.row != none and ((pre-gutter and hline.gutter-restrict == bottom) or (not pre-gutter and hline.gutter-restrict == top)) {
return
}
let expand = get-actual-expansion(hline, spanned-tracks-len: columns.len())
let left-expand = default-if-auto-or-none(expand.at(0), 0pt)
let right-expand = default-if-auto-or-none(expand.at(1), 0pt)
if default-if-auto(hline.stroke-expand, true) == true {
let largest-stroke = _largest-stroke-among-vlines-at-x.with(vlines: vlines, stroke-auto: stroke-auto, styles: styles)
left-expand += largest-stroke(default-if-auto-or-none(start, 0)) / 2 // expand to the left to close stroke gap
right-expand += largest-stroke(default-if-auto-or-none(end, columns.len())) / 2 // close stroke gap to the right
}
let y = height-between(start: initial_y, end: hline.y, rows: rows, gutter: gutter, pre-gutter: pre-gutter)
let start_x = width-between(start: initial_x, end: start, columns: columns, gutter: gutter, pre-gutter: false) - left-expand
let end_x = width-between(start: initial_x, end: end, columns: columns, gutter: gutter, pre-gutter: hline.stop-pre-gutter == true) + right-expand
if end_x - start_x < 0pt {
return // negative length
}
if rtl {
// invert the line (start from the right instead of from the left)
start_x = rightmost_x - start_x
end_x = rightmost_x - end_x
}
let start = (
start_x,
y
)
let end = (
end_x,
y
)
if stroke != auto {
if stroke != none {
line(start: start, end: end, stroke: stroke)
}
} else {
line(start: start, end: end)
}
}
#let draw-vline(
vline,
initial_x: 0, initial_y: 0, columns: (), rows: (), stroke: auto,
gutter: none, hlines: (), pre-gutter: false, stop-before-row-gutter: false,
styles: none,
rightmost_x: 0, rtl: false,
) = {
let start = vline.start
let end = vline.end
let stroke-auto = parse-stroke(stroke)
let stroke = default-if-auto(vline.stroke, stroke)
let stroke = parse-stroke(stroke)
if default-if-auto-or-none(start, 0) == default-if-auto-or-none(end, rows.len()) { return }
if gutter != none and gutter.col != none and ((pre-gutter and vline.gutter-restrict == right) or (not pre-gutter and vline.gutter-restrict == left)) {
return
}
let expand = get-actual-expansion(vline, spanned-tracks-len: rows.len())
let top-expand = default-if-auto-or-none(expand.at(0), 0pt)
let bottom-expand = default-if-auto-or-none(expand.at(1), 0pt)
if default-if-auto(vline.stroke-expand, true) == true {
let largest-stroke = _largest-stroke-among-hlines-at-y.with(hlines: hlines, stroke-auto: stroke-auto, styles: styles)
top-expand += largest-stroke(default-if-auto-or-none(start, 0)) / 2 // close stroke gap to the top
bottom-expand += largest-stroke(default-if-auto-or-none(end, rows.len())) / 2 // close stroke gap to the bottom
}
let x = width-between(start: initial_x, end: vline.x, columns: columns, gutter: gutter, pre-gutter: pre-gutter)
let start_y = height-between(start: initial_y, end: start, rows: rows, gutter: gutter) - top-expand
let end_y = height-between(start: initial_y, end: end, rows: rows, gutter: gutter, pre-gutter: stop-before-row-gutter or vline.stop-pre-gutter == true) + bottom-expand
if end_y - start_y < 0pt {
return // negative length
}
if rtl {
// invert the vertical line's x pos (start from the right instead of from the left)
x = rightmost_x - x
}
let start = (
x,
start_y
)
let end = (
x,
end_y
)
if stroke != auto {
if stroke != none {
line(start: start, end: end, stroke: stroke)
}
} else {
line(start: start, end: end)
}
}
// -- end: drawing
// main functions
// Gets a state variable that holds the page's max x ("width") and max y ("height"),
// considering the left and top margins.
// Requires placing 'get-page-dim-writer(the_returned_state)' on the
// document.
// The id is to differentiate the state for each table.
#let get-page-dim-state(id) = state("tablex_tablex_page_dims__" + repr(id), (width: 0pt, height: 0pt, top_left: none, bottom_right: none))
// A little trick to get the page max width and max height.
// Places a component on the page (or outer container)'s top left,
// and one on the page's bottom right, and subtracts their coordinates.
//
// Must be fed a state variable, which is updated with (width: max x, height: max y).
// The content it returns must be placed in the document for the page state to be
// written to.
//
// NOTE: This function cannot differentiate between the actual page
// and a possible box or block where the component using this function
// could be contained in.
#let get-page-dim-writer() = locate(w_loc => {
let table_id = _tablex-table-counter.at(w_loc)
let page_dim_state = get-page-dim-state(table_id)
place(top + left, locate(loc => {
page_dim_state.update(s => {
if s.top_left != none {
s
} else {
let pos = loc.position()
let width = s.width - pos.x
let height = s.width - pos.y
(width: width, height: height, top_left: pos, bottom_right: s.bottom_right)
}
})
}))
place(bottom + right, locate(loc => {
page_dim_state.update(s => {
if s.bottom_right != none {
s
} else {
let pos = loc.position()
let width = s.width + pos.x
let height = s.width + pos.y
(width: width, height: height, top_left: s.top_left, bottom_right: pos)
}
})
}))
})
// Draws a row group using locate() and a block().
#let draw-row-group(
row-group,
is-header: false,
header-pages-state: none,
first-row-group: none,
columns: none, rows: none,
stroke: none,
gutter: none,
repeat-header: false,
styles: none,
min-pos: none,
max-pos: none,
header-hlines-have-priority: true,
rtl: false,
table-loc: none,
total-width: none,
global-hlines: (),
global-vlines: (),
) = {
let width-between = width-between.with(columns: columns, gutter: gutter)
let height-between = height-between.with(rows: rows, gutter: gutter)
let draw-hline = draw-hline.with(columns: columns, rows: rows, stroke: stroke, gutter: gutter, vlines: global-vlines, styles: styles)
let draw-vline = draw-vline.with(columns: columns, rows: rows, stroke: stroke, gutter: gutter, hlines: global-hlines, styles: styles)
let group-rows = row-group.rows
let hlines = row-group.hlines
let vlines = row-group.vlines
let (start-y, end-y) = row-group.y_span
locate(loc => {
// let old_page = latest-page-state.at(loc)
// let this_page = loc.page()
// let page_turned = not is-header and old_page not in (this_page, -1)
let pos = loc.position()
let page = pos.page
let rel_page = page - table-loc.page() + 1
let at_top = pos.y == min-pos.y // to guard against re-draw issues
let header_pages = header-pages-state.at(loc)
let header_count = header_pages.len()
let page_turned = page not in header_pages
// draw row group
block(
breakable: false,
fill: none, radius: 0pt, stroke: none,
{
let added_header_height = 0pt // if we added a header, move down
// page turned => add header
if page_turned and at_top and not is-header {
if repeat-header != false {
header-pages-state.update(l => l + (page,))
if (repeat-header == true) or (type(repeat-header) == _int-type and rel_page <= repeat-header) or (type(repeat-header) == _array-type and rel_page in repeat-header) {
let measures = measure(first-row-group.content, styles)
place(top+left, first-row-group.content) // add header
added_header_height = measures.height
}
}
}
let row_gutter_dy = default-if-none(gutter.row, 0pt)
let first_x = none
let first_y = none
let rightmost_x = none
let row_heights = array-sum(rows.slice(start-y, end-y + 1), zero: 0pt)
let first_row = true
for row in group-rows {
for cell_box in row {
let x = cell_box.cell.x
let y = cell_box.cell.y
first_x = default-if-none(first_x, x)
first_y = default-if-none(first_y, y)
rightmost_x = default-if-none(rightmost_x, width-between(start: first_x, end: none))
// where to place the cell (horizontally)
let dx = width-between(start: first_x, end: x)
// TODO: consider implementing RTL before the rendering
// stage (perhaps by inverting 'x' positions on cells
// and lines beforehand).
if rtl {
// invert cell's x position (start from the right)
dx = rightmost_x - dx
// assume the cell doesn't start at the very end
// (that would be weird)
// Here we have to move dx back a bit as, after
// inverting it, it'd be the right edge of the cell;
// we need to keep it as the left edge's x position,
// as #place works with the cell's left edge.
// To do that, we subtract the cell's width from dx.
dx -= width-between(start: x, end: x + cell_box.cell.colspan)
}
// place the cell!
place(top+left,
dx: dx,
dy: height-between(start: first_y, end: y) + added_header_height,
cell_box.box)
// let box_h = measure(cell_box.box, styles).height
// tallest_box_h = calc.max(tallest_box_h, box_h)
}
first_row = false
}
let row_group_height = row_heights + added_header_height + (row_gutter_dy * group-rows.len())
let is_last_row = not is-infinite-len(max-pos.y) and pos.y + row_group_height + row_gutter_dy >= max-pos.y
if is_last_row {
row_group_height -= row_gutter_dy
// one less gutter at the end
}
hide(rect(width: total-width, height: row_group_height))
let draw-hline = draw-hline.with(initial_x: first_x, initial_y: first_y, rightmost_x: rightmost_x, rtl: rtl)
let draw-vline = draw-vline.with(initial_x: first_x, initial_y: first_y, rightmost_x: rightmost_x, rtl: rtl)
// ensure the lines are drawn absolutely, after the header
let draw-hline = (..args) => place(top + left, dy: added_header_height, draw-hline(..args))
let draw-vline = (..args) => place(top + left, dy: added_header_height, draw-vline(..args))
let header_last_y = if first-row-group != none {
first-row-group.row_group.y_span.at(1)
} else {
none
}
// if this is the second row, and the header's hlines
// do not have priority (thus are not drawn by them,
// otherwise they'd repeat on every page), then
// we draw its hlines for the header, below it.
let hlines = if not header-hlines-have-priority and not is-header and start-y == header_last_y + 1 {
let hlines_below_header = first-row-group.row_group.hlines.filter(h => h.y == header_last_y + 1)
hlines + hlines_below_header
} else {
hlines
}
for hline in hlines {
// only draw the top hline
// if header's wasn't already drawn
if hline.y == start-y {
let header_last_y = if first-row-group != none {
first-row-group.row_group.y_span.at(1)
} else {
none
}
// pre-gutter is always false here, as we assume
// hlines at the top of this row are handled
// at pre-gutter by the preceding row,
// and at post-gutter by this (the following) row.
// these if's are to check if we should indeed
// draw this hline, or if the previous row /
// the header should take care of it.
if not header-hlines-have-priority and not is-header and start-y == header_last_y + 1 {
// second row (after header, and it has no hline priority).
draw-hline(hline, pre-gutter: false)
} else if hline.y == 0 {
// hline at the very top of the table.
draw-hline(hline, pre-gutter: false)
} else if not page_turned and gutter.row != none and hline.gutter-restrict != top {
// this hline, at the top of this row group,
// isn't restricted to a pre-gutter position,
// so let's draw it right above us.
// The page turn check is important:
// the hline should not be drawn if the header
// was repeated and its own hlines have
// priority.
draw-hline(hline, pre-gutter: false)
} else if page_turned and (added_header_height == 0pt or not header-hlines-have-priority) {
draw-hline(hline, pre-gutter: false)
// no header repeated, but still at the top of the current page
}
} else {
if hline.y == end-y + 1 and (
(is-header and not header-hlines-have-priority)
or (gutter.row != none and hline.gutter-restrict == bottom)) {
// this hline is after all cells
// in the row group, and either
// this is the header and its hlines
// don't have priority (=> the row
// groups below it - if repeated -
// should draw the hlines above them),
// or the hline is restricted to
// post-gutter => let the next
// row group draw it.
continue
}
// normally, only draw the bottom hlines
// (and both their pre-gutter and
// post-gutter variations)
draw-hline(hline, pre-gutter: true)
// don't draw the post-row gutter hline
// if this is the last row in the page,
// the last row in the row group
// (=> the next row group will
// place the hline above it, so that
// lines break properly between pages),
// or the last row in the whole table.
if gutter.row != none and hline.y < rows.len() and hline.y < end-y + 1 and not is_last_row {
draw-hline(hline, pre-gutter: false)
}
}
}
for vline in vlines {
draw-vline(vline, pre-gutter: true, stop-before-row-gutter: is_last_row)
// don't draw the post-col gutter vline
// if this is the last vline
if gutter.col != none and vline.x < columns.len() {
draw-vline(vline, pre-gutter: false, stop-before-row-gutter: is_last_row)
}
}
})
})
}
// Generates groups of rows.
// By default, 1 row + rows from its rowspan cells = 1 row group.
// The first row group is the header, which is repeated across pages.
#let generate-row-groups(
grid: none,
columns: none, rows: none,
stroke: none, inset: none,
gutter: none,
fill: none,
align: none,
hlines: none, vlines: none,
repeat-header: false,
styles: none,
header-hlines-have-priority: true,
min-pos: none,
max-pos: none,
header-rows: 1,
rtl: false,
table-loc: none,
table-id: none,
) = {
let col_len = columns.len()
let row_len = rows.len()
// specialize some functions for the given grid, columns and rows
let v-and-hline-spans-for-cell = v-and-hline-spans-for-cell.with(vlines: vlines, x_limit: col_len, y_limit: row_len, grid: grid)
let cell-width = cell-width.with(columns: columns, gutter: gutter)
let cell-height = cell-height.with(rows: rows, gutter: gutter)
let width-between = width-between.with(columns: columns, gutter: gutter)
let height-between = height-between.with(rows: rows, gutter: gutter)
// each row group is an unbreakable unit of rows.
// In general, they're just one row. However, they can be multiple rows
// if one of their cells spans multiple rows.
let first_row_group = none
let header_pages = state("tablex_tablex_header_pages__" + repr(table-id), (table-loc.page(),))
let this_row_group = (rows: ((),), hlines: (), vlines: (), y_span: (0, 0))
let total_width = width-between(end: none)
let row_group_add_counter = 1 // how many more rows are going to be added to the latest row group
let current_row = 0
let header_rows_count = calc.min(row_len, header-rows)
for row in range(0, row_len) {
// maximum cell total rowspan in this row
let max_rowspan = 0
for column in range(0, col_len) {
let cell = grid-at(grid, column, row)
let lines_dict = v-and-hline-spans-for-cell(cell, hlines: hlines)
let hlines = lines_dict.hlines
let vlines = lines_dict.vlines
if is-tablex-cell(cell) {
// ensure row-spanned rows are in the same group
row_group_add_counter = calc.max(row_group_add_counter, cell.rowspan)
let width = cell-width(cell.x, colspan: cell.colspan)
let height = cell-height(cell.y, rowspan: cell.rowspan)
let cell_box = make-cell-box(
cell,
width: width, height: height, inset: inset,
align_default: align,
fill_default: fill)
this_row_group.rows.last().push((cell: cell, box: cell_box))
let hlines = hlines
.filter(h =>
this_row_group.hlines
.filter(is-same-hline.with(h))
.len() == 0)
let vlines = vlines
.filter(v => v not in this_row_group.vlines)
this_row_group.hlines += hlines
this_row_group.vlines += vlines
}
}
current_row += 1
row_group_add_counter = calc.max(0, row_group_add_counter - 1) // one row added
header_rows_count = calc.max(0, header_rows_count - 1) // ensure at least the amount of requested header rows was added
// added all pertaining rows to the group
// now we can draw it
if row_group_add_counter <= 0 and header_rows_count <= 0 {
row_group_add_counter = 1
let row-group = this_row_group
// get where the row starts and where it ends
let (start_y, end_y) = row-group.y_span
let next_y = end_y + 1
this_row_group = (rows: ((),), hlines: (), vlines: (), y_span: (next_y, next_y))
let is_header = first_row_group == none
let content = draw-row-group(
row-group,
is-header: is_header,
header-pages-state: header_pages,
first-row-group: first_row_group,
columns: columns, rows: rows,
stroke: stroke,
gutter: gutter,
repeat-header: repeat-header,
total-width: total_width,
table-loc: table-loc,
header-hlines-have-priority: header-hlines-have-priority,
rtl: rtl,
min-pos: min-pos,
max-pos: max-pos,
styles: styles,
global-hlines: hlines,
global-vlines: vlines,
)
if is_header { // this is now the header group.
first_row_group = (row_group: row-group, content: content) // 'content' to repeat later
}
(content,)
} else {
this_row_group.rows.push(())
this_row_group.y_span.at(1) += 1
}
}
}
// -- end: main functions
// option parsing functions
#let _parse-lines(
hlines, vlines,
page-width: none, page-height: none,
styles: none
) = {
let parse-func(line, page-size: none) = {
line.stroke-expand = line.stroke-expand == true
line.expand = default-if-auto(line.expand, none)
if type(line.expand) != _array-type and line.expand != none {
line.expand = (line.expand, line.expand)
}
line.expand = if line.expand == none {
none
} else {
line.expand.slice(0, 2).map(e => {
if e == none {
e
} else {
e = default-if-auto(e, 0pt)
if type(e) not in (_length-type, _rel-len-type, _ratio-type) {
panic("'expand' argument to lines must be a pair (length, length).")
}
convert-length-to-pt(e, styles: styles, page-size: page-size)
}
})
}
line
}
(
hlines: hlines.map(parse-func.with(page-size: page-width)),
vlines: vlines.map(parse-func.with(page-size: page-height))
)
}
// Parses 'auto-lines', generating the corresponding lists of
// new hlines and vlines
#let generate-autolines(auto-lines: false, auto-hlines: auto, auto-vlines: auto, hlines: none, vlines: none, col_len: none, row_len: none) = {
let auto-hlines = default-if-auto(auto-hlines, auto-lines)
let auto-vlines = default-if-auto(auto-vlines, auto-lines)
let new_hlines = ()
let new_vlines = ()
if auto-hlines {
new_hlines = range(0, row_len + 1)
.filter(y => hlines.filter(h => h.y == y).len() == 0)
.map(y => hlinex(y: y))
}
if auto-vlines {
new_vlines = range(0, col_len + 1)
.filter(x => vlines.filter(v => v.x == x).len() == 0)
.map(x => vlinex(x: x))
}
(new_hlines: new_hlines, new_vlines: new_vlines)
}
#let parse-gutters(col-gutter: auto, row-gutter: auto, gutter: auto, styles: none, page-width: 0pt, page-height: 0pt) = {
col-gutter = default-if-auto(col-gutter, gutter)
row-gutter = default-if-auto(row-gutter, gutter)
col-gutter = default-if-auto(col-gutter, 0pt)
row-gutter = default-if-auto(row-gutter, 0pt)
if type(col-gutter) in (_length-type, _rel-len-type, _ratio-type) {
col-gutter = convert-length-to-pt(col-gutter, styles: styles, page-size: page-width)
}
if type(row-gutter) in (_length-type, _rel-len-type, _ratio-type) {
row-gutter = convert-length-to-pt(row-gutter, styles: styles, page-size: page-width)
}
(col: col-gutter, row: row-gutter)
}
// Accepts a map-X param, and verifies whether it's a function or none/auto.
#let validate-map-func(map-func) = {
if map-func not in (none, auto) and type(map-func) != _function-type {
panic("Tablex error: Map parameters, if specified (not 'none'), must be functions.")
}
map-func
}
#let apply-maps(
grid: (),
hlines: (),
vlines: (),
map-hlines: none,
map-vlines: none,
map-rows: none,
map-cols: none,
) = {
if type(map-vlines) == _function-type {
vlines = vlines.map(vline => {
let vline = map-vlines(vline)
if not is-tablex-vline(vline) {
panic("'map-vlines' function returned a non-vline.")
}
vline
})
}
if type(map-hlines) == _function-type {
hlines = hlines.map(hline => {
let hline = map-hlines(hline)
if not is-tablex-hline(hline) {
panic("'map-hlines' function returned a non-hline.")
}
hline
})
}
let should-map-rows = type(map-rows) == _function-type
let should-map-cols = type(map-cols) == _function-type
if not should-map-rows and not should-map-cols {
return (grid: grid, hlines: hlines, vlines: vlines)
}
let col-len = grid.width
let row-len = grid-count-rows(grid)
if should-map-rows {
for row in range(row-len) {
let original-cells = grid-get-row(grid, row)
// occupied cells = none for the outer user
let cells = map-rows(row, original-cells.map(c => {
if is-tablex-occupied(c) { none } else { c }
}))
if type(cells) != _array-type {
panic("Tablex error: 'map-rows' returned something that isn't an array.")
}
if cells.len() != original-cells.len() {
panic("Tablex error: 'map-rows' returned " + str(cells.len()) + " cells, when it should have returned exactly " + str(original-cells.len()) + ".")
}
for (i, cell) in cells.enumerate() {
let orig-cell = original-cells.at(i)
if not is-tablex-cell(orig-cell) {
// only modify non-occupied cells
continue
}
if not is-tablex-cell(cell) {
panic("Tablex error: 'map-rows' returned a non-cell.")
}
let x = cell.x
let y = cell.y
if type(x) != _int-type or type(y) != _int-type or x < 0 or y < 0 or x >= col-len or y >= row-len {
panic("Tablex error: 'map-rows' returned a cell with invalid coordinates.")
}
if y != row {
panic("Tablex error: 'map-rows' returned a cell in a different row (the 'y' must be kept the same).")
}
if cell.colspan != orig-cell.colspan or cell.rowspan != orig-cell.rowspan {
panic("Tablex error: Please do not change the colspan or rowspan of a cell in 'map-rows'.")
}
cell.content = [#cell.content]
grid.items.at(grid-index-at(cell.x, cell.y, grid: grid)) = cell
}
}
}
if should-map-cols {
for column in range(col-len) {
let original-cells = grid-get-column(grid, column)
// occupied cells = none for the outer user
let cells = map-cols(column, original-cells.map(c => {
if is-tablex-occupied(c) { none } else { c }
}))
if type(cells) != _array-type {
panic("Tablex error: 'map-cols' returned something that isn't an array.")
}
if cells.len() != original-cells.len() {
panic("Tablex error: 'map-cols' returned " + str(cells.len()) + " cells, when it should have returned exactly " + str(original-cells.len()) + ".")
}
for (i, cell) in cells.enumerate() {
let orig-cell = original-cells.at(i)
if not is-tablex-cell(orig-cell) {
// only modify non-occupied cells
continue
}
if not is-tablex-cell(cell) {
panic("Tablex error: 'map-cols' returned a non-cell.")
}
let x = cell.x
let y = cell.y
if type(x) != _int-type or type(y) != _int-type or x < 0 or y < 0 or x >= col-len or y >= row-len {
panic("Tablex error: 'map-cols' returned a cell with invalid coordinates.")
}
if x != column {
panic("Tablex error: 'map-cols' returned a cell in a different column (the 'x' must be kept the same).")
}
if cell.colspan != orig-cell.colspan or cell.rowspan != orig-cell.rowspan {
panic("Tablex error: Please do not change the colspan or rowspan of a cell in 'map-cols'.")
}
cell.content = [#cell.content]
grid.items.at(grid-index-at(cell.x, cell.y, grid: grid)) = cell
}
}
}
(grid: grid, hlines: hlines, vlines: vlines)
}
#let validate-header-rows(header-rows) = {
header-rows = default-if-auto(default-if-none(header-rows, 0), 1)
if type(header-rows) != _int-type or header-rows < 0 {
panic("Tablex error: 'header-rows' must be a (positive) integer.")
}
header-rows
}
#let validate-repeat-header(repeat-header, header-rows: none) = {
if header-rows == none or header-rows < 0 {
return false // cannot repeat an empty header
}
repeat-header = default-if-auto(default-if-none(repeat-header, false), false)
if type(repeat-header) not in (_bool-type, _int-type, _array-type) {
panic("Tablex error: 'repeat-header' must be a boolean (true - always repeat the header, false - never), an integer (amount of pages for which to repeat the header), or an array of integers (relative pages in which the header should repeat).")
} else if type(repeat-header) == _array-type and repeat-header.any(i => type(i) != _int-type) {
panic("Tablex error: 'repeat-header' cannot be an array of anything other than integers!")
}
repeat-header
}
#let validate-header-hlines-priority(
header-hlines-have-priority
) = {
header-hlines-have-priority = default-if-auto(default-if-none(header-hlines-have-priority, true), true)
if type(header-hlines-have-priority) != _bool-type {
panic("Tablex error: 'header-hlines-have-priority' option must be a boolean.")
}
header-hlines-have-priority
}
// 'validate-fit-spans' is needed by grid, and is thus in the common section
// -- end: option parsing
// Creates a table.
//
// OPTIONS:
// columns: table column sizes (array of sizes,
// or a single size for 1 column)
//
// rows: row sizes (same format as columns)
//
// align: how to align cells (alignment, array of alignments
// (one for each column), or a function
// (col, row) => alignment)
//
// items: The table items, as specified by the columns
// and rows. Can also be cellx, hlinex and vlinex objects.
//
// fill: how to fill cells (color/none, array of colors
// (one for each column), or a function (col, row) => color)
//
// stroke: how to draw the table lines (stroke)
// column-gutter: optional separation (length) between columns
// row-gutter: optional separation (length) between rows
// gutter: quickly apply a length to both column- and row-gutter
//
// repeat-header: true = repeat the first row (or rowspan)
// on all pages; integer = repeat for the first n pages;
// array of integers = repeat on exactly those pages
// (where 1 is the first, so ignored); false = do not repeat
// the first row group (default).
//
// header-rows: minimum amount of rows for the repeatable
// header. 1 by default. Automatically increases if
// one of the cells is a rowspan that would go beyond the
// given amount of rows. For example, if 3 is given,
// then at least the first 3 rows will repeat.
//
// header-hlines-have-priority: if true, the horizontal
// lines below the header being repeated take priority
// over the rows they appear atop of on further pages.
// If false, they draw their own horizontal lines.
// Defaults to true.
//
// rtl: if true, the table is horizontally flipped.
// That is, cells and lines are placed in the opposite order
// (starting from the right), and horizontal lines are flipped.
// This is meant to simulate the behavior of default Typst tables when
// 'set text(dir: rtl)' is used, and is useful when writing in a language
// with a RTL (right-to-left) script.
// Defaults to false.
//
// auto-lines: true = applies true to both auto-hlines and
// auto-vlines; false = applies false to both.
// Their values override this one unless they are 'auto'.
//
// auto-hlines: true = draw a horizontal line on every line
// without a manual horizontal line specified; false = do
// not draw any horizontal line without manual specification.
// Defaults to 'auto' (follows 'auto-lines').
//
// auto-vlines: true = draw a vertical line on every column
// without a manual vertical line specified; false = requires
// manual specification. Defaults to 'auto' (follows
// 'auto-lines')
//
// map-cells: Takes a cellx and returns another cellx (or
// content).
//
// map-hlines: Takes each horizontal line (hlinex) and
// returns another.
//
// map-vlines: Takes each vertical line (vlinex) and
// returns another.
//
// map-rows: Maps each row of cells.
// Takes (row_num, cell_array) and returns
// the modified cell_array. Note that, here, they
// cannot be sent to another row. Also, cells may be
// 'none' if they're a position taken by a cell in a
// colspan/rowspan.
//
// map-cols: Maps each column of cells.
// Takes (col_num, cell_array) and returns
// the modified cell_array. Note that, here, they
// cannot be sent to another row. Also, cells may be
// 'none' if they're a position taken by a cell in a
// colspan/rowspan.
//
// fit-spans: Determine if rowspans and colspans should fit within their
// spanned 'auto'-sized tracks (columns and rows) instead of causing them to
// expand based on the rowspan/colspan cell's size. (Most users of tablex
// shouldn't have to change this option.)
// Must either be a dictionary '(x: true/false, y: true/false)' or a boolean
// true/false (which is converted to the (x: value, y: value) format with both
// 'x' and 'y' being set to the same value; for instance, 'true' becomes
// '(x: true, y: true)').
// Setting 'x' to 'false' (the default) means that colspans will cause the last
// (rightmost) auto column they span to expand if the cell's contents are too
// long; setting 'x' to 'true' negates this, and auto columns will ignore the
// size of colspans. Similarly, setting 'y' to 'false' (the default) means that
// rowspans will cause the last (bottommost) auto row they span to expand if
// the cell's contents are too tall; setting 'y' to 'true' causes auto rows to
// ignore the size of rowspans.
// This setting is mostly useful when you have a colspan or a rowspan spanning
// tracks with fractional (1fr, 2fr, ...) size, which can cause the fractional
// track to have less or even zero size, compromising all other cells in it.
// If you're facing this problem, you may want experiment with setting this
// option to '(x: true)' (if this is affecting columns) or 'true' (for rows
// too, same as '(x: true, y: true)').
// Note that this option can also be set in a per-cell basis through cellx().
// See its reference for more information.
#let tablex(
columns: auto, rows: auto,
inset: 5pt,
align: auto,
fill: none,
stroke: auto,
column-gutter: auto, row-gutter: auto,
gutter: none,
repeat-header: false,
header-rows: 1,
header-hlines-have-priority: true,
rtl: false,
auto-lines: true,
auto-hlines: auto,
auto-vlines: auto,
map-cells: none,
map-hlines: none,
map-vlines: none,
map-rows: none,
map-cols: none,
fit-spans: false,
..items
) = {
_tablex-table-counter.step()
get-page-dim-writer() // get the current page's dimensions
let header-rows = validate-header-rows(header-rows)
let repeat-header = validate-repeat-header(repeat-header, header-rows: header-rows)
let header-hlines-have-priority = validate-header-hlines-priority(header-hlines-have-priority)
let map-cells = validate-map-func(map-cells)
let map-hlines = validate-map-func(map-hlines)
let map-vlines = validate-map-func(map-vlines)
let map-rows = validate-map-func(map-rows)
let map-cols = validate-map-func(map-cols)
let fit-spans = validate-fit-spans(fit-spans, default: (x: false, y: false))
layout(size => locate(t_loc => style(styles => {
let table_id = _tablex-table-counter.at(t_loc)
let page_dimensions = get-page-dim-state(table_id)
let page_dim_at = page_dimensions.final(t_loc)
let t_pos = t_loc.position()
// Subtract the max width/height from current width/height to disregard margin/etc.
let page_width = size.width
let page_height = size.height
let max_pos = default-if-none(page_dim_at.bottom_right, (x: t_pos.x + page_width, y: t_pos.y + page_height))
let min_pos = default-if-none(page_dim_at.top_left, t_pos)
let items = items.pos().map(table-item-convert)
let gutter = parse-gutters(
col-gutter: column-gutter, row-gutter: row-gutter,
gutter: gutter,
styles: styles,
page-width: page_width, page-height: page_height
)
let validated_cols_rows = validate-cols-rows(
columns, rows, items: items.filter(is-tablex-cell))
let columns = validated_cols_rows.columns
let rows = validated_cols_rows.rows
items += validated_cols_rows.items
let col_len = columns.len()
let row_len = rows.len()
// generate cell matrix and other things
let grid_info = generate-grid(
items,
x_limit: col_len, y_limit: row_len,
map-cells: map-cells,
fit-spans: fit-spans
)
let table_grid = grid_info.grid
let hlines = grid_info.hlines
let vlines = grid_info.vlines
let items = grid_info.items
// When there are more rows than the user specified, we ensure they have
// the same size as the last specified row.
let last-row-size = if rows.len() == 0 { auto } else { rows.last() }
for _ in range(grid_info.new_row_count - row_len) {
rows.push(last-row-size) // add new rows (due to extra cells)
}
let col_len = columns.len()
let row_len = rows.len()
let auto_lines_res = generate-autolines(
auto-lines: auto-lines, auto-hlines: auto-hlines,
auto-vlines: auto-vlines,
hlines: hlines,
vlines: vlines,
col_len: col_len,
row_len: row_len
)
hlines += auto_lines_res.new_hlines
vlines += auto_lines_res.new_vlines
let parsed_lines = _parse-lines(hlines, vlines, styles: styles, page-width: page_width, page-height: page_height)
hlines = parsed_lines.hlines
vlines = parsed_lines.vlines
let mapped_grid = apply-maps(
grid: table_grid,
hlines: hlines,
vlines: vlines,
map-hlines: map-hlines,
map-vlines: map-vlines,
map-rows: map-rows,
map-cols: map-cols
)
table_grid = mapped_grid.grid
hlines = mapped_grid.hlines
vlines = mapped_grid.vlines
// re-parse just in case
let parsed_lines = _parse-lines(hlines, vlines, styles: styles, page-width: page_width, page-height: page_height)
hlines = parsed_lines.hlines
vlines = parsed_lines.vlines
// convert auto to actual size
let updated_cols_rows = determine-auto-column-row-sizes(
grid: table_grid,
page_width: page_width, page_height: page_height,
styles: styles,
columns: columns, rows: rows,
inset: inset, align: align,
gutter: gutter,
fit-spans: fit-spans
)
let columns = updated_cols_rows.columns
let rows = updated_cols_rows.rows
let gutter = updated_cols_rows.gutter
let row_groups = generate-row-groups(
grid: table_grid,
columns: columns, rows: rows,
stroke: stroke, inset: inset,
gutter: gutter,
fill: fill, align: align,
hlines: hlines, vlines: vlines,
styles: styles,
repeat-header: repeat-header,
header-hlines-have-priority: header-hlines-have-priority,
header-rows: header-rows,
rtl: rtl,
min-pos: min_pos,
max-pos: max_pos,
table-loc: t_loc,
table-id: table_id
)
grid(columns: (auto,), rows: auto, ..row_groups)
})))
}
// Same as table but defaults to lines off
#let gridx(..options) = {
tablex(auto-lines: false, ..options)
}
|
https://github.com/piepert/logik-tutorium-wise2024-2025 | https://raw.githubusercontent.com/piepert/logik-tutorium-wise2024-2025/main/src/templates/exams.typ | typst | Creative Commons Zero v1.0 Universal | #import "@preview/grape-suite:1.0.0": exercise
#import exercise: *
#let project = project.with(
no: 1,
type: [LEV],
suffix-title: [Logische Grundlagen],
university: [Universität Rostock],
institute: [Institur für Philosophie],
seminar: [Tutorium: Sprache, Logik, Argumentation],
show-point-distribution-in-tasks: true,
show-namefield: true,
show-timefield: true,
max-time: 25,
show-solutions: true,
show-lines: true,
solutions-as-matrix: true
) |
https://github.com/soul667/typst | https://raw.githubusercontent.com/soul667/typst/main/PPT/MATLAB/研讨 copy.typ | typst | #import "touying/lib.typ": *
#import "template.typ": *
#import "todo.typ": *
#import "@preview/algorithmic:0.1.0"
#import algorithmic: algorithm
#import "notes.typ"
#let s = themes.simple.register(s, aspect-ratio: "16-9", footer: [Harbin Engineering University])
#let s = (s.methods.enable-transparent-cover)(self: s)
#let (init, slide, slides, title-slide, centered-slide, focus-slide,touying-outline) = utils.methods(s)
#show: init
#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: ""
)
}
#let themeColor = rgb(46, 49, 124)
#let head_main=info(
color: black,
(
icon: "1024px-Buckminsterfullerene-3D-balls.png",
content:"M 大作业研讨",
content1:"研讨"
)
)
// #align(left+top,image("icon/校标.png",width: 15em))
#slide[
#v(-1.3em)
// #h(1em)
#align(top+right,image("icon/校标.png",width: 10em))
#align(center+horizon, text(size: 35pt)[
#head_main
])
#v(0.5em)
#align(center,[
#for c in data.成员 [
#text(font: "FangSong",size: 0.75em)[#c
#h(0.6em)
]
]
#v(-0.7em)
// #h(-6.8em)
#for c in data.成员1 [
// #h(3.4em)
#text(font: "FangSong",size: 0.75em)[#c
#h(0.6em)
]
]
]
)
]
#set heading(numbering: "1.")
#set text(font:("Times New Roman","Source Han Serif"),size: 0.76em,spacing: 0.3em,weight: "extralight")
#show heading.where(level: 2):set text(themeColor, 0.9em,font: "Microsoft YaHei")
#show heading.where(level: 3):set text(themeColor, 0.8em,font: "Microsoft YaHei")
// #show strong:set text(font: "HYCuFangSongJ")
// #show footnote:set text(themeColor, 0.9em,font: "Microsoft YaHei")
// 小标题样式
#show heading.where(level: 1):set text(themeColor, 1.5em,font:("Times New Roman","Microsoft YaHei"))
#set par(justify: true,first-line-indent: 2em) // 两端对齐,段前缩进2字符
// #set footnote(numbering: "*")
// 二级标题下加一条横线
#show heading.where(level: 2): it => stack(
v(-1.1em),
align(top+right,image("icon/校标.png",width: 8em)),
// v(-1.1em),
// str(type( locate(loc => query(heading.where(level: 1), loc)))),
// str(type((1,2,3,4,5))),
// align(center,
// rect(fill: themeColor)[
// #for c in ("背景及意义","项目概述") [
// #text(fill:white,font: "Microsoft YaHei")[#c]
// ]
// ]
// )
// ,
// header_rect(),
align(center,[]),
v(-1em),
v(0.1em),
it,
v(0.6em),
// line(length: 100%, stroke: 0.05em + themeColor),
line(length: 100%,stroke: (paint: themeColor, thickness: 0.06em)),
v(0.8em),
)
// #set heading.where(level: 3)(numbering: "1.");
// #show heading.where(level: 3):set heading(numbering: "1.")
#show heading.where(level: 3): it => stack(
v(-0.0em),
it,
v(0.6em),
// line(length: 100%, stroke: 0.05em + themeColor),
line(length: it.body.text.len()*0.25em+2.8em,stroke: (paint: themeColor, thickness: 0.06em, dash: "dashed")),
v(0.1em),
)
// #centered-slide()
// = 111
#show heading: it => {
it
v(-0.8cm)
par()[#text()[#h(0.0em)]]
}
// #show centered-slide : it=>{
// it
// }
#centered-slide(section: [简介],[])
// #set
// #show footnote.entry: it => {
// let loc = it.note.location()
// numbering(
// "1: ",
// ..counter(footnote).at(loc),
// )
// it.note.body
// }
#slide[
// 用typst的语法介绍一下纳米材料的历史以及他在光电传感器中的应用的历史
== #box(
baseline: 0.135em,
height: 1.0em,
width: 1.0em,
image(data.icon.文件夹+"/1024px-Buckminsterfullerene-3D-balls.png")
)纳米技术
#v(-2em)
=== 自然界中的纳米材料
纳米技术的历史可以追溯到古代。早期的纳米材料使用可以在公元前600年至300年的#notes.note[印度陶器][Keeladi陶器]中找到,其中包含碳纳米管,尽管人们不知道它们是如何形成的。此外,大约公元900年的大马士革钢中也观察到了渗碳体纳米线。
一千年以前,我国古代的人们收集
蜡烛燃烧后产生的炭黑作为原料,
制作墨或黑色染料。我国古代的铜镜表面长久不发生锈钝,经检验发现其表面有
层纳米氧化锡颗粒构成的薄膜.
#v(3.2em)
#notes.display() // Endnotes
#v(10em)
=== 纳米技术的现代发展
- 诺贝尔奖获得者 *理查德·费曼* (<NAME>) 在1959年的一次演讲上@feiman1959 提出了纳米技术的概念 ,他预见了在原子级别操纵物质的可能性。
- 1962年,日本科学家Kubo(久保)建立了与尺寸有关的Kubo理论
- *诺里奥·谷口* (<NAME>i) 在1974年首次使用了“纳米技术”这个词。
- *<NAME>* 在1986年的著作《创造之引擎》中进一步推广了纳米技术的概念。
- 1981年扫描隧道显微镜的发明对纳米科技的发展起到了积极的促进作用。
#v(6.3em)
]
#slide[
== #box(
baseline: 0.135em,
height: 1.0em,
width: 1.0em,
image(data.icon.文件夹+"/1024px-Buckminsterfullerene-3D-balls.png")
)纳米材料与工业
#v(-1.5cm)
=== 纳米材料的性质
#notes.note[纳米材料][【纳米材料的定义】欧盟委员会则将纳米材料定义为一种由基本颗粒组成的材料,这一颗粒在1纳米至100纳米之间,并且占所有颗粒总数中占50%以上]
由于独特的#notes.note[*小尺寸效应*][【小尺寸效应】
小尺寸效应是指纳米材料的性质与宏观材料的性质存在差异的现象。这是由于当颗粒的尺寸与光波波长、德布罗意波长以及超导态的
相干长度等物理特征尺寸相当或更小时,晶体周期性的边
界条件将被破坏,非晶态纳米粒子的颗粒表面层附近的原
子密度减少,导致声、光、电、磁、热、力学等特性发生
显著变化,称为小尺寸效应],#notes.note[*量子效应*][【量子效应】当粒子尺寸下降到某一值时,金属费米能级附近的电子能级由准连续变为离散能级的
现象;纳米半导体微粒存在不连续的最高被占据分子轨道和最低未被占据的分子轨道能
级,能隙变宽现象均称为量子尺寸效应。],#notes.note[*介电限域效应*][【介电限域效应】介电限域效应是纳米微粒分散在异质介质中由于界面引起的体系介电增强的现象,
主要来源于微粒表面和内部局域场强的增强。例如,当介质的折射率对比微粒的折
射率相差很大时,就产生了折射率边界,这就导致微粒表面和内部的场强比入射场
强明显增加,这种局域场强的增强称为介电限域]以及#notes.note[*宏观量子隧道效应*][【宏观量子隧道效应】当微观粒子的总能量小于势垒高度时
,该粒子仍能穿越这一势垒。近年来,人们发现一些宏观量,例如微颗粒的磁化强度,
量子相干器件中的磁通量等亦有隧道效应,称为宏观的量子隧道效应]等使得材料
#notes.note[展现出独特的物理和化学性质][
- 【光学性质】 所有的金属在超微颗粒状态都呈现为黑色。尺寸越小,颜色愈黑,与常规大块材料相比,纳米微晶的吸收和发射光谱存在着蓝移现象,即移向短波方向。
- 【热学性质】 当材料的尺寸降低到一定程度后,材料的弹性和热力学参数将发生显著变化,原有的平衡相的关系被打破。
- 【磁学性质】小尺寸磁性与大块材料显著的不同。
- 【力学性质】 陶瓷材料在通常情况下呈脆性,然而由纳米超微颗粒压制成的纳米陶瓷材料却具有良好的韧性;美国学者报道氟化钙纳米材料在室温下可以大幅度弯曲而不断裂;金属/陶瓷等复合纳米材料可在更大的范围内改变材料的力学性质
]这些性质与宏观材料截然不同。
#notes.display() // Endnotes
]
#slide[
=== 在工业中的应用
纳米尺度的效应导致了电子性质、磁性、机械强度、以及光学特性的显著变化。
在工业领域,这些独特的特性使得纳米材料在多个前沿科技领域中显示出其不可替代的重要性。尤其是在*光电子器件*领域,纳米材料的应用正在引领一场技术革命。@palit2020
*光电子器件*,如发光二极管(LED)、太阳能电池板、激光器和光电探测器等,都在从纳米材料的进步中受益。这些设备中使用的纳米结构材料,比如量子点、纳米线和纳米片,能有效改进设备的性能,通过控制光的吸收和发射,提高能量转换效率和灵敏度。
纳米技术的应用不仅限于改进现有产品的性能,也包括开发全新的功能化设备。例如,通过调整纳米材料的组成和结构,可以精确控制其对光的响应行为,从而在传感器和显示技术等领域开发出新的应用。
此外,纳米材料的小尺寸和高反应性使得它们在信息存储技术中也表现出极大的潜力,如通过使用纳米尺度的磁性材料来提高存储设备的数据密度。
在光电子领域,纳米材料的应用正促使设备更小型化、效率更高、成本更低,同时也推动了新一代光电系统的开发。这些技术的进步不仅对科技产业的发展至关重要,也对能源效率和可持续发展具有深远的影响。
]
// #v(1.3em)
// #notes.display() // Endnotes
// 这种性质的改变,也使其在光电传感器的*设计和制造*方面具有十分广阔的应用前景 ( @1 @2 @palit2020 ) 。
// skowpekodwkepodke @2
// #v(1em)
// 小尺寸效应。量子效应。介电限域效应。宏观量子隧道效应。
#centered-slide(section: [工业应用概览],[ #h(4em)纳米材料的工业应用已经扩展到多个领域,从医疗健康到环保,再到能源和催化。
以下内容将详细展开纳米材料在这些领域中的应用情况,]
)
#slide[
#set rect(
width: auto
)
== 医疗领域
#grid(
columns: (50%,auto),
gutter: 1cm,
[
// #v(-1.0em)
#h(2em) 在医疗领域,纳米材料被用于改进药物输送系统、制造更高效的疗法和诊断工具。
例如,纳米粒子因其能够穿透生物膜而在目标药物输送中显示出独特的优势,可以直接将药物运送到病变部位,减少对健康组织的副作用并提高治疗效果。
此外,纳米材料也被用于构建生物相容性极好的植入物和支架,以及在再生医学中用于组织工程。
],
[
#figure(
align(center,
image("img/1.png",height: 54%)
)
, caption: [使用 400 nm(A、C)和 800 nm(B、D)孔径模板制造的 CHI/LAC(A、B)和 BSA/CAR(C、D)纳米管。]
)
]
// image("tiger.jpg", height: 100%),
// image("tiger.jpg", height: 100%),
)
]
#slide[
#set rect(
width: auto
)
== 环保领域
#v(-1.5em)
在环保领域,纳米技术已经成为*水*和*空气*等污染质净化技术的关键。
#v(-0em)
=== 对于水
#notes.note[水污染][水污染物包括无机污染物(即砷、镉、铬、氟化物、铅和汞)、有机污染物(即丙烯酰胺、苯酚、六氯化苯和四氯化碳)以及不同的有机染料(即刚果红、甲基红)。蓝色和甲基橙)。]导致疾病和死亡,是一个重大的全球性问题。
虽然重金属离子、氟化物等无机污染物在适当浓度下是人体必需的营养物质,但当超过适当浓度时,就会对环境和人体健康造成威胁。
世界卫生组织(WHO)和许多国家已经制定了饮用水中这些无机污染物的最大可接受浓度,如下图所示。
#v(2em)
#notes.display()
#figure(
align(center,
image("img/2.png",height: 44%)
)
, caption: [不同国家饮用水中特定无机污染物的允许限量(mg/L)。]
)
#h(2em) 一些有毒金属离子,如 Hg(II)、Pb(II)、Cr(VI)、Cd(II)、As(III)/(V) 和氟化物 ($F^-$) 是不可生物降解的,会在环境中积聚,具有毒性、致癌性和致突变性。在废水排放到天然水流之前去除这些无机污染物至关重要。
纳米过滤器能有效去除水中的有害物质,包括重金属(As、Cd、Hg、Cr、Pb和F等)和有机污染物。例如,纳米级零价铁(nZVI)因其高效的还原特性而被广泛用于地下水中的有害化学物质的去除。
// #v(4em)
]
#slide[
#set rect(
width: auto
)
== 能源领域
#grid(
columns: (50%,auto),
gutter: 1cm,
[
// #v(-1.0em)
#h(2em)
在能源产业,纳米材料正被用于开发更高效的能源转换和存储系统。
在太阳能电池中,纳米结构如纳米线和量子点被应用于太阳能电池中,通过最大化光捕获和光电转换效率来提升整体的能量收集能力,增加光的吸收和转换效率,从而提高整体的能源产出。
纳米材料同样关键于下一代电池技术,例如锂离子电池中的纳米结构电极可以大大增加电池的储能容量和循环寿命。
],
[
#h(2em) 同时采用导电聚合物或碳纳米管制造超级电容器电极,实现了高能量密度和快速充放电的性能。
]
)
]
#slide[
#set rect(
width: auto
)
== 催化领域
#grid(
columns: (50%,auto),
gutter: 1cm,
[
// #v(-1.0em)
#h(2em)
在催化领域,纳米催化剂由于其*表面积大*和*活性高*的特点,显著提高了化学反应的效率和选择性。
这不仅在工业生产过程中节省了大量的能源和原材料,也在减少环境污染方面发挥了重要作用。纳米催化技术已经被应用于从简单的有机合成到复杂的环境净化过程。
],
[
#figure(
align(center,
image("img/4.png",height: 54%)
)
, caption: [一些HER电催化剂的性能总结]
)
]
// image("tiger.jpg", height: 100%),
// image("tiger.jpg", height: 100%),
)
]
#centered-slide(section: [纳米材料在光电子器件中的具体应用],[
纳米材料在提高光电器件效率方面表现出巨大潜力。
以下是纳米材料在光电子器件中的具体应用,包括改进性能的方法和一些具体的应用实例。]
)
#slide[
#set rect(
width: auto
)
== 改进光电子器件性能的方法
#grid(
columns: (50%,auto),
gutter: 1cm,
[
#v(-2.0em)
=== 量子点
#notes.note[量子点][量子点(QuantumDots,QD)是极其微小的,由有限数目的原子组成,三个维度尺寸均在纳米数量级,一般为球形或类球形,稳定直径在1~10 nm;获得2023年诺贝尔化学奖]是一种半导体纳米晶体,具有独特的光电特性,如宽带隙调节能力,使其能够发出多种颜色的光,是一项真正改变世界的技术。
受到光的刺激时,量子点便会发出纯净的有色光线,颜色由量子点大小形状决定。#notes.note[][电子获得能量跃迁到导带是不稳定的,还会回到价态,束缚态,以光子形式释放光子形式能量,不同的能带间隙不同的光]
],
[
#h(2em) 球形量子点多用核壳结构(如下图)。
#figure(
align(center,
image("img/5.png",height: 34%)
)
, caption: [球形量子点结构图]
)
]
// image("tiger.jpg", height: 100%),
// image("tiger.jpg", height: 100%),
)
#v(-0.0em)
#notes.display()
// #todo([再加两张图])
]
#slide[
==== QLED实际应用
// #v(2em)
比如量子点LED(QLED)显示技术通过在显示屏中使用不同尺寸的量子点来调节发光颜色,从而实现更广的色域和更高的能效
@deng2022solution。
三星电子推出的QLED电视就是利用量子点技术的一个商业成功案例。这种电视使用量子点增强色彩显示,能够覆盖100%的色域,提供比传统LED更明亮、更生动的色彩表现,有效地提高了视觉体验。
]
#slide[
#figure(
align(center,
image("img/6.png",width: 100%)
)
, caption: [三星85英寸级 Neo QLED 8K电视 QN900D]
)
]
#slide[
==== 量子点太阳能电池应用
// #v(2em)
量子点在太阳能电池中的应用是一个激动人心的研究领域,因为它们的独特光学和电子性质为提高光电转换效率提供了新的可能性。@kamat2013quantum
量子点因其量子尺寸效应具备可调谐的带隙特性。这意味着可以通过改变量子点的尺寸来调整它们吸收和发射光的波长。在太阳能电池中,这一特性可以被用来优化*太阳光谱的利用效率*,从而提高整体的能量转换效率。
]
#slide[
=== 其他纳米结构改善太阳能电池
// #v(2em)
纳米材料,如纳米线和纳米棒,可以在太阳能电池中用来增加光的捕获和光电转换效率。
这些纳米结构能有效地降低光反射,并通过多次内部反射增加光在材料中的路径长度,从而增加光吸收。此外,纳米结构还可以帮助更有效地收集产生的电荷,减少能量损失。
研究人员开发了含碲化镉纳米线的太阳能电池,这种新型太阳能电池表现出超过传统平面电池的光电转换效率。纳米线的独特排列和结构不仅增加了光的吸收,还减少了载流子在电池中的复合,从而提高了电池的总体性能。
]
#slide[
=== 其他纳米结构改善太阳能电池
// #v(2em)
纳米材料也被用于提高光纤通信系统的性能。
例如,使用纳米粒子如纳米金和纳米银来制造光纤通信中的非线性光学元件,这些元件可以增强信号的传输效率和处理速度。
在光纤激光器中引入掺杂纳米颗粒,如掺杂铒的纳米颗粒,可以显著提高激光的输出功率和效率。这些纳米颗粒通过增强光的局部场强度来提高激光的增益效率。
]
#centered-slide(section: [未来趋势和挑战]
)
#slide[
=== 新材料的研发
// #v(2em)
纳米科技的未来发展将极大依赖于新材料的研发。
科研人员正在探索具有更高效能、更强耐用性和更低成本的新型纳米材料。
例如,开发具有超高导电性或超强光电效应的纳米材料将推动电子和光电子设备的性能到新的高度。
此外,生物兼容性和环境友好性纳米材料的研发也是未来的重点,这将确保纳米科技在医疗和环保领域的可持续发展。
]
#slide[
=== 现有材料的改进
// #v(2em)
现有纳米材料的改进也是未来纳米科技发展的一个关键方向。
这包括通过纳米工程技术提高材料的稳定性、效率和生产可控性。
例如,通过表面修饰或掺杂来改善纳米材料的光学和电学性质,使其更适合特定的应用,如高效太阳能电池和更敏感的生物传感器。
]
#slide[
=== 市场和制造过程中的挑战
==== 成本效益
// #v(2em)
尽管纳米材料提供了许多独特的优势,但高昂的制造成本仍是其广泛商业化的一大障碍。未来的研究需要寻找更经济的制造方法,以降低生产成本。
==== 规模化生产
规模化生产是纳米材料面临的另一个挑战。目前许多纳米材料的合成方法难以扩展到工业级别,这限制了它们的广泛应用。
==== 环境和健康风险
纳米材料可能对环境和人体健康带来潜在风险。因此,开发新材料或改进现有材料时,必须对其生态毒性和生物兼容性进行彻底评估
]
#centered-slide(section: [结论和讨论])
#slide[
=== 纳米材料的应用成果
// #v(2em)
纳米材料已在多个工业领域展示出显著的成果,特别是在光电子领域。例如,使用量子点和纳米结构增强的太阳能电池和LED显示技术已经显示出超越传统材料的性能。纳米材料的独特性质使其在医疗诊断、治疗和环境净化等领域具有巨大的应用潜力。
=== 未来研究方向的建议
==== 跨学科研究
这包括通过纳米工程技术提高材料的稳定性、效率和生产可控性。
例如,通过表面修饰或掺杂来改善纳米材料的光学和电学性质,使其更适合特定的应用,如高效太阳能电池和更敏感的生物传感器。
==== 可持续性研究
研发可降解或可循环再用的纳米材料,以保证技术的环境可持续性
==== 安全性和标准化
建立全面的纳米材料安全性评估标准和监管政策,确保纳米技术的健康发展。
]
//
// // #header_rect(data.成员)
// // section: [Let's start a new section!]
// // #align(top,rect([111111111]))
// // #grid(
// // columns: (2em, 1fr),
// // gutter: (0em),
// // [1],[2]
// // )
// #set rect(
// inset: 8pt,
// fill: rgb("e4e5ea"),
// width: 100%,
// )
// #grid(
// columns: (70%, 30%),
// // rows: (auto, 60pt),
// gutter: 1cm,
// [
// // #par()[]
// #par()[
// #h(2em)现代化经济发展导致环境问题严峻,特别是
// *水资源问题*。 水资源对人类生存和发展至关重要,但海洋水质惨遭受污染和退化,影响海洋生态和人类利益。因此,及时获取海洋水环境信息非常重要和紧迫@HHAI202304008。]
// 目前海洋水质检测方法存在着测量速度慢、操作复杂、数据统计困难、成本高昂等问题(多基于ARM架构)@基于物联网的水质监测系统设计与实现,无法满足效率和实时性要求。因此,我们设计了一款基于STM32F103C8T6的海洋水质监测系统,能够实时采集并同步显示 pH 值、温度、浊度、TDS等参数信息,并通过NB-IOT模块实时存储至服务器。
// ]
// ,
// [
// #figure(
// align(center,
// image("img/1.png", height: 70%)
// )
// , caption: [污染后的海洋]
// )
// ]
// // image("tiger.jpg", height: 100%),
// // image("tiger.jpg", height: 100%),
// )
// ]
// #slide[
// == 研究意义
// #set rect(
// width: auto
// )
// #grid(
// columns: (50%,auto),
// rows: (4cm, auto),
// gutter: 1cm,
// [
// #align(center+horizon,([#yiyi *保护海洋生态环境:*
// 及时发现并解决海洋污染问题])
// )
// ]
// ,
// [
// #align(center+horizon,([#yiyi *维护生态平衡:*
// 及时调整和管理海洋资源利用
// ])
// )
// ],
// [
// #align(center+horizon,([#yiyi *支撑海洋产业发展:*
// 为海洋产业提供数据支持
// ])
// )
// ],
// [
// #align(center+horizon,([#yiyi *政策制定依据*
// 为政府制定环保政策、规范提供可靠依据
// ])
// )
// ],
// // image("tiger.jpg", height: 100%),
// // image("tiger.jpg", height: 100%),
// )
// ]
// #centered-slide(section: [项目介绍])
// #slide[
// == 概览
// // 本项目基于STM32F103C8T6,搭载各种传感器,按键,0.96OLED屏幕,搭载锂电池模块,NC-05蓝牙模块,NB-IOT物联网模块。
// #figure(
// align(center,
// image("img/框架图.drawio.svg",width: 80%)
// )
// , caption: [整体系统框架图( )]
// )
// ]
// #slide[
// == 硬件部分
// #v(-1.0em)
// #set rect(
// width: auto
// )
// #grid(
// columns: (50%,50%),
// gutter: 1cm,
// [
// === 最小系统板
// 首先我们需要一块STM32C8T6*最小系统板*。调试阶段我们使用*成品*的最小系统板(如右图所示),最终我们将使用自己绘制的最小系统板。其包括SWD调试接口、基本供电、IO引出、外置高速晶振、BOOT和复位电路/按键。
// // 下面给出一些成品模块的照片以及部分绘制的。
// ],[
// #figure(
// align(center,
// image("img/2.png",width: 35%)
// )
// , caption: [成品最小系统板(¥11.2)]
// )])]
// #slide[
// // == 硬件部分
// #v(0em)
// #set rect(
// width: auto
// )
// #grid(
// columns: (50%,50%),
// gutter: 1cm,
// [
// === 调试电路
// ARM支持两种调试端口:*SWD*(Serial Wire Debug) 和 *JTAG*(Joint Test Action Group,即联合测试行动小组)。
// 为了节省空间以及使用开源的硬件驱动,我们使用SWD调试。
// SWD的物理层由两条线组成:
// - SWDIO: 双向数据线
// - SWCLK: 时钟线
// #h(2em) 在测试阶段先使用成品CMSIS-DAPLINK/JLINK/STLINK。
// 下面给出一些成品模块的照片以及部分绘制的原理图。
// ],[
// #figure(
// align(center,
// grid(
// columns: (45%,40%),
// rows: (40%,30%),
// image("img/3.png",width: 55%),
// image("img/4.png",width: 95%),
// image("img/5.png",width: 45%)
// )
// )
// , caption: [STlink(左上),Jlink(右上),CMSIS-DAPlink(左下)]
// )])]
// #slide[
// // == 软件
// #set rect(
// width: auto
// )
// #grid(
// columns: (
// 50%,auto),
// // rows: (40%,30%),
// [
// #figure(
// align(center,
// image("img/6.png",width: 80%)
// )
// , caption: [引出的SWD接口原理图]
// )
// #h(2em) 上图中做了一些常见的保护和外接电路,根据一些开发板的原理图和官方手册@STM32F103x8B @ROBOMASTERC。
// ]
// ,[
// #h(2em) 之后会板载一个DAPlink,使用沁恒公司的CH552G,不需要很复杂的外围电路(5V供电)。TYPE-C口也可作为电源输入同时提供一路串口(虚拟串口)。
// #figure(
// align(center,
// image("img/7.png",width: 120%)
// )
// , caption: [CH552G接线原理图]
// )
// #h(2em) 略去TYPE-C部分原理图。
// ]
// // 上图
// // image("img/4.png",width: 95%),
// // image("img/5.png",width: 45%)
// )
// ]
// #slide[
// === OLED
// #set rect(
// width: auto
// )
// #grid(
// columns: (
// 50%,5%,40%),
// // rows: (40%,30%),
// [
// #h(2em) 使用0.96OLED,使用I2C驱动连接即可,我们将其连接到芯片的I2C1接口(参考官方手册)。
// #figure(
// align(center,
// image("img/8.png",width: 100%)
// )
// , caption: [OLED接线原理图]
// )
// 驱动部分参考 @STM32F103xx。
// ],[]
// ,[
// #v(-2.2em)
// === 按键
// // 通过用户按键设置。补充
// 添加三个用户自定义的按键,设置上拉模式(pull-up)。原理图如下,可以完成一系列预置的操作
// #figure(
// align(center,
// image("img/9.png",width: 100%)
// )
// , caption: [按键原理图]
// )
// ])
// ]
// #slide[
// #set rect(
// width: auto
// )
// #grid(
// columns: (
// 50%,5%,40%),
// [ === 温度传感器模块
// 使用防水式DS18B20温度传感器@DS18B20,而不是TO-92封装。
// #figure(
// align(center,
// image("img/10.png",width: 70%)
// )
// , caption: [DS18B20(防水式封装)]
// )
// #h(2em)精度为±0.5°C,并且无需外部组件即可工作。
// ],[],[
// #figure(
// align(center,
// image("img/11.png",width: 60%)
// )
// , caption: [接线原理图]
// )
// GND接地。VDD供电(3.3V至5.5V,我们给5V供电)。DQ 是1-Wire数据总线。
// ]
// // rows: (40%,30%),
// )
// ]
// #slide[
// #set rect(
// width: auto
// )
// #grid(
// columns: (
// 40%,15%,45%),
// [
// // #figure(
// // align(center,
// // image("img/12.png",width: 80%)
// // )
// // , caption: [DS18B20内部结构]
// // )
// #h(2em) 采用16位补码储温度(摄氏度)。整体操作流程如下:
// #h(-2em)①初始化:
// // #algorithm({
// // import algorithmic: *
// ```c
// DQ=1;Delay(10); //初始化
// DQ=0;Delay(80); //复位脉冲
// q=DQ;Delay(20);
// DS18B20_DQ = 1; //释放总线
// ```
// ②写时序:
// ```c
// for(i=0; i<8; i++)
// { DQ=0;
// DQ=dat&0x01;Delay(5);
// DQ=1;
// dat >>= 1;
// }
// ```
// // })
// ],[],[
// 其中一些常用的是,
// / 温度转换: 0x44;
// / 读取温度: 0xBE;
// // 读取高速暂存器存储的数据。
// ③读时序
// ```c
// uchar i,value;
// for(i=0; i<8; i++)
// { DQ=0;
// value >>= 1;
// DQ=1;
// if(DQ) value|=0x80;
// Delay(5);
// }
// ```
// #h(2em)最后通过计算公式计算出温度值.
// ]
// // rows: (40%,30%),
// )
// ]
// #slide[
// // #slide[
// #set rect(
// width: auto
// )
// #grid(
// columns: (
// 50%,50%),
// [
// === 浊度传感器模块
// 使用浊度传感器TWS-30。利用光学原理,通过溶液中的透光率和 散射率来综合判断浊度情况。
// 内部是一个*红外线对管*,光接收端把透过的光强度转换为对应的电流大小。使用STM32的*ADC*采集电流大小,通过一定的算法转换为浊度值。
// 模块具体接线如figture12所示。
// ],
// [
// #figure(
// align(center,
// image("img/13.png",width: 60%)
// )
// , caption: [
// TWS-30模块图]
// )
// #figure(
// align(center,
// image("img/14.png",width: 90%)
// )
// , caption: [
// 模块接线图]
// )
// ]
// )
// ]
// #slide[
// #set rect(
// width: auto
// )
// #grid(
// columns: (
// 50%,50%),
// [
// === 电导率传感器模块
// 使用TDS传感模块测量电导率。三个PIN接口分别为VCC(+)、GND(-)、A。VCC供电,GND接地,A接模拟输入(ADC)。
// TDS 测量主要通过给测试电极输入交变的驱动电压(防止探头极化),在被测液体中产生微小电流,从而得到被测液体的电导率。模块采用电极法测定水溶液的电导率,当两电极插入溶液中,可以测出两电极间的电阻,经过转接板转换,最终输出模拟电压值,根据电压值与TDS的线性关系式,最终得到TDS值。
// ],
// [
// #figure(
// align(center,
// image("img/15.png",width: 40%)
// )
// , caption: [
// TDS模块实物]
// )
// #figure(
// align(center,
// image("img/16.png",width: 50%)
// )
// , caption: [
// TDS模块实物]
// )
// ])
// ]
// #slide[
// === PH
// 使用E201-C传感器模块。包括一个 BNC 电极 pH 传感器探头和一个前置放大模块。还是模拟输出,通过STM32 的 ADC(模数转换器)引脚来读取传感器的模拟输出
// #figure(
// align(center,
// image("img/19.png",width: 40%)
// )
// , caption: [实物图]
// )
// ]
// #slide[
// #set rect(
// width: auto
// )
// #grid(
// columns: (
// 50%,50%),
// [
// === 蓝牙模块
// 使用HC-05蓝牙模块,通过UART1(AT指令控制)。
// #figure(
// align(center,
// image("img/21.png",width: 100%)
// )
// , caption: [连接示意图]
// )
// ],[
// #figure(
// align(center,
// image("img/22.png",width: 100%)
// )
// , caption: [实物图]
// )
// ]
// )
// ]
// #slide[
// //
// #set rect(
// width: auto
// )
// #grid(
// columns: (
// 46%,8%,46%),
// [
// === NB-IIOT模块
// NB-IoT(Narrow Band Internet of Things)是一种基于蜂窝的窄带物联网技术,也是低功耗广域物联 (LPWA)的最佳联接技术。
// 这种模块不同于ESP 8266、ESP12S模块(局域网),是可以使用SIM卡接入运营的网络的。
// NB-IoT在2020年全球连接数已超过1亿,预计未来五年将实现10亿级连接,持续推动物联网设备的爆发性增长。其具有以下优点
// ],[]
// ,[ #figure(
// align(center,
// image("img/23.png",width: 90%)
// )
// )
// #h(2em)其也是使用UART(AT指令)进行通讯,这里使用单片机的UART2。同时我们这里选用安信可的EC-01F模块。如下。
// #figure(
// align(center,
// image("img/24.png",width: 70%)
// ),
// caption: [实物图]
// )
// ]
// )
// // 简单介绍一下8266那种局域网模块和这种物联网模块的区别。
// // 使用安信可的EC-01F模块,搭配SIM卡使用。使用UART2,配置以及原理图如下。
// // #rec
// ]
// #slide[
// === 系统供电
// 系统使用3.7V锂电池供电,使用TP5400模块进行充电和升压,同时使用一个NMOS和二极管选择TYPE-C口输入的5V电源和锂电池升压后的电源(有USB供电优先使用USB供电),然后使用AMS1117-3.3稳压芯片将选择后的5V电压稳压到3.3V,为系统提供3.3V电压,供电拓扑图如下。
// #figure(
// align(center,
// image("img/电源拓扑图.drawio.svg",width: 90%)
// ),
// caption: [供电拓扑图]
// )
// ]
// #centered-slide(section: [APP])
// #slide[
// == 框架选择
// // === 系统供电
// 综合考虑了一些APP的框架和结构,最后选择一种相对简单,易于上手,页面优美的APP框架——
// #box(image("img/25.png",height: 1em))
// 。
// Meteor是一个开源的*全栈*框架,它可以使用JavaScript来构建和部署响应式的网页,移动和桌面应用程序。之所以说他是全栈是因为打包的时候会直接构建出可以直接服务器部署的代码。
// 其具有以下优点
// + Meteor可以与所有流行的前端框架集成,如 React, Vue
// + Meteor可以使用任何具有Node.js驱动的数据库,但是MongoDB是Meteor开发者最常用的选择,因为它存储JSON对象,并使用JavaScript作为查询语言
// + 可以使用一系列的`npm`包来开发你的软件。
// + 经过十多年的发展,深受行业巨头的信赖。
// // 这是一个2015年出生的相对年轻的框架。
// // 简单介绍一下gradle。
// ]
// #slide[
// == Some Packages
// 下面介绍一下我们可能用到的几个包
// + `chakra-ui`:一个简单丰富的React组件库,用于构建一些基本的组件。
// + `cordova:cordava-plugin-bluetooth-serial`:一个蓝牙插件,用于连接蓝牙设备。
// + `react-native-ble-plx`:一个蓝牙插件,用于连接蓝牙设备。
// // 现在真正测试,还没有真正开发代码。
// ]
// #slide[
// == Develop with AI
// 不久前,谷歌的Gemini API免费开放。如果可能我们希望在我们的应用中集成它,使我们的用户更便捷地分析数据。我们打算在应用中使用它集成一个聊天机器人,完成一些便携的任务,比如
// + 分析一下这一周的水质变化,并说明一下可能是什么原因导致的
// + 分析一下这里的水质,给出一份水质监测报告
// ]
// #centered-slide(section: [人员分工以及进度安排])
// #import "@preview/tablex:0.0.8": tablex, rowspanx, colspanx
// #slide(
// [
// == 分工
// // 主要分工:一个机械方面,三个负责STM32硬件和软件方面,一个负责APP开发。具体分工如下:
// #align(center,[
// #tablex(
// columns: 2,
// align: center + horizon,
// auto-vlines: true,
// // font:
// // indicate the first two rows are the header
// // (in case we need to eventually
// // enable repeating the header across pages)
// header-rows: 1,
// // color the last column's cells
// // based on the written number
// /* --- header --- */
// [姓名], [分工],
// // [2021251124古翱翔], [NB IOT物联网模块设计及验证,最小系统板原理图绘制、选型及验证,PCB布线、打样,各模块的焊接],
// ..data.分工以及成员
// )
// ])
// ])
// #slide(
// [
// == 进度安排
// #let data1=()
// #for i in data.进度安排{
// data=data+data
// data1.push([#i.节点 ])
// data1.push([#i.验收])
// }
// // 主要分工:一个机械方面,三个负责STM32硬件和软件方面,一个负责APP开发。具体分工如下:
// #align(center,[
// #tablex(
// columns: 2,
// align: center + horizon,
// auto-vlines: false,
// // font:
// // indicate the first two rows are the header
// // (in case we need to eventually
// // enable repeating the header across pages)
// header-rows: 1,
// // color the last column's cells
// // based on the written number
// /* --- header --- */
// [时间节点], [任务],
// // [2021251124古翱翔], [NB IOT物联网模块设计及验证,最小系统板原理图绘制、选型及验证,PCB布线、打样,各模块的焊接],
// ..data1
// )
// ])
// ])
// #centered-slide(section: [其他的引用参考文献])
// #slide[
// @刘硕2021基于单片机的智能水质检测系统设计
// @林华2020基于
// @邓洁2023基于
// @徐思维2020基于物联网的多参数水质监测系统设计
// @基于物联网的水质监测系统设计与实现
// @杜魁2012浅谈水质监测的意义
// @王天钊2023基于
// @综述2
// @9824243
// @1234567
// @guomarine
// @12341234
// ]
#slide[
#bibliography("cankao.bib")
]
// // #slide[
// // #todo_outline
// // ]
|
|
https://github.com/HarryLuoo/sp24 | https://raw.githubusercontent.com/HarryLuoo/sp24/main/README.md | markdown | Notes and homework files for my probability and classical mechanics class at UW madison, spring 2024. These are compiled in Typst.
Mechanics notes: Physics311/reviewNotes/briefMechanics.pdf
Probability notes: 431/notes/BriefTheoryOfPrabability.pdf\
I got a B on my probability class using my notes so tread with caution
Applied analysis (Vector and complex analysis): math321/briefAppliedAnalysis.pdf
|
|
https://github.com/VisualFP/docs | https://raw.githubusercontent.com/VisualFP/docs/main/SA/project_documentation/content/meeting_minutes/week_06.typ | typst | = Project Meeting 24.10.2023 08:15 - 09:30 (MS Teams)
== Participants
- Prof. Dr. <NAME>
- <NAME>
- <NAME>
== Agenda
- Presentation of survey questionnaire results
- Discussion of project status
- Decision: Concept for extensibility & concept for Haskell import have lower priority. We'll look at these topics after the PoC works and we still have time left.
Input from Advisor:
- Suggestion for visual function design
|
|
https://github.com/rqy2002/typst-experiment | https://raw.githubusercontent.com/rqy2002/typst-experiment/main/thm.typ | typst | // theorem envioronment
#let theorem(name, counterFormat, seperator, titleFormat, bodyFormat, counter, title: none, body) = {
set par(first-line-indent: 0pt)
let result = parbreak() + [#name #counter.display(counterFormat)] + (if title != none [ (#titleFormat(title))]) + seperator + [ ] + bodyFormat(body)
result
counter.step()
}
#let newtheorem(id, name: none, counterFormat: "1", titleFormat: it => it, seperator: ".", bodyFormat: it => it) = {
let counter = counter(id)
theorem.with(if name == none {id} else {name}, counterFormat, seperator, titleFormat, bodyFormat, counter)
}
|
|
https://github.com/japanoise/strategos-m | https://raw.githubusercontent.com/japanoise/strategos-m/main/strategos-m.typ | typst | Creative Commons Attribution Share Alike 4.0 International | #import "format.typ": format-modern, modern-frontispiece, logo, subheader, frac, alt-fill
#set document(title: [Strategos M])
#set page(
paper: "us-letter",
)
#set terms(separator: [: ])
#show: format-modern
#counter(page).update(0)
#modern-frontispiece
#pagebreak()
#show outline.entry.where(
level: 1
): it => {
v(0.9em, weak: true)
strong(it)
}
#[
#set page(margin: 1cm)
#outline(indent: 1em)
#v(1fr)
#align(left)[
October 2024 draft. Copyright © 2024 japanoise,
licensed CC-BY-SA 4.0.
*The Olivia Hill Rule:* If you're a fascist, you're not
welcome to play this game. It's against the rules. If you're
reading this and thinking "you just call everyone you
disagree with a fascist," then you're probably a fascist, or
incapable of drawing inferences from context and acknowledging
a dangerous political climate that causes the oppressed to be
hyperbolic. Don't play this game. Heal yourself. Grow.
Learn. Watch some Mr. Rogers' Neighborhood or something.
]
]
#pagebreak()
#set page(
columns: 2,
margin: (x: 1cm, bottom: 2cm, top: 1cm)
)
= Introduction
The medieval period was a vast span of time, and a brief rulebook
such as this can contain only so much historical detail. The aim,
instead, is to provide a solid foundation for the reader to craft
their own battles and campaigns. The rules are intended to strike
a balance between ease of understanding, playability, and
flexibility --- realism is important, but is not the primary aim.
Still, these rules veer more towards simulation than specifically
providing a "fair" challenge, or attempting to provide a medium of
storytelling. Scholars of the history of wargames will recognize in
them the skeleton of <NAME>'s Strategos, hence the name;
and of course, the simplifications and clarifications of that
venerable system from <NAME>. The former was a serious military
training tool, intended to teach real tactics to young officers. It
is the author's intention that your medieval battles and campaigns
with _Strategos M_ will be similarly a real exercise in the tactics of
the period.
= The Referee
The key innovation separating miniature wargames (and their cousins in
the "Role-Playing Game" hobby) from board games such as chess, or
board wargames, is the introduction of the *Referee*. The
introduction of a neutral third party elevates the game from a "Rigid
Kriegspiel" into a "Free Kriegspiel." As the interpreter & voice of
the rules, the referee can allow the players more inventiveness and
variety during gameplay. Players can attempt strategies which were
not thought of during the drafting of the written rules; the referee
then provides a neutral arbiter who can narrate the consequences of
those strategies on the game world.
*In general, any strategy which could feasibly work in real life
should also work in the game, even if not covered by the rules.*
The referee's duties are many, but in particular, she must take care
to:
+ Give the players their orders, if necessary.
+ Set the conditions for victory, for both sides.
+ Plan the terrain of the battlefield, as well as noting in advance
any questions that may be asked during gameplay.
+ Simulate the effects of any non-combatants or important non-combat
environmental conditions encountered during gameplay (for example,
the effects of spies or assassins, the character of any peasants
found or prisoners taken, the nature of stolen documents, etc.)
+ Provide a witness to actions taken while the opponent is away.
+ Provide an arbiter and mediator for disputes between the players;
she should provide each side the opportunity to *briefly* state his
case, and then come down on one side or the other, or compromise
(using Table J or K, for example). Should all sides agree, the results
of the dispute can optionally be noted down in the rules at the end
of the game to form a precedent in future.
+ Manage records --- of casualties, morale, &c.
Should the referee make a poor call, or the players forget a rule and
the referee forget to apply it, she may correct herself --- but if
several turns have passed, she also has the option to put it down to
chance; a tactical blunder, unusual courage, cowardice, or the likes.
= Scale
+ Either 28---32mm or 15mm miniature figures are used.
+ If 28---32mm figures are used, 1" on the table = 10 meters/10 yards in-game.
+ If 15mm minis are used, 1" in the rules = 1cm on the table.
+ One contour line or ½" of terrain height = 5 meters/yards.
+ One figure is at most 20 men.
+ One game turn = 1 minute in-game.
It is recommended a 5' by 9' table is used; or, with 15mm figures,
76cm by 137cm is sufficient.
= Dice
Only ordinary six-sided dice (d6) are used. The use of a twelve-sided
die (d12) can make rolling on Table J easier, but a d66 value is also
provided. To roll 1d66, roll one die for the tens digit, and another
for the units, yielding a result of 11---66.
#pagebreak()
= Turn Sequence
+ The referee conveys any messages or information received during the
turn to the players. In private, the players inform her of any
plans they have.
+ The players write out their orders for the turn.
+ If any archers or arbalists are loosing, ranges must be measured now.
+ If charges have been ordered, then distances should be measured and
it should be determined whether melees will occur or which units will
be hit by missiles.
+ Movement occurs simultaneously. Troops must follow their orders as
they were written. This is also where the referee moves troops that
are compelled to move as a result of breaking morale, effects of
melee, effects of missiles, etc. in previous turns.
+ The effects of missile fire are carried out.
+ Any effects on morale caused so far are resolved.
+ Further missile volleys/morale effects are resolved.
+ Melees are resolved. If the result on Table T indicates a retreat:
- If the melee was the result of a charge, the retreat/pursuit is
carried out immediately;
- Otherwise, retreat/pursuit is carried out next turn at step 5.
The referee may choose to resolve steps 5---9 in stages for
isolated areas of an action.
= Writing Orders
Players compose their list of orders from the list below. Note that
some maneuvers require training, and units may (at the referee's
discretion) ignore or even defy their orders, due to poor training or
discipline. Orders require time to complete; the time taken is noted.
== General Orders
/ Advance _x_ Inches: Time taken proportional to movement + speed.
/ Advance Towards _x_: Where _x_ is a landmark.
/ Charge _x_: Where _x_ is a landmark or enemy. Move at
maximum speed, as for doubletime or gallop.
/ Rest: Spend the turn taking no action (recovering). Units must rest
after 12 turns; quicktime/trot turns count as 2, doubletime/gallop
turns, turns with a charge, or turns in melee count as 3.
== Infantry Orders
Infantry moves up to 6" per turn (9" quicktime; 12" doubletime);
except light infantry, which moves up to 9" per turn (13.5" quicktime;
18" doubletime).
/ Quicktime: Movement takes ⅔ time; must be first order. Roll morale
once, halfway through the turn. No effect on charges.
/ Doubletime: Movement takes ½ time; must be first order. Roll morale
once a third through the turn, and once two thirds through the turn.
/ About Face: Units turn through 180#sym.degree.
=== Line Formation
/ Form Column Left/Right: (⅑ turn) Units turn to their left or right
and form a column.
/ Left/Right Wheel, _x_ Inches: Formation rotates about the bottom
left/right corner of left/rightmost unit, _x_ inches at right/leftmost
unit. Also *Left/Right Wheel To _x_* where _x_ is a landmark.
Marching backwards (*Retire* or *Back Left/Right Wheel*) is at half
speed, and requires training.
/ Oblique March Left/Right, _x_ Inches: March at a 45#sym.degree angle
to left/right, _x_ inches. Also *Oblique March To _x_,* where
_x_ is a landmark.
/ Extend To Left/Right _x_ Inches: Left/rightmost remains in place;
right/leftmost moves to right/left _x_ inches; others spaced
evenly. Open formation.
=== Column Formation
/ Move _x_ Inches, _y_: Where _y_ is a compass direction. Leaders turn
about the inside, and the column follows.
/ Move _x_ Inches Along _y_: Where _y_ is cover, a road, or somesuch.
/ Move To/Into _x_: Where _x_ is a landmark
/ Follow _x_, _y_ Inches Behind: Where _x_ is a friendly column.
/ Form Line Left/Right: Units turn left/right and form a line.
/ Extend To Left/Right _x_ Inches: Leader remains in place; rearguard
moves to left/right _x_ inches; other units are spaced evenly
between. Open formation.
=== Open Formation
Infantry in open formation may move as if in a line formation.
/ Close To Line Left/Right: Form a line; time taken is same as for an
Extend To Left/Right.
/ Close To Column Left/Right: Form a column; time taken is same as for
an Extend To Left/Right.
/ Form Line To Left/Right: ($1/12$ turn per unit) Leader pivots around
left/right front corner. Following units move forward in a column
and pivot to form a line.
== Cavalry Orders
Cavalry moves up to 12" per turn (24" trot; 36" gallop). Otherwise
they move as do infantry in corresponding formations (line, column, or
open).
/ Trot: Movement takes ½ time; must be first order. Roll morale once,
halfway through the turn. No effect on charges, which happen at a
gallop.
/ Gallop: Movement takes ⅓ time; must be first order. Roll morale
once a third through the turn, and once two thirds through the turn.
Charges are automatically a gallop action.
/ Dismount/Mount: (#frac(1, 4) turn). Unit fights & moves as
appropriate infantry. #frac(1, 4) must tend to
horses.
== Missile Orders
Missile infantry moves as does light infantry (and is considered as
such for melee). Horse archers move as does other cavalry.
/ Take Aim: (Half a turn) Lowers rate of fire, but prepared missiles
are more deadly.
/ Loose: (Half a turn) Loose missiles at targets within a
90#sym.degree arc, that is 45#sym.degree to left or right of
straight ahead. Archers may only loose twice if they do not move or
melee in the rest of their turn. Only the first two rows of a
column may fire; for all units to fire, they must be in line
formation.
/ Reload: (Half a turn) Arbalists (crossbow users) must reload before
firing again.
/ Split-Move Loose: Horse archers and certain elite archers may move
at half speed and fire at the same time, and so are able to loose
twice a turn while moving. Order given before any movement orders;
loose at the start and halfway through the turn, assuming no
melees.
= Terrain
Terrain affects movement and visibility.
== Slopes
As noted above, contour lines show 5 meter/5 yard intervals; summits
of hills are shown with a dot and crests of ridges with a line.
The steepness of slope is indicated, naturally, by the closeness of
the contour lines:
/ Gentle Slope: More than 2" between contours. No movement penalty.
/ Moderate Slope: 1"---2" between contours. Movement at ½
speed. Wagons, siege engines, etc. must move directly up or down,
not along the face.
/ Steep: ½"---1" between contours. Movement at ¼ speed, and only
dismounted cavalry & infantry in open formation.
/ Vertical: Less than ½" between contours. No entry.
== Woods
Near to cities and towns, woods are *Open* --- there is little
underbrush as it is collected for firewood. Movement is unrestricted,
except that troops may not maintain line formation.
*Thick* woods have underbrush, and for these movement is at ½ speed.
Siege engines and wagons may not pass unless a ranger cuts a trail
first.
*Heavy* or *Dense* woods include rainforest and forest in tropical
regions. Only Cavalry and Infantry in open formation may pass, moving
at ¼ speed.
== Barriers
Hedges, ditches, stone walls and the like completely block vehicles.
Trained cavalry may jump over barriers of less than 3'.
Infantry may not cross obstacles 5' or more tall. Light infantry can
cross smaller obstacles instantly; others must take one turn.
== Fords
Fords must be crossed in a column, unless they are very shallow. The
maximum depths of a ford that can be crossed depends on the troop
type:
/ Infantry: 3' for fast current, up to 4' for slow current.
/ Cavalry: 3'6"---4'4"
/ Vehicles: 2'4"
== Abatis/Slash
Entanglement of felled trees, used to prevent troop movements.
Impassable if defended; otherwise, only light infantry in open order
may cross. An abatis is one emplacement and takes a turn to cross;
slash is essentially several abatises together, and the referee must
determine how long it takes to cross; which depends on the depth.
= Eliteness
Troops are ranked by how experienced and well-trained they are.
Troops at eliteness level 1 or 2 require a year's training to advance
a level; level 3 and onwards are hardened by one level in every battle
they survive where they do one or more of:
- Engage in melee
- Suffer 10% or more losses
- Defeat an enemy solely with missiles
The eliteness levels are:
+ *Green* (level 1) --- Peasants.
+ *Experienced* (level 2) --- Trained militia.
+ *Regular* (level 3) --- Men at arms.
+ *Veteran* (level 4) --- Elite men at arms; knights.
+ *Campaigner* (level 5) --- Elite knights.
A combination of equipment and training determines how effective
troops are in combat; see Table S.
#align(center,
image(
"img/KnightWithLance.svg",
)
)
= Morale
*Morale* is a measure both of troops' emotional state and of their
relative disorganization. Each morale state other than *Normal* has a
duration; after which, it will move towards *Normal*. For example,
after 6 turns, troops *In Disorder* become *Badly Shaken;* after two
turns, troops *Flushed with Victory* become *Normal*.
#table(
align: (
left,
center,
left,
left,
),
columns: (
7em,
auto,
7.2em,
auto,
),
table.header(
table.cell()[Class],
table.cell()[Lasts],
table.cell(align: center)[Melee],
table.cell(align: center)[Missile],
),
fill: none,
stroke: none,
gutter: auto,
row-gutter: .86em,
[*Enthusiastic*],
[1 turn],
[#(sym.times)5 (Infantry)\
#(sym.times)10 (Cavalry)],
[#(sym.times)#frac(4, 5)\
#(sym.times)1],
[*Flushed with Victory*],
[2 turns],
[#(sym.times)3 (Infantry)\
#(sym.times)6 (Cavalry)],
[#(sym.times)1],
[*Normal*],
[Indefinite],
[#(sym.times)1 (both)],
[#(sym.times)1],
[*Somewhat Shaken*],
[1 turn],
[#(sym.times)#frac(2, 3) (Infantry)\
#(sym.times)#frac(1, 3) (Cavalry)],
[#(sym.times)#frac(1, 2)],
[*Shaken*],
[2 turns],
[#(sym.times)#frac(1, 2) (Infantry)\
#(sym.times)#frac(1, 4) (Cavalry)],
[#(sym.times)#frac(1, 3)],
[*Badly Shaken*],
[3 turns],
[#(sym.times)#frac(1, 3) (Infantry)\
#(sym.times)#frac(1, 6) (Cavalry)],
[#(sym.times)#frac(1, 5)],
[*In Disorder*],
[6 turns],
[#(sym.times)#frac(1, 5) (Infantry)\
#(sym.times)#frac(1, 10) (Cavalry)],
[#(sym.times)#frac(1, 10)],
[*In Great Confusion*],
[10 turns],
[#(sym.times)#frac(1, 10) (Infantry)\
#(sym.times)#frac(1, 20) (Cavalry)],
[#(sym.times)0],
[*Routed*],
[20 turns],
[#(sym.times)0 (both)],
[#(sym.times)0],
[*Missing*],
[Gone for the day. #frac(1, 2) will return.],
[#(sym.times)0 (both)],
[#(sym.times)0],
)
+ *Morale Roll:* One die is thrown. The troops go down one morale
level if the roll is _above_ their eliteness level.
+ Morale goes up when winning melees, or (if below *Normal*) after
turns spent reorganizing. Turns where troops move faster than
normal or are involved in melee do not count towards reorganizing.
+ Morale can go down after melees, and as the result of missile
casualties. Roll once per 5% original force lost.
+ Morale goes up for attackers if defenders fall back _before_ an attack.
#pagebreak()
= Possibilities
Under pressure, it is possible troops disobey their orders and act on
their own initiative instead. Listed on the *Table of Possibility* are
common situations in which it is possible troops disobey their orders
(or where the question arises whether or not they will). Table R and
Table S modify these chances, and dice (see *Probabilities*) can be
used to find the outcome.
== Table of Possibilities
#set enum(numbering: "1.A.")
1. When under missile attack and suffering a morale drop due to losses:
+ Can troops advance?\
*Infantry:* 2:1 No\
*Cavalry:* No, but they may charge.
+ Can troops charge?\
*Yes*, if a clear path to charge is available.
#enum.item[
Can they carry out another operation or move in a different
direction (neither directly away from nor towards the attacking
missile troops)?\
*Yes,* depending on losses taken that turn; see table
below. (multiplied by melee modifier as per the *Morale*
section).
#table(
align: center,
fill: none,
stroke: none,
columns: (
10em,
5em,
),
table.header(
[Losses],
[Odds],
),
[5%], [2:1 *Yes*],
[10%], [3:2 *Yes*],
[20%], [50/50],
[25%], [3:2 *No*],
[33%], [2:1 *No*],
[50%], [3:1 *No*],
[67%], [4:1 *No*],
)
]
+ May troops fall back to cover or directly away?\
*Yes,* so long as they can move.
+ May troops return missile fire?
- Infantry: \
*Line:* 2:1 no; 4:1 no when attacked from flank or
rear.\
*Column:* 4:1 no; must reform to loose.\
*Open:* 50/50.
- Cavalry:\
*If they need to dismount first:* 4:1 no\
_otherwise:_\
*If in column:* 8:1 no\
*If in line:* 4:1 no\
*If open:* 2:1 no.
+ When two groups of missile troops are firing upon one another, which group must retreat?
Check when making a morale drop throw. Use case 1E, with
multiplier 1---5 corresponding to troop eliteness.
+ When _surprised_ and hit by missiles, will troops drop to *In Disorder?*\
If at least 5% losses are caused --- 5:1 yes.
+ Will troops refuse to enter a narrow passage which the enemy does
not occupy but has under cover fire?\
*Infantry:* 2:1 yes\
*Cavalry:* 4:1 yes
Possibility 4 has a special case --- if enemy cavalry are posted
within 25" of the exit of the passage, and are poised to attack, odds
are 5:1 against troops leaving the passage. Either a spear formation
or friendly missile volley will break this restriction. Troops which
move through the passage unmolested do not need to check odds.
A passage is defined as any space troops cannot pass through with more
than two figures abreast. This includes spaces so specifically
designed on the battlefield as well as those that are created by
player action, environmental circumstance, and so forth. Examples are
bridges, corridors, breaches, alleyways, bridges, fords, etc.
= Visibility
Friend and foe can be distinguished at about 1000 meters (100").
Individual troops can be spotted at 1600 meters (160").
Formations of troops can be seen 3200 meters (320") away.
Being higher up allows troops to see over lower obstacles, depending on
the distances involved.
== Woods
- Troops outside a wood cannot see troops inside it.
- Troops inside or at the edge of an *open* wood may see up to 15"
inside the wood.
- Troops can see at most 5" into another wood.
= Missiles
Troops may loose missiles within a 45 degree arc to either side of
them.
Hits to troops are adjusted based on the types of troops targeted:
#table(
fill: none,
stroke: none,
columns: 2,
align: center,
gutter: auto,
row-gutter: 1em,
table.header(
[Class],
[Description],
),
[Light Foot (LF)],
[Light infantry --- militia, archers, etc. Lightly armored with gambeson or unarmored.],
[Light Horse (LH)],
[Light cavalry --- skirmishers, scouts, horse archers, etc. Horse has no barding.],
[Heavy Foot (HF)],
[Medium infantry --- professional mercenaries, regulars, etc. Armored (gambeson or chainmail) & trained.],
[Medium Horse (MH)],
[Medium cavalry --- Men-at-arms, lancers. Horse has no barding.],
[Armored Foot (AF)],
[Heavy infantry --- dismounted knights & men-at-arms, elite guards, etc. Plate or chainmail armor.],
[Heavy Horse (HH)],
[Heavy cavalry --- knights, men-at-arms, elites, etc. Horse has barding (armor).],
)
In the medieval period, trained archers were able to perform indirect
fire --- that is, firing upon a target they cannot see by arcing their
arrows through the air. In-game, indirect fire can be undertaken ---
reducing the listed range to one-third --- to hit targets that archers
cannot see, but only if those units do not have covering above them
(like a roof or heavy foliage). Archers must also be aware that units
are there; they cannot blindly perform indirect fire at a unit the
player can see but the archers are not feasibly aware of. Hits on
Table M are moved to the next column along --- LF/LH #sym.arrow HF/MH,
HF/MH #sym.arrow AF/HH; AF/HH cannot be hit indirectly.
Troops can be hidden, and in some cases not seen on the tabletop.
Missile troops may not loose upon troops they are not aware of, but
missiles loosed in the general direction of an enemy may hit them
"accidentally". The referee records accidental losses and inform the
player controlling the hidden troops.
Troops under missile attack will attack their assailants back, if
possible, rather than target other enemy units.
The procedure for a missile volley is as follows:
+ The player chooses the target and the troops which will loose at it.
+ The referee measures the range (note this is *after* the target has
been chosen and the decision to loose made).
+ Table M is consulted and rolled on. Depending on the rating of the
target troops (above), number of troops loosing, and a die roll,
number of hits is found. If the number firing is larger than 20, the
referee will split them into groups accordingly.
+ The number of hits is adjusted according to Table R, yielding the
final number. Fractions are rounded down.
Targets hit are out of action. If the action is part of an ongoing
campaign, where players may wish to recover a missile company's
strength:
- #frac(1, 6) (\~16.6%) hit are killed
- #frac(1, 3) (\~33.3%) hit are wounded but may still walk
- #frac(1, 2) (50%) hit are badly wounded and may not walk
The exact nature of the wounds is left as an exercise to the referee.
It will vary based on the weapon used, the sadism of the referee, etc.
== Weapon Ranges
#table(
columns: (
1fr,
auto,
auto,
auto,
),
align: (
left,
center,
center,
center,
),
table.header(
[Weapon],
[Range],
[#frac(2, 3) Range],
[#frac(1, 3) Range],
),
[Short Bow],
[15"],
[10"],
[5"],
[Horse bow],
[18"],
[12"],
[6"],
[Crossbow],
[18"],
[12"],
[6"],
[Longbow],
[21"],
[14"],
[7"],
[Composite bow],
[24"],
[16"],
[8"],
[Heavy Crossbow#footnote()[Takes one full turn to reload]],
[24"],
[16"],
[8"],
)
#pagebreak()
= Charges
The referee must inform both players when the orders of two units will
cause them to collide. Each player may then (in secret) choose her
response:
+ *Continue:* Unit continues with their orders as written.
+ *Halt:* Unit ceases movement, retaining formation. Case 13 on Table
S (bonus for charging moving troops) no longer applies should the
unit be charged.
+ *Charge:* Charge the other unit. Infantry units will break ranks;
Cavalry will form a line and wheel towards the enemy. Charges are a
doubletime/gallop move; morale rolls & fatigue apply.
+ *Run:* *Run to _x_*, *Run into _x_*, *Run _x_ Inches*, &c. Unit
breaks ranks and moves away at charge speed. Morale rolls are made.
Enemy troops, if charging, collect a morale bonus for scaring the
friendly troops off.
For all response orders except *Continue,* a #frac(1, 4) of a turn is
lost to organize a response. After *Halt,* troops may fire missiles
in any time remaining during the turn.
If contact would not result, movements are carried out as
before. Other collisions that result must also be resolved.
The players having revised their orders, any charges which result in
combat must have their odds calculated using Table S. Cases 1---5
describe the basic combat odds; cases 6---16 describe modifiers and
multipliers that may be applied. The process is as follows:
+ Determine missiles that will strike troops during the
movement. Compute losses and morale effects first.
+ Determine the influence of cases from the Table of Possibility that
may apply.
+ Determine morale effects due to movement; recall that charges use
doubletime or gallop.
+ If a side reaches this stage and its morale is *Routed,* it will
ignore its orders and instead will *Run.* If *Missing,* the units
affected are immediately removed from the field.
+ Calculate odds using the number of troops & Table S. Odds are
rationalized as far as possible. If unit odds e.g. 1:1, 5:1, 10:1
are not reached, division should be continued and any fractions
rolled on Table J or K to see if they apply. For example, if a
ratio of 8:3 is reached, then the unit ratio would be 2#frac(2,
3):1. The fraction part is rolled for using Table K, at the 2:1
odds; if A, 3:1, if B, 2:1.
+ Roll on Table T. Both sides roll one die. The side with greater
odds may choose to reroll for as many times as they have advantage,
taking the next die rolled. For example, if the odds are 3:1, the
favored side may roll its die up to 3 times. Both sides are aiming
to roll high. If odds are 6:1, the favored side may add one to its
kept die; 12:1 adds two; 18:1 adds three; 24:1 adds four; 30:1 adds
five.
+ Friendly losses, in troops (not figures) are equal to the final
value of the enemy's die, multiplied by the number of enemy troops
(not figures) involved, and divided by 100. If the result was not a
tie, the winning side adds one to their die roll for the purposes of
calculating losses, and the losing side subtracts one. No morale is
checked for these losses; morale effects are applied according to
Table T instead.
+ If the final values of the dice (favored side including her bonuses)
are the same, then no immediate decision is reached, and melee
continues on the next turn. Both sides are *Shaken*.
+ Otherwise, there is an immediate decision and consequences are
carried out:
- For cavalry that are not outnumbered by 3:1, and defeating a
side which is less than #frac(1, 2) cavalry, a difference of
one or two is upgraded to three.
- If the difference was one or two, the losing side retreats at
normal speed for the rest of the turn. If the winning side were
defending, they carry out their remaining orders; if they were
attacking, they take the losing side's position and form a line
facing them.
- If the difference was three or more, the losing side runs.
Victorious defenders carry out their existing
orders. Victorious attackers either pursue an enemy unit they
were ordered to charge, or will halt if they were ordered to
charge a landmark.
+ Either way, slain figures are removed.
#pagebreak()
= Melee
A melee is simply an ongoing hand-to-hand combat started by a charge
on some previous turn. During the turn, either side may add troops as
reinforcements. These count double for _only the first turn they are
in melee,_ and there are two restrictions on reinforcements:
+ When troops defending a front, with at least one figure per 6"; or
when defenders are infantry in line formation, only one infantry
figure per 1" or one cavalry figure per 3" may attack. This is the
advantage of presenting a solid front to the enemy. However, if a
tie is thrown in resolving a melee, the solid front is broken.
+ Troops who outnumber another side in melee more than 4:1 do not
count towards the melee odds. No more than four troops may attack
one troop as it pertains to melee resolution.
Troops who are involved in a melee may be given these orders:
/ Hold: If the troops win the melee, they will hold position and not
pursue.
/ Pursue: If the troops win the melee, they will pursue.
/ Withdraw _x_ and form _y_: Where _x_ is "to (landmark)" or is a
distance and direction; and _y_ is a formation the troops may form.
Troops retreat at the start of the turn. The effect on morale for
both sides is the same as if a difference of three was thrown on
Table T. If the opposing side was ordered to pursue, they will
pursue now. The fleeing side will move as indicated and adopt the
formation indicated; should they be intercepted before forming up,
the consequences will be severe (see *Pursuit*). Part of a side may
withdraw; in this case, the victory conditions only apply to the
part that withdrew and to a corresponding amount of enemy
troops. Melee continues if some troops from both sides remain in it.
Melees are resolved as charges using Table S to calculate odds;
however, cases 2, 4, 10, 11, 12, and 13 are ignored; and cases 14, 15,
and 16 only apply if the defender has an unbroken formation.
Troops withdrawing or fleeing from a defeat get a #frac(1, 6) turn
head start.
= Pursuit
After a charge or melee where the result on Table T was three or more,
a pursuit must be completed for prisoners to be taken. If a pursuit
is not carried out, the defeated side's morale only drops to *In
Disorder* and it is unable to advance towards enemy troops for ten
turns.
Otherwise, the full effects take place on the pursued starting after a
#frac(1, 2) turn of pursuit by a side which is at least a third the
size of the pursued. As pursuit continues (for 5---10 turns depending
on the result), a proportional amount of the *Missing* troops on the
losing side are captured by the pursuers each turn. The pursuing
troops may only take one prisoner each, and no more than #frac(1, 10)
or #frac(1, 20) per turn depending on the magnitude of victory.
If the pursuers catch up to the pursued, a new attack is carried out;
the pursued suffer the following consequences on Table S:
- For infantry:
- For cavalry:
If escape is blocked by impassable terrain, the pursued are entirely
*Routed* and captured.
If escape is impeded by terrain that slows movement, every member of
the pursuing force that does not already have a prisoner takes a
prisoner; remaining troops escape through the obstacle and are *Routed*.
Pursuit ends if:
- The pursuers are blocked by terrain or by other enemies
- The pursuers are reduced to below a third the size of the pursued
- The pursued are able to halt for one turn without the pursuers
catching them.
= Probabilities
*Table K* provides a way to resolve simple chances using one ordinary
six-sided die. *Table J* provides a way to resolve chances using a
twelve-sided die or two six-sided dice (1d66). Rolls for ratios which
resist being rationalized (e.g. 59:47) can be either simplified by
rounding up or down; or by using a jar or bag of marbles, dice, chits
etc. of two different colors. Or, percentile dice can be used.
#set page(columns: 1)
= Table J --- Possibilities
Roll 1d12 _or_ 1d66; result shown by letter.
#let rrc = table.cell(stroke: 1pt, [X])
#table(
align: center+horizon,
gutter: auto,
column-gutter: (
auto,
1.5pt,
auto,
auto,
auto,
auto,
auto,
1.5pt,
auto,
),
columns: (
1fr,
auto,
1fr,
1fr,
1fr,
1fr,
1fr,
1fr,
1fr,
1fr,
1fr,
1fr,
1fr,
1fr,
),
table.header(
[Odds of A],
[P(!A)],
[1 11-13],
[2 14-16],
[3 21-23],
[4 24-26],
[5 31-33],
[6 34-36],
[7 41-43],
[8 44-46],
[9 51-53],
[10 54-56],
[11 61-63],
[12 64-66],
),
[1:1 (6:6)], [6 in 12], [B], [B], [B], [B], [B], [B], [A], [A], [A], [A], [A], [A],
[7:5], [5 in 12], [B], [B], [B], [B], [B], [A], [A], [A], [A], [A], [A], [A],
[2:1 (8:4)], [4 in 12], [B], [B], [B], [B], [A], [A], [A], [A], [A], [A], [A], [A],
[3:1 (9:3)], [3 in 12], [B], [B], [B], [A], [A], [A], [A], [A], [A], [A], [A], [A],
[5:1 (10:2)], [2 in 12], [B], [B], [A], [A], [A], [A], [A], [A], [A], [A], [A], [A],
[11:1], [1 in 12], [B], [A], [A], [A], [A], [A], [A], [A], [A], [A], [A], [A],
[6:5], [5 in 11], [B], [B], [B], [B], [B], [A], [A], [A], [A], [A], [A], rrc,
[7:4], [4 in 11], [B], [B], [B], [B], [A], [A], [A], [A], [A], [A], [A], rrc,
[8:3], [3 in 11], [B], [B], [B], [A], [A], [A], [A], [A], [A], [A], [A], rrc,
[9:2], [2 in 11], [B], [B], [A], [A], [A], [A], [A], [A], [A], [A], [A], rrc,
[10:1], [1 in 11], [B], [A], [A], [A], [A], [A], [A], [A], [A], [A], [A], rrc,
[3:2 (6:4)], [4 in 10],
[B], [B], [B], [B], [A], [A], [A], [A], [A], [A], rrc, rrc,
[7:3], [3 in 10],
[B], [B], [B], [A], [A], [A], [A], [A], [A], [A], rrc, rrc,
[4:1 (8:2)], [2 in 10],
[B], [B], [A], [A], [A], [A], [A], [A], [A], [A], rrc, rrc,
[9:1], [1 in 10],
[B], [A], [A], [A], [A], [A], [A], [A], [A], [A], rrc, rrc,
[5:4], [4 in 9],
[B], [B], [B], [B], [A], [A], [A], [A], [A], rrc, rrc, rrc,
[7:2], [2 in 9],
[B], [B], [A], [A], [A], [A], [A], [A], [A], rrc, rrc, rrc,
[8:1], [1 in 9],
[B], [A], [A], [A], [A], [A], [A], [A], [A], rrc, rrc, rrc,
[5:3], [3 in 8],
[B], [B], [B], [A], [A], [A], [A], [A], rrc, rrc, rrc, rrc,
[7:1], [1 in 8],
[B], [A], [A], [A], [A], [A], [A], [A], rrc, rrc, rrc, rrc,
[4:3], [3 in 7],
[B], [B], [B], [A], [A], [A], [A], rrc, rrc, rrc, rrc, rrc,
[5:2], [2 in 7],
[B], [B], [A], [A], [A], [A], [A], rrc, rrc, rrc, rrc, rrc,
[6:1], [1 in 7],
[B], [A], [A], [A], [A], [A], [A], rrc, rrc, rrc, rrc, rrc,
)
= Table K --- Possibilities
Roll 1d6; result shown by letter.
#table(
align: center+horizon,
gutter: auto,
column-gutter: (
auto,
1.5pt,
auto,
auto,
1.5pt,
auto,
),
columns: (
1fr,
auto,
1fr,
1fr,
1fr,
1fr,
1fr,
1fr,
),
table.header(
[Odds of A],
[P(!A)],
[1],
[2],
[3],
[4],
[5],
[6],
),
[1:1 (3:3)], [3 in 6], [B], [B], [B], [A], [A], [A],
[2:1 (4:2)], [2 in 6], [B], [B], [A], [A], [A], [A],
[5:1], [1 in 6], [B], [A], [A], [A], [A], [A],
[3:2], [2 in 5], [B], [B], [A], [A], [A], rrc,
[4:1], [1 in 5], [B], [A], [A], [A], [A], rrc,
[3:1], [1 in 4], [B], [A], [A], [A], rrc, rrc,
)
#align(center)[
*A* --- Favored result occurs;
*B* --- Favored result does not occur;
*X* --- Re-roll.
]
= Table M --- <NAME> (In Figures)
#table(
align: center,
column-gutter: (
2.2pt,
auto,
2.2pt,
auto,
2.2pt,
auto,
),
gutter: auto,
fill: alt-fill,
columns: (
3fr,
1fr,
1fr,
1fr,
1fr,
1fr,
1fr,
),
table.header(
table.cell(rowspan: 2)[Number of Figures Shooting\
#h(1fr)1d6:],
table.cell(colspan: 2)[LF or LH],
table.cell(colspan: 2)[HF or MH],
table.cell(colspan: 2)[AF or HH],
[*1---2*],
subheader()[*3---6*],
[*1---3*],
subheader()[*4---6*],
[*1---4*],
subheader()[*5---6*]
),
table.hline(),
[1---2], [0.5], [1], [0.25], [0.5], [0.25], [0.5],
[3], [1], [2], [0.5], [1], [0.25], [0.5],
[4], [1], [2], [0.5], [1], [0.5], [1],
[5---6], [2], [3], [2], [2], [0.5], [1],
[7---8], [3], [4], [2], [3], [0.5], [1],
[9---12], [4], [5], [3], [3], [1], [2],
[13---16], [4], [5], [3], [3], [2], [3],
[17---20], [4], [5], [3], [3], [3], [3],
)
= Table R --- Missile Multipliers
#table(
align: (
left,
left,
left,
left,
),
columns: (
auto,
auto,
auto,
auto,
),
fill: none,
stroke: none,
gutter: auto,
row-gutter: 1em,
column-gutter: (
0em,
1em,
),
table.header(
table.cell(colspan: 2)[Class/Description],
table.cell(align:center)[Result],
table.cell(align:center)[Notes],
),
[1.],
table.cell(align:right)[Morale: #h(1fr)*Enthusiastic:*\
*Flushed With Victory:*\
*Normal:*\
*Somwhat Shaken:*\
*Shaken:*\
*Badly Shaken:*\
*In Disorder:*\
*In Great Confusion:*\
*Routed:*
],
[#(sym.times)#frac(4,5)\
#(sym.times)1\
#(sym.times)1\
#(sym.times)#frac(1,2)\
#(sym.times)#frac(1,3)\
#(sym.times)#frac(1,5)\
#(sym.times)#frac(1,10)\
#(sym.times)0\
#(sym.times)0],
[See below.],
[2.],
[Under attack (charged, being fired upon)],
[#(sym.times)#frac(2, 3)],
[Only if morale is *Normal* or lower.],
[3.],
[Range less than #frac(1,3) listed\
Range less than #frac(2, 3) listed],
[#(sym.times)#frac(2, 1)\
#(sym.times)#frac(3, 2)],
table.cell(align: left+horizon)[
Any further than listed range is ineffective. Do not apply
these bonuses for indirect fire.
],
[4.],
[Target is infantry column],
[#(sym.times)2],
[],
[5.],
[Second line of target, within 5"],
[#(sym.times)#frac(2, 3)],
[i.e. a target behind another],
[6.],
[When attacking troops are in cover],
[#(sym.times)2],
[From within building or behind defense --- but not woods/hedges.],
[7.],
[Aimed/Prepared\
Longbows\
Other missiles],
[\
#(sym.times)3\
#(sym.times)2],
[],
[8.],
[Target has stone cover (crenellations, arrow slit, etc.)],
[#(sym.times)#frac(1, 10)],
table.cell(align: left+horizon, rowspan: 2)[
Both assume target is not fully covered for whole turn. Does
not apply if missile troops are able to conduct indirect fire.
],
[9.],
[Target has wooden cover (palisade; archer or arbalist's pavise; etc.)],
[#(sym.times)#frac(1, 4)],
[10.],
[Target in woods, but still visible],
[#(sym.times)#frac(1, 2)],
[If out of sight, #(sym.times)0.],
)
#pagebreak()
#set page(footer: context {
[#counter(page).display(
"1"
)
#h(1fr)]})
= Table S --- Melee/Charge Multipliers
#grid(
columns: (
1fr,
1fr,
),
column-gutter: 2.1em,
grid(
align: (
left,
left,
left,
),
columns: (
auto,
1fr,
auto,
),
fill: none,
stroke: none,
gutter: auto,
row-gutter: 1em,
column-gutter: (
0.5em,
1em,
0em,
),
[1.],
[Infantry attacked by infantry],
[#frac(3, 2) for defender],
[2.],
[Infantry line charged by cavalry\
Infantry column by cavalry],
[#frac(2, 1) for infantry\
#frac(1, 1)],
[3.],
[Infantry charging cavalry\
Cavalry charging open infantry\
Cav. charging infantry forming up],
[#frac(5,1) for cavalry\
#frac(5,1) for cavalry\
#frac(5,1) for cavalry],
[4.],
[Cavalry attacked by cavalry &\
Charging attackers\
Not charging],
[\
#frac(1, 1)\
#frac(12, 1) for attackers],
[5.],
[Infantry fighting cavalry that cannot charge, or that is in
thick/heavy woods, water over 3', in town, or engaged in melee.],
[#frac(4, 1) for infantry],
[6.],
[Eliteness 5 (Campaigner)\
Eliteness 4 (Veteran)\
Eliteness 3 (Regular)\
Eliteness 2 (Experienced)\
Eliteness 1 (Green)],
[#(sym.times)5\
#(sym.times)4\
#(sym.times)3\
#(sym.times)2\
#(sym.times)1],
[7.],
[*Fresh* (10 turns out of action) vs *Not Fresh* (2 turns in
melee, or 10 turns moving no rest)],
[#frac(4, 3) for *Fresh*],
[8.],
grid.cell(align: right)[Troop strength: #h(1fr) Lights\
Heavy Infantry/Medium Horse\
Armored Infantry/Heavy Horse\
(Only 4 at a time may attack 1)],
[#(sym.times)1/man\
#(sym.times)2/man\
#(sym.times)3/man],
),
grid(
align: (
left,
left,
left,
),
columns: (
auto,
1fr,
auto,
),
fill: none,
stroke: none,
gutter: auto,
row-gutter: 1em,
column-gutter: (
0.5em,
1em,
0em,
),
[9.],
grid.cell(colspan: 2)[
Morale affects fighting efficiency --- see *Morale*.
],
[10.],
[Cavalry charging downnhill:\
*Gentle Slope*\
*Moderate Slope*],
[\
#frac(2, 1) vs cavalry\
#frac(4, 1) vs cavalry],
[11.],
[Troops attacked by surprise:\
#h(2em)Line\
#h(2em)Column\
#h(2em)Open (at least 3" apart)\
#h(2em)Charging etc.],
[\
#frac(3, 2) for attacker\
#frac(3, 1) for attacker\
#frac(2, 1) for attacker\
#frac(4, 1) for attacker],
[12.],
[Defenders who have repulsed an attack within 1 turn (applies
on subsequent turns of melee)\
#h(1fr)Attacked by infantry\
#h(1fr)Attacked by cavalry],
grid.cell(
align: left+bottom
)[#frac(3, 2) for attacker\
#frac(2, 1) for attacker],
[13.],
[Infantry moving (not charging) attacked by charging attackers.],
[#frac(2, 1) for charging],
[14.],
[Defenders on higher ground\
#h(2em)*Gentle Slope*\
#h(2em)*Moderate Slope*\
#h(2em)*Steep Slope*\
],
[\
#frac(3, 2) for defenders\
#frac(3, 1) for defenders\
#frac(6, 1) for defenders],
[15.],
grid.cell(colspan: 2)[
Troops in cover attacked from outside that cover gain a
multiplier to their defense, as missiles.
],
[16.],
[Troops attacking from:\
Flank\
Rear],
[\
#frac(2, 1) for attacker\
#frac(3, 1) for attacker],
)
)
= Table T --- Results of Melees and Charges
#table(
gutter: auto,
stroke: none,
row-gutter: 0.6em,
fill: none,
align: center+horizon,
columns: (
0.94fr,
auto,
1fr,
),
table.header(
[Winning Side],
[Difference \
in Dice],
[Losing Side],
),
[No effect; fighting continues.],
[0],
[No effect; fighting continues.],
[Troops *Shaken,* & may not attack for 5 turns],
[1],
[Troops *Shaken,* & may not attack for 5 turns],
[Troops *Shaken,* & may not attack for 5 turns],
[2],
[Troops *In Disorder,* & may not attack for 10 turns],
[Troops *Normal,* & may pursue the enemy for 5 turns to take ¼
prisoner. If they are attacked while pursuing, odds are 3:2 as
they are disorganized. After this pursuit, they must take 5 turns
to reorganize.],
[3],
[Troops *In Disorder,* & may not attack for 10 turns. If pursued,
¼ of troops are *Missing*, the rest are *Routed*.],
[Troops *Flushed With Victory,* & may pursue for 10 turns, taking
½ the enemy prisoner.],
[4],
[Troops *In Disorder,* & are out of order for 10 turns. If pursued,
all troops are *Missing*.],
[Troops *Enthusiastic,* & may pursue for 10 turns, taking all
remaining enemies prisoner.],
[5+],
[Troops *In Disorder,* & are out of order for 10 turns. If pursued,
all troops surrender.],
)
#pagebreak()
#set page(margin: (y: 1cm, x: 3cm), footer: none)
#set heading(bookmarked: true, outlined: false)
#v(1fr)
= Credits
#v(2em)
Based on _Strategos: The American Game of War,_ by <NAME>; _Valley Forge_ by <NAME> was also consulted, as were
fragments of Wesely's _Valley Forge II_ and \
_Strategos N_ and of <NAME>'s _Strategos A._
Table M is based on _Chainmail_ by <NAME> & <NAME>.
Fonts used are all licensed OFL 1.1, with the following copyright notices:
- *Title/byline:* Old Cupboard --- Copyright 2019 <NAME>\
#h(14em) (https://www.coneofnegativeenergy.com)
- *Subtitle:* Combat --- By <NAME>, 2015.
- *Headers:* Cooper\* --- Copyright 2024 The Cooper\* Project Authors\
#h(10em) (https://github.com/indestructibletype/Cooper)
- *Body text:* Hyde --- Copyright 2008 by <NAME>
Cover image (medieval battle) and image on page 5 (charging knight)
are from public domain sources.
The Olivia Hill Rule is by Olivia Hill, from the game _\#iHunt_,
licensed CC-BY-SA 3.0.
Thank you to the many many internet sources who have helped me
understand Strategos and wargames at large.
#v(1fr)
#pagebreak()
#set page(margin: (y: 6.5cm, x: 3cm))
#align(center+horizon)[
= Order Abbreviations
#v(4em)
#columns(2)[
#grid(
columns: (
auto,
1fr,
),
align: left,
gutter: auto,
column-gutter: 2em,
row-gutter: 1em,
[ADV#emph()[n]], [Advance _n_ inches],
[AF], [About Face],
[AIM#emph()[t]], [Take aim at _t_],
[AVT#emph()[l]], [Advance towards landmark _l_],
[BWL#emph()[n]], [Back wheel left _n_ inches],
[BWR#emph()[n]], [Back wheel right _n_ inches],
[CCL], [Close to column left],
[CCR], [Close to column right],
[CHG#emph()[t]], [Charge at target _t_],
[CLL], [Close to line left],
[CLR], [Close to line right],
[CL#emph()[n]], [Close left _n_ inches],
[CR#emph()[n]], [Close right _n_ inches],
[DMT], [Dismount],
[DT], [Doubletime or gallop],
[FCL], [Form column left],
[FCR], [Form column right],
[FLL], [Form line left],
[FLR], [Form line right],
[FW#emph()[nt]], [Follow _n_ inches behind target _t_],
[LS], [Loose],
[LS#emph()[t]], [Loose at target _t_],
[MNT], [Mount],
[MV#emph()[nd]], [Move _n_ inches in direction _d_],
[MV#emph()[nl]], [Move _n_ inches along landmark _l_],
[MVT#emph()[l]], [Move to landmark _l_],
[OML#emph()[n]], [Oblique march left _n_ inches],
[OMR#emph()[n]], [Oblique march right _n_ inches],
[QT], [Quicktime or trot],
[REST], [Halt and rest],
[RL], [Reload crossbows],
[RR#emph()[n]], [Retire _n_ inches],
[RNF#emph()[t]], [Reinforce friendly target _t_],
[SML], [Split-move-loose],
[WLL#emph()[n]], [Wheel left _n_ inches],
[WLR#emph()[n]], [Wheel right _n_ inches],
[XL#emph()[n]], [Extend to left, _n_ inches],
[XR#emph()[n]], [Extend to right, _n_ inches],
)
]
]
|
https://github.com/frectonz/the-pg-book | https://raw.githubusercontent.com/frectonz/the-pg-book/main/book/083.%20startuphubs.html.typ | typst | startuphubs.html
Why to Move to a Startup Hub
October 2007After the last
talk I gave, one of the organizers
got up on the
stage to deliver an impromptu rebuttal. That never happened before.
I only heard the first few sentences, but that was enough to tell
what I said that upset him: that startups would do better if they
moved to Silicon Valley.This conference was in London, and most of the audience seemed to
be from the UK. So saying startups should move to Silicon Valley
seemed like a nationalistic remark: an obnoxious American telling
them that if they wanted to do things right they should all just
move to America.Actually I'm less American than I seem. I didn't say so, but I'm
British by birth. And just as Jews are ex officio allowed to tell
Jewish jokes, I don't feel like I have to bother being diplomatic
with a British audience.The idea that startups would do better to move to Silicon Valley
is not even a nationalistic one.
[1]
It's the same thing I say to
startups in the US. Y Combinator alternates between coasts every
6 months. Every other funding cycle is in Boston. And even though
Boston is the second biggest startup hub in the US (and the world),
we tell the startups from those cycles that their best bet is to
move to Silicon Valley. If that's true of Boston, it's even more
true of every other city.This is about cities, not countries.And I think I can prove I'm right. You can easily reduce the
opposing argument ad what most people would agree was absurdum.
Few would be willing to claim that it doesn't matter at all where
a startup is—that a startup operating out of a small agricultural
town wouldn't benefit from moving to a startup hub. Most people
could see how it might be helpful to be in a place where there was
infrastructure for startups, accumulated knowledge about how to
make them work, and other people trying to do it. And yet whatever
argument you use to prove that startups don't need to move from
London to Silicon Valley could equally well be used to prove startups
don't need to move from smaller towns to London.The difference between cities is a matter of degree. And if, as
nearly everyone who knows agrees, startups are better off in Silicon
Valley than Boston, then they're better off in Silicon Valley than
everywhere else too.I realize I might seem to have a vested interest in this conclusion,
because startups that move to the US might do it through Y Combinator.
But the American startups we've funded will attest that I say the
same thing to them.I'm not claiming of course that every startup has to go to Silicon
Valley to succeed. Just that all other things being equal, the
more of a startup hub a place is, the better startups will do there.
But other considerations can outweigh the advantages of moving.
I'm not saying founders with families should uproot them to move
halfway around the world; that might be too much of a distraction.Immigration difficulties might be another reason to stay put.
Dealing with immigration problems is like raising money: for some
reason it seems to consume all your attention. A startup can't
afford much of that. One Canadian startup we funded spent about 6
months working on moving to the US. Eventually they just gave up,
because they couldn't afford to take so much time away from working
on their software.(If another country wanted to establish a rival to Silicon Valley,
the single best thing they could do might be to create a special
visa for startup founders. US immigration policy is one of Silicon
Valley's biggest weaknesses.)If your startup is connected to a specific industry, you may be
better off in one of its centers. A startup doing something related
to entertainment might want to be in New York or LA.And finally, if a good investor has committed to fund
you if you stay where you are, you should probably stay. Finding
investors is hard. You generally shouldn't pass up a definite
funding offer to move.
[2]In fact, the quality of the investors may be the main advantage of
startup hubs. Silicon Valley investors are noticeably more aggressive
than Boston ones. Over and over, I've seen startups we've funded
snatched by west coast investors out from under the noses of Boston
investors who saw them first but acted too slowly. At this year's
Boston Demo Day, I told the audience that this happened every year,
so if they saw a startup they liked, they should make them an offer.
And yet within a month it had happened again: an aggressive west
coast VC who had met the founder of a YC-funded startup a week
before beat out a Boston VC who had known him for years. By the
time the Boston VC grasped what was happening, the deal was already
gone.Boston investors will admit they're more conservative. Some want
to believe this comes from the city's prudent Yankee character.
But Occam's razor suggests the truth is less flattering. Boston
investors are probably more conservative than Silicon Valley investors
for the same reason Chicago investors are more conservative than
Boston ones. They don't understand startups as well.West coast investors aren't bolder because they're irresponsible
cowboys, or because the good weather makes them optimistic. They're
bolder because they know what they're doing. They're the skiers
who ski on the diamond slopes. Boldness is the essence of venture
investing. The way you get big returns is not by trying to avoid
losses, but by trying to ensure you get some of the big hits. And
the big hits often look risky at first.Like Facebook. Facebook was started in Boston. Boston VCs had the
first shot at them. But they said no, so Facebook moved to Silicon
Valley and raised money there. The partner who turned them down
now says that "may turn out to have been a mistake."Empirically, boldness wins. If the aggressive ways of west coast
investors are going to come back to bite them, it has been a long
time coming. Silicon Valley has been pulling ahead of Boston since
the 1970s. If there was going to be a comeuppance for the west
coast investors, the bursting of the Bubble would have been it.
But since then the west coast has just pulled further ahead.West coast investors are confident enough of their judgement to act
boldly; east coast investors, not so much; but anyone who thinks
east coast investors act that way out of prudence should see the
frantic reactions of an east coast VC in the process of losing a
deal to a west coast one.In addition to the concentration that comes from specialization,
startup hubs are also markets. And markets are usually centralized.
Even now, when traders could be anywhere, they cluster in a few
cities. It's hard to say exactly what it is about face to face
contact that makes deals happen, but whatever it is, it hasn't yet
been duplicated by technology.Walk down University Ave at the right time, and you might overhear
five different people talking on the phone about deals. In fact,
this is part of the reason Y Combinator is in Boston half the time:
it's hard to stand that year round. But though it can sometimes
be annoying to be surrounded by people who only think about one
thing, it's the place to be if that one thing is what you're trying
to do.I was talking recently to someone who works on search at Google.
He knew a lot of people at Yahoo, so he was in a good position to
compare the two companies. I asked him why Google was better at
search. He said it wasn't anything specific Google did, but simply
that they understood search so much better.And that's why startups thrive in startup hubs like Silicon Valley.
Startups are a very specialized business, as specialized as diamond
cutting. And in startup hubs they understand it.
Notes[1]
The nationalistic idea is the converse: that startups should
stay in a certain city because of the country it's in. If you
really have a "one world" viewpoint, deciding to move from London
to Silicon Valley is no different from deciding to move from Chicago
to Silicon Valley.[2]
An investor who merely seems like he will fund you, however,
you can ignore. Seeming like they will fund you one day is the way
investors say No.Thanks to <NAME>, <NAME>, <NAME>, and <NAME> for reading drafts of this.
Comment on this essay.Japanese Translation
|
|
https://github.com/stepbrobd/cv | https://raw.githubusercontent.com/stepbrobd/cv/master/main.typ | typst | MIT License | #import "cv.typ": *
#show: cv.with(
contact: (
name: "<NAME>", phone: "+18014338213", email: "<EMAIL>", orcid: "0000-0002-1591-7458",
), address: (
line1: "214 WVH", line2: "440 Huntington Ave", city: "Boston", state: "MA", zip: "02115",
), links: (
(display: "ysun.co", url: "https://ysun.co"), (display: "github.com/stepbrobd", url: "https://github.com/stepbrobd"), (
display: "linkedin.com/in/yifei-s", url: "https://www.linkedin.com/in/yifei-s",
),
),
)
#section(name: "Research Interests")[
#interests[
- Formal verifications on distributed systems.
- Type theory and managed runtime systems.
- Reproducible build systems.
]
]
#section(
name: "Education",
)[
#education(
institution: "Northeastern University", degree: "M.Sc. in Computer Science", attended: "2023/09 - 2025/04", location: "Boston, MA, USA",
)[
Google CSRMP Fellow, 2023b. NixOS Foundation SoN #link("https://github.com/ngi-nix/ngipkgs")[NGIpkgs] Working
Group, 2024.
Member of the #link("https://srg.khoury.northeastern.edu")[Systems Research Group],
Advisor: #link("https://www.jiyongshin.info")[Ji-Yong Shin].
]
#education(
institution: "University of Utah", degree: "B.Sc. in Computer Science", attended: "2019/08 - 2023/05", location: "Salt Lake City, UT, USA",
)[
Academic Excellence Scholarship, 2019-2023.
Thesis: #link(
"https://ysun.co/assets/static/doc/bt.pdf",
)[System and Methods to Determine ME/CFS & Long COVID Disease Severity Using
Wearable Sensor & Survey Data].
Member of the #link("https://iss.mech.utah.edu")[Integrated Self-Powered Sensing Lab],
Advisor: #link("https://iss.mech.utah.edu/shad-roundy")[<NAME>],
Co-advisor: #link("https://robot-learning.cs.utah.edu/thermans")[<NAME>].
]
]
#section(
name: "Employment",
)[
#employment(
position: "Research Intern", company: "University of Tokyo", worked: "2024/05 - 2024/09",
)[
- Advised under #link("https://tugawa.github.io/index-e.html")[Tomoharu Ugawa] at
the #link("https://www.csg.ci.i.u-tokyo.ac.jp/en")[Computing Software Group],
created a framework to apply genetic algorithm with multiple built-in libraries
to improve bytecode handler performance in interpreters (e.g. eJSVM, Ruby, Lua).
- Improved and reproduced the method proposed in #link(
"https://dl.acm.org/doi/abs/10.1145/3555776.3577712",
)[Huang et al. SAC '23], making the framework to be implementation/interpreter
agnostic. Initial evaluation showed \~7.5% performance improvement on both eJSVM
and Ruby.
]
#employment(
position: "Teaching Assistant", company: "Northeastern University", worked: "2024/01 - 2024/05",
)[
- Graduate TA for #link(
"https://3700.network/docs/syllabus",
)[CS 3700 - Networks and Distributed Systems] (\~200 enrolled students):
Responsible for hosting office hours, course infrastructure setup/maintenance
(autograder setup and debugging), and grading assignments.
- Topics including routing, congestion control, network security, and distributed
protocols like NTP and Raft, and general asynchronous network programming with
Python, Haskell, and Go.
]
#employment(
position: "Research Assistant", company: "University of Utah", worked: "2021/08 - 2023/05",
)[
- Joint research project in collaboration with the Bateman Horne Center's clinical
research team, developed and managed a new data collection infrastructure,
bringing the overall data collection error rate down to sub 0.25%.
- The infrastructure aggregats 100+ IMUs, multiple single-board computers and
high-performance servers, collected terabyte-level motion data, then applied
sensor fusion, motion analysis, and machine learning techniques on collected
time-series and survey data.
]
#employment(
position: "System Administrator", company: "University of Utah", worked: "2019/12 - 2020/09",
)[
- Enterprise system administration, managed 1000+ university-owned
iOS/iPadOS/macOS/tvOS, Windows, and Linux systems.
- Created multiple automation tools to perform multi-platform unattended
on-boarding, off-boarding, package licensing, updates, and distributions.
]
#employment(
position: "Intern", company: "DJI", worked: "2018/07 - 2018/08",
)[
- Champion of the 2018 DJI RoboMaster Summer Camp Competition.
- Competitive robotic system design/modeling, embedded system programming, control
system programming, and computer vision, led two teams of 5 to design and build
a STM32F4 based robotic system to perform predefined tasks.
]
]
#section(
name: "Projects",
)[
#project(
name: "AS10779", display: "ysun.co/10779", url: "https://ysun.co/10779",
)[
- Operator of AS10779, #link("https://rdap.arin.net/registry/ip/23.161.104.0")[`172.16.58.3/24`] and #link(
"https://rdap.arin.net/registry/ip/2620:be:a000::",
)[`2620:BE:A000::/48`] (under ARIN).
- Experimental research network, tunneled peering with WireGuard served with
NixOS.
]
#project(
name: "Consistency", display: "github.com/stepbrobd/consistency", url: "https://github.com/stepbrobd/consistency-z3",
)[
- A verification tool for testing the compositional consistency guarantees of
distributed systems.
- Z3 based verification tool to axiomatically check the compositions of multiple
weak consistency semantics and the final semantics' theoretical consistency
guarantees and safety properties.
]
#project(
name: "Finch", display: "github.com/stepbrobd/finch", url: "https://github.com/stepbrobd/finch",
)[
- A genetic algorithm framework and visualizer written in Go.
- User-definable genetic algorithm configurations, including population size,
layer size (input, hidden, output), mutation rate, and training/testing data.
]
#project(
name: "SRD", display: "github.com/stepbrobd/srd", url: "https://github.com/stepbrobd/srd",
)[
- Proof of concept Go static race checker based on extracting structural
operational semantics rules and applying the rule sets to perform static race
detection.
- As a static race checker, false positives/negatives are expected. The detection
is done by a stateful traversal of provided Go source file's abstract syntax
tree.
]
]
#section(
name: "Skills",
)[
- *Programming Languages*: Nix, Go, Python, Haskell, C/C++, Shell, JS/TS, Coq,
Typst, LaTeX.
- *Tools*: Git, NixOS, Docker/Kubernetes, Bird2, WireGuard, Z3, Matplotlib,
Pandas, NumPy.
- *Languages*: English (native), Mandarin (native), Japanese (intermediate).
]
#section(
name: "Publications",
)[
#set enum(numbering: "[1]")
// #publications(path: "list.yml", bold: "Y. Sun")
+ *Y. Sun*, "System and Methods to Determine ME/CFS & Long COVID Disease Severity
Using Wearable Sensor & Survey Data", Bachelor's Thesis, University of Utah,
May. 2023.
+ *Y. Sun*, <NAME>, and <NAME>, "System and Method to Determine ME/CFS
and Long COVID Disease Severity Using a Wearable Sensor". International Journal
of Medical Informatics, Under Review. Jun. 2024.
https://arxiv.org/abs/2404.04345.
// + *Y. Sun*, <NAME>, <NAME>, <NAME>, <NAME>, <NAME>, <NAME>, "Oxaloacetate
// Reduces Physical and Cognitive Fatigue in a Subset of Myalgic
// Encephalomyelitis/Chronic Fatigue Syndrome (ME/CFS) Patients", Frontiers in
// Neuroscience - Fatigue: Physiology and Pathology, Volume II, Under Review. Sep.
// 2024.
]
|
https://github.com/jgm/typst-hs | https://raw.githubusercontent.com/jgm/typst-hs/main/test/typ/compiler/if-03.typ | typst | Other | // Value of if expressions.
// Ref: false
#{
let x = 1
let y = 2
let z
// Returns if branch.
z = if x < y { "ok" }
test(z, "ok")
// Returns else branch.
z = if x > y { "bad" } else { "ok" }
test(z, "ok")
// Missing else evaluates to none.
z = if x > y { "bad" }
test(z, none)
}
|
https://github.com/jamesrswift/dining-table | https://raw.githubusercontent.com/jamesrswift/dining-table/main/docs/manual.typ | typst | The Unlicense | #import "@preview/tidy:0.3.0"
#{
import "../src/lib.typ" as dining-table
let document-module(name, file) = tidy.parse-module(
read(file),
name: name,
scope: (dining-table: dining-table)
)
let lib = ("", "../src/lib.typ")
let impl = ("", "../src/impl.typ")
let styles = ("", "../src/styles.typ")
let note = ("note", "../src/note.typ")
for (name, file) in (lib, impl, styles, note){
tidy.show-module(
document-module(name, file),
style: tidy.styles.default,
)
}
}
|
https://github.com/polarkac/MTG-Stories | https://raw.githubusercontent.com/polarkac/MTG-Stories/master/stories/006%20-%20Magic%202014/004_Pride%20Cometh.typ | typst | #import "@local/mtgstory:0.2.0": conf
#show: doc => conf(
"Pride Cometh",
set_name: "Magic 2014",
story_date: datetime(day: 17, month: 07, year: 2013),
author: "<NAME>",
doc
)
Skrikkle wanted grubs.
Dried skrill slime was fine enough, but there came a time when a #emph[real] goblin needed grub meat to satisfy him, and Skrikkle was at that point.
#emph[Spit on this] . He slung his dried slime at Groggle and tromped out of the warren in a huff. He could hear Groggle and his warren-mates scrabbling and fighting for the castaway skrill-scraps as he stormed off.
Skrikkle's eyes squinted as he came out into the sunshine. Grubs were bloody hard to come by and Skrikkle would have to venture far out into the danger-danger land to get them, but he didn't care two rot slugs about it. He was eating grub meat tonight or there was going to be trouble. Big trouble.
Skrikkle grabbed his digging stick and his leather cap and put on his grub-hunting boots. He was going out solo.
Other goblins knew to stay out of his way as Skrikkle stormed out into the rocks and rubble of their mountain hidey-hole. They had seen Skrikkle in this kind of mood before and didn't want to face his wrath, or that digging stick of his—the one with the maulhorn tooth tied on it—the stick that was the stuff of legend.
#figure(image("004_Pride Cometh/01.jpg", width: 100%), caption: [], supplement: none, numbering: none)
It just so happened that Skrikkle's great-grandpap Snurkle had come back from the danger-danger land one night, covered in blood. Clutched in his arms was an enormous, razor-sharp tooth that gleamed in the moonlight. Snurkle muttered something about pulling it from a maulhorn's jaw before Snurkle fell into a deep sleepy-sleep, but not the kind of sleepy-sleep that goblins don't wake up from. No deadlands for Old Snurkle. Not then.
Of course, plots and covetousness buzzed about the warren about the amazing tooth and its rumored powers, but Snurkle was the toughest of tough goblins and even in a deep sleepy-sleep his reputation was one to be feared. When he awoke, the gob-clan wondered what he was going to do with the tooth. Some said it had magical properties that could cure itchy places. Some said it could shoot fire and cook a brindle boar in a flash. Others said it was a god of the old gobs and must be worshipped with grits and petal bugs.
But Skrikkle's great-grandpap had other ideas.
"This tooth's fer grubbin'," he growled.
A gasp went through the warren as Snurkle took the tooth and tied it to his own great-grandpap's hickory stick, gave it two taps, nodded with stern approval at his work, and set off at a brisk pace to the danger-danger land.
So when Skrikkle set out, he knew darn well that the fires of Snurkle the Grub Hunter burned in his veins. No goblin had hunted grubs since that time.
No goblin had dared.
Wurms defended their grubs violently and could smell a goblin from a good distance, whether they were above or below ground. A grub hunter had to know the signs, listen for the sounds, and smell the signals. But there were other prizes to be had out in the danger-danger land. There would be nothing that Skrikkle would want more than to get himself a tusker tusk.
#figure(image("004_Pride Cometh/02.jpg", width: 100%), caption: [], supplement: none, numbering: none)
That would get him some respect and wipe that smug smirk off of Grooble's face. Grooble fancied himself as a big muck-a-muck and Skrikkle didn't like Grooble one bit. He had watched Grooble fingering his rusty blade from time to time. Something in Grooble's sneering face and beady eyes made Skrikkle keep a good lookout for the crook-legged goblin. Grooble was getting dangerous ideas and there was nothing more unpredictable than a goblin with a dangerous idea.
Skrikkle walked over boulders and through small canyons. He was going to dig up a grub—by gob—haul it back to the warren, be welcomed with adulation, eat like a king, tell some tales, drink some fizz-fizz. Then he would shove his maulhorn-toothed digging stick into Grooble's guts. And then he would go have a nice sleepy-sleep, and be done with it.
It was a long trek, and Skrikkle used every sense his goblin brain had at its disposal. Goblins usually travelled in gangs because a lone goblin out in the danger-danger land was an easy snack, and Skrikkle knew it. He wasn't a pushover by a long shot. Skrikkle had wiry tough hide, sharp teeth, and a keen sniffer, but he knew that if getting skrill slime was dangerous work, hauling in a good-sized grub by himself was going to be a tall order. He'd have to watch it.
But Skrikkle's walnut brain was filled with terrible thoughts. He felt the smooth wooden shaft of the digging stick under his thick fingers. He felt he was destined to rule. The weight of the maulhorn tooth gave him a certain sense of authority. #emph[He] had the stick that no other goblin could even dream of. Sure, Grooble had his knife that was the envy of every goblin, including Skrikkle, but it did not have the impressive impact or ancestral value that Skrikkle's stick had. This stick was power and it made Skrikkle somehow... better... than all the other goblins. Maybe it was given to him by the old gobs.
A small smirk began to creep across Skrikkle's face.
He liked the feeling of being better than everyone else.
Skrikkle's mind began to work feverishly as he invented and created a world to support his new-found identity. He would be king. No more skrill slime. He would hurl hundreds of his unwashed brethren at the grub fields to bring back their succulent meat to his table. He would make the rules and say the loud words that would send his lessers scurrying to their whelping mats like sniveling drip weevils.
It would be glorious.
Skrikkle would be king and even the danger-danger land would tremble at the sight of him and his ancestral digging stick of power—power that he alone would wield. His hand tightened around the stick. No one would ever get this stick from him and, if they tried, they'd get a gutful of tooth on a stick.
Skrikkle imagined Grooble's face before him, grinning like a scumhog.
"Oh, really?" Skrikkle said out loud to an imaginary Grooble. "You think you can take me with your knife?" Skrikkle said the "your" with extra venom.
Skrikkle leveled his stick with the gleaming maulhorn tooth at a wall of boulders, one of which was now a grinning imaginary Grooble.
Skrikkle dodged a knife thrust from a clumsy and inferior imaginary Grooble.
"Ha! Foolish stink-bag!" Skrikkle twirled about and swung his stick, knocking the knife from imaginary-Grooble's hand. "Now you see, Grooble, why you are not fit to lead. Nor are you fit to live!" Skrikkle screamed and lunged in with his stick and was impressed with not only his masterful stick-work but his devastating wit. He really stuck it to imaginary Grooble and it felt good. Really good.
So good that he didn't notice the rumbling sensation from the earth, nor the massive, foot-shaped object that now cast a shadow over him and imaginary-Grooble's pathetic corpse.
There was a thunderous impact, and with it faded the echoes and vain hopes born of madness.
#figure(image("004_Pride Cometh/03.jpg", width: 100%), caption: [], supplement: none, numbering: none)
|
|
https://github.com/frectonz/the-pg-book | https://raw.githubusercontent.com/frectonz/the-pg-book/main/book/127.%20future.html.typ | typst | future.html
The Future of Startup Funding
Want to start a startup? Get funded by
Y Combinator.
August 2010Two years ago I
wrote about what I called "a huge, unexploited
opportunity in startup funding:" the growing disconnect between
VCs, whose current business model requires them to invest large
amounts, and a large class of startups that need less than they
used to. Increasingly, startups want a couple hundred thousand
dollars, not a couple million.
[1]The opportunity is a lot less unexploited now. Investors have
poured into this territory from both directions. VCs are much more
likely to make angel-sized investments than they were a year ago.
And meanwhile the past year has seen a dramatic increase in a new
type of investor: the super-angel, who operates like an angel, but
using other people's money, like a VC.Though a lot of investors are entering this territory, there is
still room for more. The distribution of investors should mirror
the distribution of startups, which has the usual power law dropoff.
So there should be a lot more people investing tens or hundreds of
thousands than millions.
[2]In fact, it may be good for angels that there are more people doing
angel-sized deals, because if angel rounds become more legitimate,
then startups may start to opt for angel rounds even when they
could, if they wanted, raise series A rounds from VCs. One reason
startups prefer series A rounds is that they're more prestigious.
But if angel investors become more active and better known, they'll
increasingly be able to compete with VCs in brand.Of course, prestige isn't the main reason to prefer a series A
round. A startup will probably get more attention from investors
in a series A round than an angel round. So if a startup is choosing
between an angel round and an A round from a good VC fund, I usually
advise them to take the A round.
[3]But while series A rounds aren't going away, I think VCs should be
more worried about super-angels than vice versa. Despite their
name, the super-angels are really mini VC funds, and they clearly
have existing VCs in their sights.They would seem to have history on their side.
The pattern here seems the same
one we see when startups and established companies enter a new
market. Online video becomes possible, and YouTube plunges right
in, while existing media companies embrace it only half-willingly,
driven more by fear than hope, and aiming more to protect their
turf than to do great things for users. Ditto for PayPal. This
pattern is repeated over and over, and it's usually the invaders
who win. In this case the super-angels are the invaders. Angel
rounds are their whole business, as online video was for YouTube.
Whereas VCs who make angel investments mostly do it as a way to
generate deal flow for series A rounds.
[4]On the other hand, startup investing is a very strange business.
Nearly all the returns are concentrated in a few big winners. If
the super-angels merely fail to invest in (and to some extent
produce) the big winners, they'll be out of business, even if they
invest in all the others.VCsWhy don't VCs start doing smaller series A rounds? The sticking
point is board seats. In a traditional series A round, the partner
whose deal it is takes a seat on the startup's board. If we assume
the average startup runs for 6 years and a partner can bear to be
on 12 boards at once, then a VC fund can do 2 series A deals per
partner per year.It has always seemed to me the solution is to take fewer board
seats. You don't have to be on the board to help a startup. Maybe
VCs feel they need the power that comes with board membership to
ensure their money isn't wasted. But have they tested that theory?
Unless they've tried not taking board seats and found their returns
are lower, they're not bracketing the problem.I'm not saying VCs don't help startups. The good ones help them a
lot. What I'm saying is that the kind of help that matters, you
may not have to be a board member to give.
[5]How will this all play out? Some VCs will probably adapt, by doing
more, smaller deals. I wouldn't be surprised if by streamlining
their selection process and taking fewer board seats, VC funds could
do 2 to 3 times as many series A rounds with no loss of quality.But other VCs will make no more than superficial changes. VCs are
conservative, and the threat to them isn't mortal. The VC funds
that don't adapt won't be violently displaced. They'll edge gradually
into a different business without realizing it. They'll still do
what they will call series A rounds, but these will increasingly
be de facto series B rounds.
[6]In such rounds they won't get the 25 to 40% of the company they do
now. You don't give up as much of the company in later rounds
unless something is seriously wrong. Since the VCs who don't adapt
will be investing later, their returns from winners may be smaller.
But investing later should also mean they have fewer losers. So
their ratio of risk to return may be the same or even better.
They'll just have become a different, more conservative, type of
investment.AngelsIn the big angel rounds that increasingly compete with series A
rounds, the investors won't take as much equity as VCs do now. And
VCs who try to compete with angels by doing more, smaller deals
will probably find they have to take less equity to do it. Which
is good news for founders: they'll get to keep more of the company.The deal terms of angel rounds will become less restrictive
too—not just less restrictive than series A terms, but less
restrictive than angel terms have traditionally been.In the future, angel rounds will less often be for specific amounts
or have a lead investor. In the old days, the standard m.o. for
startups was to find one angel to act as the lead investor. You'd
negotiate a round size and valuation with the lead, who'd supply
some but not all of the money. Then the startup and the lead would
cooperate to find the rest.The future of angel rounds looks more like this: instead of a fixed
round size, startups will do a rolling close, where they take money
from investors one at a time till they feel they have enough.
[7]
And though there's going to be one investor who gives them the first
check, and his or her help in recruiting other investors will
certainly be welcome, this initial investor will no longer be the
lead in the old sense of managing the round. The startup will now
do that themselves.There will continue to be lead investors in the sense of investors
who take the lead in advising a startup. They may also make
the biggest investment. But they won't always have to be the one
terms are negotiated with, or be the first money in, as they have
in the past. Standardized paperwork will do away with the need to
negotiate anything except the valuation, and that will get easier
too.If multiple investors have to share a valuation, it will be whatever
the startup can get from the first one to write a check, limited
by their guess at whether this will make later investors balk. But
there may not have to be just one valuation. Startups are increasingly
raising money on convertible notes, and convertible notes have not
valuations but at most valuation caps: caps on what the
effective valuation will be when the debt converts to equity (in a
later round, or upon acquisition if that happens first). That's
an important difference because it means a startup could do multiple
notes at once with different caps. This is now starting to happen,
and I predict it will become more common.SheepThe reason things are moving this way is that the old way sucked
for startups. Leads could (and did) use a fixed size round as a
legitimate-seeming way of saying what all founders hate to hear:
I'll invest if other people will. Most investors, unable to judge
startups for themselves, rely instead on the opinions of other
investors. If everyone wants in, they want in too; if not, not.
Founders hate this because it's a recipe for deadlock, and delay
is the thing a startup can least afford. Most investors know this
m.o. is lame, and few say openly that they're doing it. But the
craftier ones achieve the same result by offering to lead rounds
of fixed size and supplying only part of the money. If the startup
can't raise the rest, the lead is out too. How could they go ahead
with the deal? The startup would be underfunded!In the future, investors will increasingly be unable to offer
investment subject to contingencies like other people investing.
Or rather, investors who do that will get last place in line.
Startups will go to them only to fill up rounds that are mostly
subscribed. And since hot startups tend to have rounds that are
oversubscribed, being last in line means they'll probably miss the
hot deals. Hot deals and successful startups are not identical,
but there is a significant correlation.
[8]
So investors who won't invest unilaterally will have lower returns.Investors will probably find they do better when deprived of this
crutch anyway. Chasing hot deals doesn't make investors choose
better; it just makes them feel better about their choices. I've
seen feeding frenzies both form and fall apart many times, and as
far as I can tell they're mostly random.
[9]
If investors can
no longer rely on their herd instincts, they'll have to think more
about each startup before investing. They may be surprised how
well this works.Deadlock wasn't the only disadvantage of letting a lead investor
manage an angel round. The investors would not infrequently collude
to push down the valuation. And rounds took too long to close,
because however motivated the lead was to get the round closed, he
was not a tenth as motivated as the startup.Increasingly, startups are taking charge of their own angel rounds.
Only a few do so far, but I think we can already declare the old
way dead, because those few are the best startups. They're the
ones in a position to tell investors how the round is going to work.
And if the startups you want to invest in do things a certain way,
what difference does it make what the others do?TractionIn fact, it may be slightly misleading to say that angel rounds
will increasingly take the place of series A rounds. What's really
happening is that startup-controlled rounds are taking the place
of investor-controlled rounds.This is an instance of a very important meta-trend, one that Y
Combinator itself has been based on from the beginning: founders
are becoming increasingly powerful relative to investors. So if
you want to predict what the future of venture funding will be like,
just ask: how would founders like it to be? One by one, all the
things founders dislike about raising money are going to get
eliminated.
[10]Using that heuristic, I'll predict a couple more things. One is
that investors will increasingly be unable to wait for startups to
have "traction" before they put in significant money. It's hard
to predict in advance which startups will succeed. So most investors
prefer, if they can, to wait till the startup is already succeeding,
then jump in quickly with an offer. Startups hate this as well,
partly because it tends to create deadlock, and partly because it
seems kind of slimy. If you're a promising startup but don't yet
have significant growth, all the investors are your friends in
words, but few are in actions. They all say they love you, but
they all wait to invest. Then when you start to see growth, they
claim they were your friend all along, and are aghast at the thought
you'd be so disloyal as to leave them out of your round. If founders
become more powerful, they'll be able to make investors give them
more money upfront.(The worst variant of this behavior is the tranched deal, where the
investor makes a small initial investment, with more to follow if
the startup does well. In effect, this structure gives the investor
a free option on the next round, which they'll only take if it's
worse for the startup than they could get in the open market.
Tranched deals are an abuse. They're increasingly rare, and they're
going to get rarer.)
[11]Investors don't like trying to predict which startups will succeed,
but increasingly they'll have to. Though the way that happens won't
necessarily be that the behavior of existing investors will change;
it may instead be that they'll be replaced by other investors with
different behavior—that investors who understand startups
well enough to take on the hard problem of predicting their trajectory
will tend to displace suits whose skills lie more in raising money
from LPs.SpeedThe other thing founders hate most about fundraising is how long
it takes. So as founders become more powerful, rounds should start
to close faster.Fundraising is still terribly distracting for startups. If you're
a founder in the middle of raising a round, the round is the top idea in your mind, which means working on the
company isn't. If a round takes 2 months to close, which is
reasonably fast by present standards, that means 2 months during
which the company is basically treading water. That's the worst
thing a startup could do.So if investors want to get the best deals, the way to do it will
be to close faster. Investors don't need weeks to make up their
minds anyway. We decide based on about 10 minutes of reading an
application plus 10 minutes of in person interview, and we only
regret about 10% of our decisions. If we can decide in 20 minutes,
surely the next round of investors can decide in a couple days.
[12]There are a lot of institutionalized delays in startup funding: the
multi-week mating dance with investors; the distinction between
termsheets and deals; the fact that each series A has enormously
elaborate, custom paperwork. Both founders and investors tend to
take these for granted. It's the way things have always been. But
ultimately the reason these delays exist is that they're to the
advantage of investors. More time gives investors more information
about a startup's trajectory, and it also tends to make startups
more pliable in negotiations, since they're usually short of money.These conventions weren't designed to drag out the funding process,
but that's why they're allowed to persist. Slowness is to the
advantage of investors, who have in the past been the ones with the
most power. But there is no need for rounds to take months or even
weeks to close, and once founders realize that, it's going to stop.
Not just in angel rounds, but in series A rounds too. The future
is simple deals with standard terms, done quickly.One minor abuse that will get corrected in the process is option
pools. In a traditional series A round, before the VCs invest they
make the company set aside a block of stock for future hires—usually
between 10 and 30% of the company. The point is to ensure this
dilution is borne by the existing shareholders. The practice isn't
dishonest; founders know what's going on. But it makes deals
unnecessarily complicated. In effect the valuation is 2 numbers.
There's no need to keep doing this.
[13]The final thing founders want is to be able to sell some of
their own stock in later rounds. This won't be a change,
because the practice is now quite common. A lot of investors
hated the idea, but the world hasn't exploded as a result,
so it will happen more, and more openly.SurpriseI've talked here about a bunch of changes that will be forced on
investors as founders become more powerful. Now the good news:
investors may actually make more money as a result.A couple days ago an interviewer
asked
me if founders having more
power would be better or worse for the world. I was surprised,
because I'd never considered that question. Better or worse, it's
happening. But after a second's reflection, the answer seemed
obvious. Founders understand their companies better than investors,
and it has to be better if the people with more knowledge have more
power.One of the mistakes novice pilots make is overcontrolling the
aircraft: applying corrections too vigorously, so the aircraft
oscillates about the desired configuration instead of approaching
it asymptotically. It seems probable that investors have till now
on average been overcontrolling their portfolio companies. In a
lot of startups, the biggest source of stress for the founders is
not competitors but investors. Certainly it was for us at Viaweb.
And this is not a new phenomenon: investors were <NAME>'s biggest
problem too. If having less power prevents investors from
overcontrolling startups, it should be better not just for founders
but for investors too.Investors may end up with less stock per startup, but startups will
probably do better with founders more in control, and there will
almost certainly be more of them. Investors all compete with one
another for deals, but they aren't one another's main competitor.
Our main competitor is employers. And so far that competitor is
crushing us. Only a tiny fraction of people who could start a
startup do. Nearly all customers choose the competing product, a
job. Why? Well, let's look at the product we're offering. An
unbiased review would go something like this:
Starting a startup gives you more freedom and the opportunity to
make a lot more money than a job, but it's also hard work and at
times very stressful.
Much of the stress comes from dealing with investors. If reforming
the investment process removed that stress, we'd make our product
much more attractive. The kind of people who make good startup
founders don't mind dealing with technical problems—they enjoy
technical problems—but they hate the type of problems investors
cause.Investors have no
idea that when they maltreat one startup, they're preventing 10
others from happening, but they are. Indirectly, but they are. So
when investors stop trying to squeeze a little more out of their
existing deals, they'll find they're net ahead, because so many
more new deals appear.One of our axioms at Y Combinator is not to think of deal flow as
a zero-sum game. Our main focus is to encourage more startups to happen,
not to win a larger share of the existing stream. We've found this
principle very useful, and we think as it spreads outward it will
help later stage investors as well."Make something people want"
applies to us too.Notes[1]
In this essay I'm talking mainly about software startups.
These points don't apply to types of startups that are still expensive
to start, e.g. in energy or biotech.Even the cheap kinds of startups will generally raise large amounts
at some point, when they want to hire a lot of people. What has
changed is how much they can get done before that.[2]
It's not the distribution of good startups that has a power
law dropoff, but the distribution of potentially good startups,
which is to say, good deals. There are lots of potential winners,
from which a few actual winners emerge with superlinear certainty.[3]
As I was writing this, I asked some founders who'd taken
series A rounds from top VC funds whether it was worth it, and they
unanimously said yes.The quality of investor is more important than the type of round,
though. I'd take an angel round from good angels over a series A
from a mediocre VC.[4]
Founders also worry that taking an angel investment from a
VC means they'll look bad if the VC declines to participate in the
next round. The trend of VC angel investing is so new that it's
hard to say how justified this worry is.Another danger, pointed out by <NAME>, is that if VCs are only
doing angel deals to generate series A deal flow, then their
incentives aren't aligned with the founders'. The founders want
the valuation of the next round to be high, and the VCs want it to
be low. Again, hard to say yet how much of a problem this will be.[5]
<NAME> pointed out that another way to be on fewer
boards at once is to take board seats for shorter periods.[6]
Google was in this respect as so many others the pattern for
the future. It would be great for VCs if the similarity extended
to returns. That's probably too much to hope for, but the returns
may be somewhat higher, as I explain later.[7]
Doing a rolling close doesn't mean the company is always
raising money. That would be a distraction. The point of a rolling
close is to make fundraising take less time, not more. With a
classic fixed sized round, you don't get any money till all the
investors agree, and that often creates a situation where they all
sit waiting for the others to act. A rolling close usually prevents
this.
[8]
There are two (non-exclusive) causes of hot deals: the quality
of the company, and domino effects among investors. The former is
obviously a better predictor of success.[9]
Some of the randomness is concealed by the fact that investment
is a self fulfilling prophecy.[10]
The shift in power to founders is exaggerated now because
it's a seller's market. On the next downtick it will seem like I
overstated the case. But on the next uptick after that, founders
will seem more powerful than ever.[11]
More generally, it will become less common for the same
investor to invest in successive rounds, except when exercising an
option to maintain their percentage. When the same investor invests
in successive rounds, it often means the startup isn't getting
market price. They may not care; they may prefer to work with an
investor they already know; but as the investment market becomes
more efficient, it will become increasingly easy to get market price
if they want it. Which in turn means the investment community will
tend to become more stratified.[12]
The two 10 minuteses have 3 weeks between them so founders
can get cheap plane tickets, but except for that they could be
adjacent.[13]
I'm not saying option pools themselves will go away. They're
an administrative convenience. What will go away is investors
requiring them.
Thanks to <NAME>, <NAME>, <NAME>,
<NAME>, <NAME>,
<NAME>, <NAME>, <NAME>, <NAME>, <NAME>,
<NAME>, <NAME>, <NAME>, <NAME>, <NAME>, <NAME>, <NAME>, <NAME>, <NAME>, and
<NAME>
for reading drafts of this.
|
|
https://github.com/SWATEngineering/Docs | https://raw.githubusercontent.com/SWATEngineering/Docs/main/src/2_RTB/PianoDiProgetto/const.typ | typst | MIT License | #let Re_cost = 30
#let Am_cost = 20
#let An_cost = 25
#let Pt_cost = 25
#let Pr_cost = 15
#let Ve_cost = 15
/*
copiare incollare
#import "../../const.typ": Re_cost, Am_cost, An_cost, Ve_cost, Pr_cost, Pt_cost
//residuo
#let trace = csv("../../trace.csv")
#let residuo_ore = trace.at(1).at(0)
#let residuo_costi = trace.at(1).at(1)
#let costo_ora = ( Re: Re_cost, Am: Am_cost, An: An_cost, Pt: Pt_cost, Pr: Pr_cost, Ve: Ve_cost )
//IMMETTERE DATI
#let ore_preventivo = (
Simone: (0, 0, 0, 0, 10, 0),
RiccardoC: (0, 8, 0, 0, 0, 0),
Giacomo: (9, 0, 0, 0, 0, 0),
Nancy: (0, 0, 0, 0, 0, 8),
Matteo: (0, 0, 0, 0, 10, 0),
RiccardoT: (0, 0, 8, 0, 0, 0)
)
//IMMETTERE DATI
//ore effettive
#let membri_ore = (
Simone: (0, 0.5, 0, 0, 5.5, 4),
RiccardoC: (5.5, 5.5, 0.5, 0, 0, 0),
Giacomo: (4.5, 0, 6, 0, 5, 0),
Nancy: (0.5, 4.5, 0, 0, 0, 5),
Matteo: (0, 0, 5, 0, 5, 0.5),
RiccardoT: (0, 2, 8, 0, 0.5, 2.5)
)
#let membri_ore_extra = (
Simone: (0, 0, 0, 0, 0, 0),
RiccardoC: (0, 0, 0, 0, 0, 0),
Giacomo: (0, 0, 0, 0, 0, 0),
Nancy: (0, 0, 0, 0, 0, 0),
Matteo: (0, 0, 0, 0, 0, 0),
RiccardoT: (0, 0, 0, 0, 0, 0)
)
//calcolo ore extra
#for m in membri_ore.keys() {
for r in (0, 1, 2, 3, 4, 5) {
membri_ore_extra.at(m).at(r) = membri_ore.at(m).at(r) - ore_preventivo.at(m).at(r)
}
}
//ore totali previste per membro
#let membri_tot_prev = ( Simone:0, RiccardoC:0, Giacomo:0, Nancy:0, Matteo:0, RiccardoT:0 )
#for m in membri_ore.keys() {
membri_tot_prev.at(m) = ore_preventivo.at(m).sum()
}
//ore totali effettive per membro
#let membri_tot = ( Simone:0, RiccardoC:0, Giacomo:0, Nancy:0, Matteo:0, RiccardoT:0 )
#for m in membri_ore.keys() {
membri_tot.at(m) = membri_ore.at(m).sum()
}
//ore non previste per membro
#let membri_tot_extra = ( Simone:0, RiccardoC:0, Giacomo:0, Nancy:0, Matteo:0, RiccardoT:0 )
#for m in membri_ore.keys() {
membri_tot_extra.at(m) = membri_ore_extra.at(m).sum()
}
#let ruoli_ore_prev = ( Re: 0, Am:0, An:0, Pt:0, Pr:0, Ve:0 )
#let ruoli_ore = ( Re: 0, Am:0, An:0, Pt:0, Pr:0, Ve:0 )
#let ruoli_ore_extra = ( Re: 0, Am:0, An:0, Pt:0, Pr:0, Ve:0 )
#for i in ore_preventivo.keys() {
ruoli_ore_prev.at("Re") += ore_preventivo.at(i).at(0)
ruoli_ore_prev.at("Am") += ore_preventivo.at(i).at(1)
ruoli_ore_prev.at("An") += ore_preventivo.at(i).at(2)
ruoli_ore_prev.at("Pt") += ore_preventivo.at(i).at(3)
ruoli_ore_prev.at("Pr") += ore_preventivo.at(i).at(4)
ruoli_ore_prev.at("Ve") += ore_preventivo.at(i).at(5)
}
#for i in membri_ore.keys() {
ruoli_ore.at("Re") += membri_ore.at(i).at(0)
ruoli_ore.at("Am") += membri_ore.at(i).at(1)
ruoli_ore.at("An") += membri_ore.at(i).at(2)
ruoli_ore.at("Pt") += membri_ore.at(i).at(3)
ruoli_ore.at("Pr") += membri_ore.at(i).at(4)
ruoli_ore.at("Ve") += membri_ore.at(i).at(5)
}
#for i in membri_ore_extra.keys() {
ruoli_ore_extra.at("Re") += membri_ore_extra.at(i).at(0)
ruoli_ore_extra.at("Am") += membri_ore_extra.at(i).at(1)
ruoli_ore_extra.at("An") += membri_ore_extra.at(i).at(2)
ruoli_ore_extra.at("Pt") += membri_ore_extra.at(i).at(3)
ruoli_ore_extra.at("Pr") += membri_ore_extra.at(i).at(4)
ruoli_ore_extra.at("Ve") += membri_ore_extra.at(i).at(5)
}
#let costo_ruoli_ore=(
Costo_Re: Re_cost * ruoli_ore.at("Re"),
Costo_Am: Am_cost * ruoli_ore.at("Am"),
Costo_An: An_cost * ruoli_ore.at("An"),
Costo_Pt: Pt_cost * ruoli_ore.at("Pt"),
Costo_Pr: Pr_cost * ruoli_ore.at("Pr"),
Costo_Ve: Ve_cost * ruoli_ore.at("Ve"),
)
//tabella delle ore
#let tab_content = (
Simone: ("", "", "", "", "", "", ""),
RiccardoC: ("", "", "", "", "", "", ""),
Giacomo: ("", "", "", "", "", "", ""),
Nancy: ("", "", "", "", "", "", ""),
Matteo: ("", "", "", "", "", "", ""),
RiccardoT: ("", "", "", "", "", "", "")
)
//tabella dei costi
#let tab_costi = (
Re: ("", ""),
Am: ("", ""),
An: ("", ""),
Pt: ("", ""),
Pr: ("", ""),
Ve: ("", "")
)
//contenuto tabella ore
#for m in tab_content.keys() {
//r scorre le colonne coi dati
for r in (0, 1, 2, 3, 4, 5) {
if membri_ore.at(m).at(r) == 0 {
tab_content.at(m).at(r) = "-"
} else {
tab_content.at(m).at(r) = str(membri_ore.at(m).at(r))
}
if membri_ore_extra.at(m).at(r) != 0 {
if membri_ore_extra.at(m).at(r) > 0 {
tab_content.at(m).at(r) += " (" + "+" + str(membri_ore_extra.at(m).at(r)) + ")"
} else {
tab_content.at(m).at(r) += " (" + str(membri_ore_extra.at(m).at(r)) + ")"
}
}
//totali: ore previste (+extra)
tab_content.at(m).at(6) = str(membri_tot.at(m))
if membri_tot_extra.at(m) != 0 {
if membri_tot_extra.at(m) > 0 {
tab_content.at(m).at(6) += " (" + "+" + str(membri_tot_extra.at(m)) + ")"
} else {
tab_content.at(m).at(6) += " (" + str(membri_tot_extra.at(m)) + ")"
}
}
}
}
//contenuto tabella costi
#for r in tab_costi.keys() {
//ore
if ruoli_ore_extra.at(r) != 0 {
if ruoli_ore_extra.at(r) > 0 {
tab_costi.at(r).at(0) = str(ruoli_ore.at(r)) + " (" + "+" + str(ruoli_ore_extra.at(r)) + ")"
} else {
tab_costi.at(r).at(0) = str(ruoli_ore.at(r)) + " (" + str(ruoli_ore_extra.at(r)) + ")"
}
} else {
tab_costi.at(r).at(0) = ruoli_ore.at(r)
}
//costo
if ruoli_ore_extra.at(r) != 0 {
if ruoli_ore_extra.at(r) > 0 {
tab_costi.at(r).at(1) = str(costo_ruoli_ore.at("Costo_"+r)) + "€" + " (" + "+" + str(costo_ora.at(r)*ruoli_ore_extra.at(r)) + "€)"
} else {
tab_costi.at(r).at(1) = str(costo_ruoli_ore.at("Costo_"+r)) + "€" + " (" + str(costo_ora.at(r)*ruoli_ore_extra.at(r)) + "€)"
}
} else {
tab_costi.at(r).at(1) = str(costo_ruoli_ore.at("Costo_"+r)) + "€"
}
}
#let ore_totali = ruoli_ore.values().sum()
#let costi_totali = costo_ruoli_ore.values().sum()
#let ore_rimanenti = float(residuo_ore) - ore_totali
#let costi_rimanenti = str(float(residuo_costi) - costi_totali) + " €"
#table(
columns: (130pt,40pt,40pt,40pt,40pt,40pt,40pt,80pt),
align: center,
[*Nominativo*],[*Re*],[*Am*],[*An*],[*Pt*],[*Pr*],[*Ve*],[*Totale per persona*],
[Simone Caregnato],[#tab_content.at("Simone").at(0)],[#tab_content.at("Simone").at(1)],[#tab_content.at("Simone").at(2)],[#tab_content.at("Simone").at(3)],[#tab_content.at("Simone").at(4)], [#tab_content.at("Simone").at(5)], [#tab_content.at("Simone").at(6)],
[<NAME>],[#tab_content.at("RiccardoC").at(0)],[#tab_content.at("RiccardoC").at(1)],[#tab_content.at("RiccardoC").at(2)],[#tab_content.at("RiccardoC").at(3)],[#tab_content.at("RiccardoC").at(4)], [#tab_content.at("RiccardoC").at(5)], [#tab_content.at("RiccardoC").at(6)],
[<NAME>],[#tab_content.at("Giacomo").at(0)],[#tab_content.at("Giacomo").at(1)],[#tab_content.at("Giacomo").at(2)],[#tab_content.at("Giacomo").at(3)],[#tab_content.at("Giacomo").at(4)], [#tab_content.at("Giacomo").at(5)], [#tab_content.at("Giacomo").at(6)],
[<NAME>],[#tab_content.at("Nancy").at(0)],[#tab_content.at("Nancy").at(1)],[#tab_content.at("Nancy").at(2)],[#tab_content.at("Nancy").at(3)],[#tab_content.at("Nancy").at(4)], [#tab_content.at("Nancy").at(5)], [#tab_content.at("Nancy").at(6)],
[<NAME>],[#tab_content.at("Matteo").at(0)],[#tab_content.at("Matteo").at(1)],[#tab_content.at("Matteo").at(2)],[#tab_content.at("Matteo").at(3)],[#tab_content.at("Matteo").at(4)], [#tab_content.at("Matteo").at(5)], [#tab_content.at("Matteo").at(6)],
[<NAME>],[#tab_content.at("RiccardoT").at(0)],[#tab_content.at("RiccardoT").at(1)],[#tab_content.at("RiccardoT").at(2)],[#tab_content.at("RiccardoT").at(3)],[#tab_content.at("RiccardoT").at(4)], [#tab_content.at("RiccardoT").at(5)], [#tab_content.at("RiccardoT").at(6)],
[*Totale per ruolo*],[#ruoli_ore.at("Re")],[#ruoli_ore.at("Am")],[#ruoli_ore.at("An")],[#ruoli_ore.at("Pt")],[#ruoli_ore.at("Pr")],[#ruoli_ore.at("Ve")],[#ruoli_ore.values().sum()]
)
#table(
columns: (120pt,60pt,100pt),
align: center,
[*Ruolo*],[*Ore*],[*Costo*],
[Responsabile],[#tab_costi.at("Re").at(0)],[#tab_costi.at("Re").at(1)],
[Amministratore],[#tab_costi.at("Am").at(0)],[#tab_costi.at("Am").at(1)],
[Analista],[#tab_costi.at("An").at(0)],[#tab_costi.at("An").at(1)],
[Progettista],[#tab_costi.at("Pt").at(0)],[#tab_costi.at("Pt").at(1)],
[Programmatore],[#tab_costi.at("Pr").at(0)],[#tab_costi.at("Pr").at(1)],
[Verificatore],[#tab_costi.at("Ve").at(0)],[#tab_costi.at("Ve").at(1)],
[*Totale*],[#ore_totali],[#costi_totali],
[*Rimanente*],[#ore_rimanenti],[#costi_rimanenti]
)
*/ |
https://github.com/roife/resume | https://raw.githubusercontent.com/roife/resume/master/fontawesome.typ | typst | MIT License |
#let fa(name) = {
text(
font: "Font Awesome 6 Free Solid",
size: 10pt,
box[ #name ]
)
}
// Regular icons
#let ad = symbol("\u{f641}")
#let address-book = symbol("\u{f2b9}")
#let address-card = symbol("\u{f2bb}")
#let adjust = symbol("\u{f042}")
#let air-freshener = symbol("\u{f5d0}")
#let align-icon = symbol(
("left", "\u{f036}"),
("center", "\u{f037}"),
("right", "\u{f038}"),
("justify", "\u{f039}"),
)
#let allergies = symbol("\u{f461}")
#let ambulance = symbol("\u{f0f9}")
#let american-sign-language-interpreting = symbol("\u{f2a3}")
#let anchor = symbol("\u{f13d}")
#let angle = symbol(
("left", "\u{f104}"), // by default angle.left
("right", "\u{f105}"),
("up", "\u{f106}"),
("down", "\u{f107}"),
("double.left", "\u{f100}"),
("double.right", "\u{f101}"),
("double.up", "\u{f102}"),
("double.down", "\u{f103}"),
)
#let angry = symbol("\u{f556}")
#let ankh = symbol("\u{f644}")
#let apple = symbol(
"\u{f179}",
("alt", "\u{f5d1}"),
("pay", "\u{f415}"),
("pay.cc", "\u{f416}")
)
#let archive = symbol("\u{f187}")
#let archway = symbol("\u{f557}")
#let arrow-icon = symbol(
("left", "\u{f060}"),
("right", "\u{f061}"),
("up", "\u{f062}"),
("down", "\u{f063}"),
("circle.left", "\u{f0a8}"),
("circle.right", "\u{f0a9}"),
("circle.up", "\u{f0aa}"),
("circle.down", "\u{f0ab}"),
("circle.alt.down", "\u{f358}"),
("circle.alt.left", "\u{f359}"),
("circle.alt.right", "\u{f35a}"),
("circle.alt.up", "\u{f35b}"),
("long.down", "\u{f309}"),
("long.left", "\u{f30a}"),
("long.right", "\u{f30b}"),
("long.up", "\u{f30c}"),
("plural", "\u{f0b2}"),
("plural.h", "\u{f337}"),
("plural.v", "\u{f338}"),
)
#let assistive-listening-systems = symbol("\u{f2a2}")
#let asterisk = symbol("\u{f069}")
#let at = symbol("\u{f1fa}")
#let atlas = symbol("\u{f558}")
#let atom = symbol("\u{f5d2}")
#let audio-description = symbol("\u{f29e}")
#let award = symbol("\u{f559}")
#let baby = symbol("\u{f77c}")
#let baby-carriage = symbol("\u{f77d}")
#let backspace = symbol("\u{f55a}")
#let backward = symbol("\u{f04a}")
#let bacon = symbol("\u{f7e5}")
#let bacterium = symbol(
"\u{e05a}",
("plural", "\u{e059}")
)
#let bahai = symbol("\u{f666}")
#let balance-scale = symbol(
"\u{f24e}",
("balance-scale.left", "\u{f515}"),
("balance-scale.right", "\u{f516}"),
)
#let ball = symbol(
("basketball", "\u{f434}"),
("baseball", "\u{f433}"),
("bowling", "\u{f436}"),
("football", "\u{f44e}"),
("golf", "\u{f450}"),
("volleyball", "\u{f45f}"),
)
#let ban = symbol("\u{f05e}")
#let band-aid = symbol("\u{f462}")
#let barcode = symbol("\u{f02a}")
#let bars = symbol("\u{f0c9}")
#let bath = symbol("\u{f2cd}")
#let battery = symbol(
("empty", "\u{f244}"),
("full", "\u{f240}"),
("half", "\u{f242}"),
("quarter", "\u{f243}"),
("three-quarters", "\u{f241}"),
)
#let bed = symbol("\u{f236}")
#let beer = symbol("\u{f0fc}")
#let bell = symbol(
"\u{f0f3}",
("slash", "\u{f1f6}"),
("concierge", "\u{f562}"),
)
#let bezier-curve = symbol("\u{f55b}")
#let bible = symbol("\u{f647}")
#let bicycle = symbol("\u{f206}")
#let biking = symbol("\u{f84a}")
#let binoculars = symbol("\u{f1e5}")
#let biohazard = symbol("\u{f780}")
#let birthday-cake = symbol("\u{f1fd}")
#let blender = symbol(
"\u{f517}",
("phone", "\u{f6b6}"),
)
#let blind = symbol("\u{f29d}")
#let blog = symbol("\u{f781}")
#let bold = symbol("\u{f032}")
#let bolt = symbol("\u{f0e7}")
#let bomb = symbol("\u{f1e2}")
#let bone = symbol("\u{f5d7}")
#let bong = symbol("\u{f55c}")
#let book = symbol(
"\u{f02d}",
("dead", "\u{f6b7}"),
("medical", "\u{f7e6}"),
("open", "\u{f518}"),
("reader", "\u{f5da}"),
)
#let bookmark = symbol("\u{f02e}")
#let border = symbol(
("all", "\u{f84c}"),
("none", "\u{f850}"),
("style", "\u{f853}"),
)
#let box-icon = symbol(
"\u{f466}",
("open", "\u{f49e}"),
("tissue", "\u{e05b}"),
("plural", "\u{f468}"),
)
#let braille = symbol("\u{f2a1}")
#let brain = symbol("\u{f5dc}")
#let bread-slice = symbol("\u{f7ec}")
#let briefcase = symbol(
"\u{f0b1}",
("medical", "\u{f469}"),
)
#let broadcast-tower = symbol("\u{f519}")
#let broom = symbol("\u{f51a}")
#let brush = symbol("\u{f55d}")
#let bug = symbol("\u{f188}")
#let building = symbol("\u{f1ad}")
#let bullhorn = symbol("\u{f0a1}")
#let bullseye = symbol("\u{f140}")
#let burn = symbol("\u{f46a}")
#let bus = symbol(
"\u{f207}",
("alt", "\u{f55e}"),
)
#let business-time = symbol("\u{f64a}")
#let calculator = symbol("\u{f1ec}")
#let calendar = symbol(
"\u{f133}",
("alt", "\u{f073}"),
("check", "\u{f274}"),
("day", "\u{f783}"),
("minus", "\u{f272}"),
("plus", "\u{f271}"),
("times", "\u{f273}"),
("week", "\u{f784}"),
)
#let camera = symbol(
"\u{f030}",
("retro", "\u{f083}"),
)
#let campground = symbol("\u{f6bb}")
#let candy-cane = symbol("\u{f786}")
#let cannabis = symbol("\u{f55f}")
#let capsules = symbol("\u{f46b}")
#let car = symbol(
"\u{f1b9}",
("alt", "\u{f5de}"),
("battery", "\u{f5df}"),
("crash", "\u{f5e1}"),
("side", "\u{f5e4}"),
)
#let caravan = symbol("\u{f8ff}")
#let caret = symbol(
("down", "\u{f0d7}"),
("up", "\u{f0d8}"),
("left", "\u{f0d9}"),
("right", "\u{f0da}"),
("square.down", "\u{f150}"),
("square.up", "\u{f151}"),
("square.right", "\u{f152}"),
("square.left", "\u{f191}"),
)
#let carrot = symbol("\u{f787}")
#let cart = symbol(
"\u{f07a}",
("plus", "\u{f217}"),
("arrow.down", "\u{f218}"),
)
#let cash-register = symbol("\u{f788}")
#let cat = symbol("\u{f6be}")
#let certificate = symbol("\u{f0a3}")
#let chair = symbol("\u{f6c0}")
#let chalkboard = symbol(
"\u{f51b}",
("teacher", "\u{f51c}"),
)
#let charging-station = symbol("\u{f5e7}")
#let chart = symbol(
("bar", "\u{f080}"),
("area", "\u{f1fe}"),
("pie", "\u{f200}"),
("line", "\u{f201}"),
)
#let check = symbol(
"\u{f00c}",
("circle", "\u{f058}"),
("double", "\u{f560}"),
("square", "\u{f14a}"),
)
#let cheese = symbol("\u{f7ef}")
#let chess = symbol(
"\u{f439}",
("bishop", "\u{f43a}"),
("board", "\u{f43c}"),
("king", "\u{f43f}"),
("knight", "\u{f441}"),
("pawn", "\u{f443}"),
("queen", "\u{f445}"),
("rook", "\u{f447}"),
)
#let chevron = symbol(
("left", "\u{f053}"),
("right", "\u{f054}"),
("up", "\u{f077}"),
("down", "\u{f078}"),
("circle.left", "\u{f137}"),
("circle.right", "\u{f138}"),
("circle.up", "\u{f139}"),
("circle.down", "\u{f13a}"),
)
#let child = symbol("\u{f1ae}")
#let church = symbol("\u{f51d}")
#let circle-icon = symbol(
"\u{f111}",
("notch", "\u{f1ce}"),
)
#let city = symbol("\u{f64f}")
#let clinic-medical = symbol("\u{f7f2}")
#let clipboard = symbol(
"\u{f328}",
("check", "\u{f46c}"),
("list", "\u{f46d}"),
)
#let clock = symbol("\u{f017}")
#let clone = symbol("\u{f24d}")
#let closed-captioning = symbol("\u{f20a}")
#let cloud = symbol(
"\u{f0c2}",
("download", "\u{f381}"),
("meatball", "\u{f73b}"),
("moon", "\u{f6c3}"),
("moon.rain", "\u{f73c}"),
("rain", "\u{f73d}"),
("rain.heavy", "\u{f740}"),
("sun", "\u{f6c4}"),
("sun.rain", "\u{f743}"),
("upload", "\u{f382}"),
)
#let cocktail = symbol("\u{f561}")
#let code = symbol(
"\u{f121}",
("branch", "\u{f126}"),
)
#let coffee = symbol("\u{f0f4}")
#let cog = symbol(
"\u{f013}",
("plural", "\u{f085}"),
)
#let coins = symbol("\u{f51e}")
#let columns = symbol("\u{f0db}")
#let comment = symbol(
"\u{f075}",
("alt", "\u{f27a}"),
("dollar", "\u{f651}"),
("dots", "\u{f4ad}"),
("medical", "\u{f7f5}"),
("slash", "\u{f4b3}"),
("plural.", "\u{f086}"),
("plural.dollar", "\u{f653}"),
)
#let compact-disc = symbol("\u{f51f}")
#let compass = symbol("\u{f14e}")
#let compress = symbol(
"\u{f066}",
("alt", "\u{f422}"),
("alt.arrows", "\u{f78c}"),
)
#let cookie = symbol(
"\u{f563}",
("bite", "\u{f564}"),
)
#let copy = symbol("\u{f0c5}")
#let copyright = symbol("\u{f1f9}")
#let couch = symbol("\u{f4b8}")
#let credit-card = symbol("\u{f09d}")
#let crop = symbol(
"\u{f125}",
("alt", "\u{f565}"),
)
#let cross = symbol("\u{f654}")
#let crosshairs = symbol("\u{f05b}")
#let crow = symbol("\u{f520}")
#let crown = symbol("\u{f521}")
#let crutch = symbol("\u{f7f7}")
#let cube = symbol(
"\u{f1b2}",
("plural", "\u{f1b3}"),
)
#let cut = symbol("\u{f0c4}")
#let database = symbol("\u{f1c0}")
#let deaf = symbol("\u{f2a4}")
#let democrat = symbol("\u{f747}")
#let desktop = symbol("\u{f108}")
#let dharmachakra = symbol("\u{f655}")
#let diagnoses = symbol("\u{f470}")
#let dice = symbol(
"\u{f522}",
("d20", "\u{f6cf}"),
("d6", "\u{f6d1}"),
("five", "\u{f523}"),
("four", "\u{f524}"),
("one", "\u{f525}"),
("six", "\u{f526}"),
("three", "\u{f527}"),
("two", "\u{f528}"),
)
#let digital-tachograph = symbol("\u{f566}")
#let directions = symbol("\u{f5eb}")
#let disease = symbol("\u{f7fa}")
#let divide = symbol("\u{f529}")
#let dizzy = symbol("\u{f567}")
#let dna = symbol("\u{f471}")
#let dog = symbol("\u{f6d3}")
#let dolly = symbol(
"\u{f472}",
("flatbed", "\u{f474}"),
)
#let donate = symbol("\u{f4b9}")
#let door = symbol(
("closed", "\u{f52a}"),
("open", "\u{f52b}"),
)
#let dot-circle = symbol("\u{f192}")
#let dove = symbol("\u{f4ba}")
#let download = symbol("\u{f019}")
#let drafting-compass = symbol("\u{f568}")
#let dragon = symbol("\u{f6d5}")
#let draw-polygon = symbol("\u{f5ee}")
#let drum = symbol(
"\u{f569}",
("steelpan", "\u{f56a}"),
)
#let drumstick-bite = symbol("\u{f6d7}")
#let dumbbell = symbol("\u{f44b}")
#let dumpster = symbol(
"\u{f793}",
("fire", "\u{f794}"),
)
#let dungeon = symbol("\u{f6d9}")
#let edit = symbol("\u{f044}")
#let egg = symbol("\u{f7fb}")
#let eject = symbol("\u{f052}")
#let ellipsis = symbol(
("h", "\u{f141}"),
("v", "\u{f142}"),
)
#let envelope = symbol(
"\u{f0e0}",
("open", "\u{f2b6}"),
("open.text", "\u{f658}"),
("square", "\u{f199}"),
)
#let equals = symbol("\u{f52c}")
#let eraser = symbol("\u{f12d}")
#let ethernet = symbol("\u{f796}")
#let exchange = symbol("\u{f362}")
#let exclamation = symbol(
"\u{f12a}",
("circle", "\u{f06a}"),
("triangle", "\u{f071}"),
)
#let expand = symbol(
"\u{f065}",
("alt", "\u{f424}"),
("alt.arrows", "\u{f31e}"),
)
#let link-icon = symbol("\u{f0c1}")
#let external-link = symbol(
"\u{f35d}",
("square", "\u{f360}"),
)
#let eye = symbol(
"\u{f06e}",
("dropper", "\u{f1fb}"),
("slash", "\u{f070}"),
)
#let fan = symbol("\u{f863}")
#let fast = symbol(
("backward", "\u{f049}"),
("forward", "\u{f050}"),
)
#let faucet = symbol("\u{e005}")
#let fax = symbol("\u{f1ac}")
#let feather = symbol(
"\u{f52d}",
("alt", "\u{f56b}"),
)
#let female = symbol("\u{f182}")
#let fighter-jet = symbol("\u{f0fb}")
#let file = symbol(
"\u{f15b}",
("alt", "\u{f15c}"),
("archive", "\u{f1c6}"),
("audio", "\u{f1c7}"),
("code", "\u{f1c9}"),
("contract", "\u{f56c}"),
("csv", "\u{f6dd}"),
("download", "\u{f56d}"),
("excel", "\u{f1c3}"),
("export", "\u{f56e}"),
("image", "\u{f1c5}"),
("import", "\u{f56f}"),
("invoice", "\u{f570}"),
("invoice.dollar", "\u{f571}"),
("medical", "\u{f477}"),
("medical-alt", "\u{f478}"),
("pdf", "\u{f1c1}"),
("powerpoint", "\u{f1c4}"),
("prescription", "\u{f572}"),
("signature", "\u{f573}"),
("upload", "\u{f574}"),
("video", "\u{f1c8}"),
("word", "\u{f1c2}"),
)
#let fill = symbol(
"\u{f575}",
("drip", "\u{f576}"),
)
#let film = symbol("\u{f008}")
#let filter = symbol("\u{f0b0}")
#let fingerprint = symbol("\u{f577}")
#let fire = symbol(
"\u{f06d}",
("alt", "\u{f7e4}"),
("extinguisher", "\u{f134}"),
)
#let first-aid = symbol("\u{f479}")
#let fish = symbol("\u{f578}")
#let fist-raised = symbol("\u{f6de}")
#let flag = symbol(
"\u{f024}",
("checkered", "\u{f11e}"),
("usa", "\u{f74d}"),
)
#let flask = symbol("\u{f0c3}")
#let flushed = symbol("\u{f579}")
#let folder = symbol(
"\u{f07b}",
("minus", "\u{f65d}"),
("open", "\u{f07c}"),
("plus", "\u{f65e}"),
)
#let font = symbol("\u{f031}")
#let forward = symbol("\u{f04e}")
#let frog = symbol("\u{f52e}")
#let frown = symbol(
"\u{f119}",
("open", "\u{f57a}"),
)
#let funnel-dollar = symbol("\u{f662}")
#let futbol = symbol("\u{f1e3}")
#let gamepad = symbol("\u{f11b}")
#let gas-pump = symbol("\u{f52f}")
#let gavel = symbol("\u{f0e3}")
#let gem = symbol("\u{f3a5}")
#let genderless = symbol("\u{f22d}")
#let ghost = symbol("\u{f6e2}")
#let gift = symbol(
"\u{f06b}",
("plural", "\u{f79c}"),
)
#let glass = symbol(
("cheers", "\u{f79f}"),
("martini", "\u{f000}"),
("martini.alt", "\u{f57b}"),
("whiskey", "\u{f7a0}"),
("plural", "\u{f530}"),
)
#let globe = symbol(
"\u{f0ac}",
("africa", "\u{f57c}"),
("americas", "\u{f57d}"),
("asia", "\u{f57e}"),
("europe", "\u{f7a2}"),
)
#let gopuram = symbol("\u{f664}")
#let graduation-cap = symbol("\u{f19d}")
#let greater-than = symbol(
"\u{f531}",
("equal", "\u{f532}"),
)
#let grimace = symbol("\u{f57f}")
#let grin = symbol(
"\u{f580}",
("alt", "\u{f581}"),
("beam", "\u{f582}"),
("beam-sweat", "\u{f583}"),
("hearts", "\u{f584}"),
("squint", "\u{f585}"),
("squint-tears", "\u{f586}"),
("stars", "\u{f587}"),
("tears", "\u{f588}"),
("tongue", "\u{f589}"),
("tongue-squint", "\u{f58a}"),
("tongue-wink", "\u{f58b}"),
("wink", "\u{f58c}"),
)
#let grip = symbol(
("horizontal", "\u{f58d}"),
("lines", "\u{f7a4}"),
("lines-vertical", "\u{f7a5}"),
("vertical", "\u{f58e}"),
)
#let guitar = symbol("\u{f7a6}")
#let h-square = symbol("\u{f0fd}")
#let hamburger = symbol("\u{f805}")
#let hammer = symbol("\u{f6e3}")
#let hamsa = symbol("\u{f665}")
#let hand = symbol(
("holding", "\u{f4bd}"),
("holding.heart", "\u{f4be}"),
("holding.medical", "\u{e05c}"),
("holding.usd", "\u{f4c0}"),
("holding.water", "\u{f4c1}"),
("lizard", "\u{f258}"),
("middle-finger", "\u{f806}"),
("paper", "\u{f256}"),
("peace", "\u{f25b}"),
("point.right", "\u{f0a4}"),
("point.left", "\u{f0a5}"),
("point.up", "\u{f0a6}"),
("point.down", "\u{f0a7}"),
("pointer", "\u{f25a}"),
("rock", "\u{f255}"),
("scissors", "\u{f257}"),
("sparkles", "\u{e05d}"),
("spock", "\u{f259}"),
("plural", "\u{f4c2}"),
("helping", "\u{f4c4}"),
("wash", "\u{e05e}"),
("shake", "\u{f2b5}"),
("shake.slash", "\u{e060}"),
("shake.slash.alt", "\u{e05f}"),
("praying", "\u{f684}"),
)
#let hanukiah = symbol("\u{f6e6}")
#let hat-icon = symbol(
("hard", "\u{f807}"),
("cowboy", "\u{f8c0}"),
("cowboy-side", "\u{f8c1}"),
("wizard", "\u{f6e8}"),
)
#let hashtag = symbol("\u{f292}")
#let hdd = symbol("\u{f0a0}")
#let head-side = symbol(
("cough", "\u{e061}"),
("cough-slash", "\u{e062}"),
("mask", "\u{e063}"),
("virus", "\u{e064}"),
)
#let heading-icon = symbol("\u{f1dc}")
#let headphones = symbol(
"\u{f025}",
("alt", "\u{f58f}"),
("mic", "\u{f590}")
)
#let heart = symbol(
"\u{f004}",
("broken", "\u{f7a9}"),
("beat", "\u{f21e}"),
)
#let helicopter = symbol("\u{f533}")
#let highlighter = symbol("\u{f591}")
#let hiking = symbol("\u{f6ec}")
#let hippo = symbol("\u{f6ed}")
#let history = symbol("\u{f1da}")
#let hockey-puck = symbol("\u{f453}")
#let holly-berry = symbol("\u{f7aa}")
#let home = symbol("\u{f015}")
#let horse = symbol(
"\u{f6f0}",
("head", "\u{f7ab}"),
)
#let hospital = symbol(
"\u{f0f8}",
("alt", "\u{f47d}"),
("symbol", "\u{f47e}"),
("user", "\u{f80d}"),
)
#let hot-tub = symbol("\u{f593}")
#let hotdog = symbol("\u{f80f}")
#let hotel = symbol("\u{f594}")
#let hourglass = symbol(
"\u{f254}",
("start", "\u{f251}"),
)
#let house = symbol(
("user", "\u{e065}"),
("damage", "\u{f6f1}"),
)
#let hryvnia = symbol("\u{f6f2}")
#let i-cursor = symbol("\u{f246}")
#let ice-cream = symbol("\u{f810}")
#let icicles = symbol("\u{f7ad}")
#let icons = symbol("\u{f86d}")
#let id = symbol(
("badge", "\u{f2c1}"),
("card", "\u{f2c2}"),
("card-alt", "\u{f47f}"),
)
#let igloo = symbol("\u{f7ae}")
#let image = symbol(
"\u{f03e}",
("plural", "\u{f302}"),
)
#let inbox = symbol("\u{f01c}")
#let indent = symbol("\u{f03c}")
#let industry = symbol("\u{f275}")
#let infinity = symbol("\u{f534}")
#let info = symbol(
"\u{f129}",
("circle", "\u{f05a}"),
)
#let italic = symbol("\u{f033}")
#let jedi = symbol("\u{f669}")
#let joint = symbol("\u{f595}")
#let journal-whills = symbol("\u{f66a}")
#let kaaba = symbol("\u{f66b}")
#let key = symbol("\u{f084}")
#let keyboard = symbol("\u{f11c}")
#let khanda = symbol("\u{f66d}")
#let kiss = symbol(
"\u{f596}",
("beam", "\u{f597}"),
("wink.heart", "\u{f598}"),
)
#let kiwi-bird = symbol("\u{f535}")
#let landmark = symbol("\u{f66f}")
#let language = symbol("\u{f1ab}")
#let laptop = symbol(
"\u{f109}",
("code", "\u{f5fc}"),
("house", "\u{e066}"),
("medical", "\u{f812}"),
)
#let laugh = symbol(
"\u{f599}",
("beam", "\u{f59a}"),
("squint", "\u{f59b}"),
("wink", "\u{f59c}"),
)
#let layer-group = symbol("\u{f5fd}")
#let leaf = symbol("\u{f06c}")
#let lemon = symbol("\u{f094}")
#let less-than = symbol(
"\u{f536}",
("equal", "\u{f537}"),
)
#let level-down = symbol("\u{f3be}")
#let level-up = symbol("\u{f3bf}")
#let life-ring = symbol("\u{f1cd}")
#let lightbulb = symbol("\u{f0eb}")
#let list-icon = symbol(
"\u{f03a}",
("alt", "\u{f022}"),
("ol", "\u{f0cb}"),
("ul", "\u{f0ca}"),
)
#let location-arrow = symbol("\u{f124}")
#let lock = symbol(
"\u{f023}",
("open", "\u{f3c1}"),
)
#let low-vision = symbol("\u{f2a8}")
#let luggage-cart = symbol("\u{f59d}")
#let lungs = symbol(
"\u{f604}",
("virus", "\u{e067}"),
)
#let magic = symbol("\u{f0d0}")
#let magnet = symbol("\u{f076}")
#let mail-bulk = symbol("\u{f674}")
#let male = symbol("\u{f183}")
#let map-icon = symbol(
"\u{f279}",
("marked", "\u{f59f}"),
("marked-alt", "\u{f5a0}"),
("marker", "\u{f041}"),
("marker-alt", "\u{f3c5}"),
("pin", "\u{f276}"),
("signs", "\u{f277}"),
)
#let marker = symbol("\u{f5a1}")
#let mars = symbol(
"\u{f222}",
("double", "\u{f227}"),
("stroke", "\u{f229}"),
("stroke.h", "\u{f22b}"),
("stroke.v", "\u{f22a}"),
)
#let mask = symbol("\u{f6fa}")
#let medal = symbol("\u{f5a2}")
#let medkit = symbol("\u{f0fa}")
#let meh = symbol(
"\u{f11a}",
("blank", "\u{f5a4}"),
("rolling-eyes", "\u{f5a5}"),
)
#let memory = symbol("\u{f538}")
#let menorah = symbol("\u{f676}")
#let mercury = symbol("\u{f223}")
#let meteor = symbol("\u{f753}")
#let microchip = symbol("\u{f2db}")
#let microphone = symbol(
"\u{f130}",
("slash", "\u{f131}"),
("alt", "\u{f3c9}"),
("alt.slash", "\u{f539}"),
)
#let microscope = symbol("\u{f610}")
#let minus = symbol(
"\u{f068}",
("circle", "\u{f056}"),
("square", "\u{f146}"),
)
#let mitten = symbol("\u{f7b5}")
#let mobile = symbol(
"\u{f10b}",
("alt", "\u{f3cd}"),
)
#let money = symbol(
("bill", "\u{f0d6}"),
("bill.alt", "\u{f3d1}"),
("bill.wave", "\u{f53a}"),
("bill.wave.alt", "\u{f53b}"),
("check", "\u{f53c}"),
("check.alt", "\u{f53d}"),
("sign.dollar", "\u{f155}"),
("sign.euro", "\u{f153}"),
("sign.pound", "\u{f154}"),
("sign.ruble", "\u{f158}"),
("sign.rupee", "\u{f156}"),
("sign.shekel", "\u{f20b}"),
("sign.lira", "\u{f195}"),
("sign.won", "\u{f159}"),
("sign.yen", "\u{f157}"),
)
#let monument = symbol("\u{f5a6}")
#let moon = symbol("\u{f186}")
#let mortar-pestle = symbol("\u{f5a7}")
#let mosque = symbol("\u{f678}")
#let motorcycle = symbol("\u{f21c}")
#let mountain = symbol("\u{f6fc}")
#let mouse = symbol("\u{f8cc}")
#let mouse-pointer = symbol("\u{f245}")
#let mug-hot = symbol("\u{f7b6}")
#let music = symbol("\u{f001}")
#let network-wired = symbol("\u{f6ff}")
#let neuter = symbol("\u{f22c}")
#let newspaper = symbol("\u{f1ea}")
#let not-equal = symbol("\u{f53e}")
#let notes-medical = symbol("\u{f481}")
#let object-group = symbol("\u{f247}")
#let object-ungroup = symbol("\u{f248}")
#let oil-can = symbol("\u{f613}")
#let om = symbol("\u{f679}")
#let otter = symbol("\u{f700}")
#let outdent = symbol("\u{f03b}")
#let pager = symbol("\u{f815}")
#let paintbrush = symbol(
"\u{f1fc}",
("roller", "\u{f5aa}"),
)
#let palette = symbol("\u{f53f}")
#let pallet = symbol("\u{f482}")
#let paper-plane = symbol("\u{f1d8}")
#let paperclip = symbol("\u{f0c6}")
#let parachute-box = symbol("\u{f4cd}")
#let paragraph = symbol("\u{f1dd}")
#let parking = symbol("\u{f540}")
#let passport = symbol("\u{f5ab}")
#let pastafarianism = symbol("\u{f67b}")
#let paste = symbol("\u{f0ea}")
#let pause = symbol(
"\u{f04c}",
("circle", "\u{f28b}"),
)
#let paw = symbol("\u{f1b0}")
#let peace = symbol("\u{f67c}")
#let pen = symbol(
"\u{f304}",
("alt", "\u{f305}"),
("fancy", "\u{f5ac}"),
("nib", "\u{f5ad}"),
("square", "\u{f14b}"),
)
#let pencil = symbol(
("alt", "\u{f303}"),
("ruler", "\u{f5ae}"),
)
#let people = symbol(
("arrows", "\u{e068}"),
("carry", "\u{f4ce}"),
)
#let pepper-hot = symbol("\u{f816}")
#let percent = symbol("\u{f295}")
#let percentage = symbol("\u{f541}")
#let person-booth = symbol("\u{f756}")
#let phone = symbol(
"\u{f095}",
("alt", "\u{f879}"),
("slash", "\u{f3dd}"),
("square", "\u{f098}"),
("square-alt", "\u{f87b}"),
("volume", "\u{f2a0}"),
)
#let photo-video = symbol("\u{f87c}")
#let piggy-bank = symbol("\u{f4d3}")
#let pills = symbol("\u{f484}")
#let pizza-slice = symbol("\u{f818}")
#let place-of-worship = symbol("\u{f67f}")
#let plane = symbol(
"\u{f072}",
("arrival", "\u{f5af}"),
("departure", "\u{f5b0}"),
("slash", "\u{e069}"),
)
#let play = symbol(
"\u{f04b}",
("circle", "\u{f144}"),
)
#let plug = symbol("\u{f1e6}")
#let plus = symbol(
"\u{f067}",
("circle", "\u{f055}"),
("square", "\u{f0fe}"),
)
#let podcast = symbol("\u{f2ce}")
#let poll = symbol(
"\u{f681}",
("h", "\u{f682}"),
)
#let poop = symbol(
"\u{f619}",
("face", "\u{f2fe}"),
("storm", "\u{f75a}"),
)
#let portrait = symbol("\u{f3e0}")
#let power-off = symbol("\u{f011}")
#let pray = symbol("\u{f683}")
#let prescription = symbol(
"\u{f5b1}",
("bottle", "\u{f485}"),
("bottle.alt", "\u{f486}"),
)
#let print = symbol("\u{f02f}")
#let procedures = symbol("\u{f487}")
#let project-diagram = symbol("\u{f542}")
#let pump = symbol(
("soap", "\u{e06b}"),
("medical", "\u{e06a}"),
)
#let puzzle-piece = symbol("\u{f12e}")
#let qrcode = symbol("\u{f029}")
#let question = symbol(
"\u{f128}",
("circle", "\u{f059}"),
)
#let quidditch = symbol("\u{f458}")
#let quote = symbol(
("left", "\u{f10d}"),
("right", "\u{f10e}"),
)
#let quran = symbol("\u{f687}")
#let radiation = symbol(
"\u{f7b9}",
("alt", "\u{f7ba}"),
)
#let rainbow = symbol("\u{f75b}")
#let random = symbol("\u{f074}")
#let receipt = symbol("\u{f543}")
#let record-vinyl = symbol("\u{f8d9}")
#let recycle = symbol("\u{f1b8}")
#let redo = symbol(
"\u{f01e}",
("alt", "\u{f2f9}"),
)
#let registered = symbol("\u{f25d}")
#let remove-format = symbol("\u{f87d}")
#let reply = symbol(
"\u{f3e5}",
("all", "\u{f122}"),
)
#let republican = symbol("\u{f75e}")
#let restroom = symbol("\u{f7bd}")
#let retweet = symbol("\u{f079}")
#let ribbon = symbol("\u{f4d6}")
#let ring = symbol("\u{f70b}")
#let road = symbol("\u{f018}")
#let robot = symbol("\u{f544}")
#let rocket = symbol("\u{f135}")
#let route = symbol("\u{f4d7}")
#let rss = symbol(
"\u{f09e}",
("square", "\u{f143}"),
)
#let ruler = symbol(
"\u{f545}",
("combined", "\u{f546}"),
("horizontal", "\u{f547}"),
("vertical", "\u{f548}"),
)
#let running = symbol("\u{f70c}")
#let sad = symbol(
("cry", "\u{f5b3}"),
("tear", "\u{f5b4}"),
)
#let satellite = symbol(
"\u{f7bf}",
("dish", "\u{f7c0}"),
)
#let save = symbol("\u{f0c7}")
#let school = symbol("\u{f549}")
#let screwdriver = symbol("\u{f54a}")
#let scroll = symbol("\u{f70e}")
#let sd-card = symbol("\u{f7c2}")
#let search = symbol(
"\u{f002}",
("dollar", "\u{f688}"),
("location", "\u{f689}"),
("minus", "\u{f010}"),
("plus", "\u{f00e}"),
)
#let seedling = symbol("\u{f4d8}")
#let server = symbol("\u{f233}")
#let shapes = symbol("\u{f61f}")
#let share = symbol(
"\u{f064}",
("alt", "\u{f1e0}"),
("alt-square", "\u{f1e1}"),
("square", "\u{f14d}"),
)
#let shield = symbol(
"\u{f3ed}",
("virus", "\u{e06c}"),
)
#let ship = symbol("\u{f21a}")
#let shipping-fast = symbol("\u{f48b}")
#let shoe-prints = symbol("\u{f54b}")
#let shopping-bag = symbol("\u{f290}")
#let shopping-basket = symbol("\u{f291}")
#let shower = symbol("\u{f2cc}")
#let shuttle-van = symbol("\u{f5b6}")
#let sign = symbol("\u{f4d9}")
#let sign-in = symbol("\u{f2f6}")
#let sign-out = symbol("\u{f2f5}")
#let sign-language = symbol("\u{f2a7}")
#let signal = symbol("\u{f012}")
#let signature = symbol("\u{f5b7}")
#let sim-card = symbol("\u{f7c4}")
#let sink = symbol("\u{e06d}")
#let sitemap = symbol("\u{f0e8}")
#let skating = symbol("\u{f7c5}")
#let skiing = symbol(
"\u{f7c9}",
("nordic", "\u{f7ca}"),
)
#let skull = symbol(
"\u{f54c}",
("crossbones", "\u{f714}"),
)
#let slash = symbol("\u{f715}")
#let sleigh = symbol("\u{f7cc}")
#let sliders-h = symbol("\u{f1de}")
#let smile = symbol(
"\u{f118}",
("beam", "\u{f5b8}"),
("wink", "\u{f4da}"),
)
#let smog = symbol("\u{f75f}")
#let smoking = symbol(
"\u{f48d}",
("ban", "\u{f54d}"),
)
#let sms = symbol("\u{f7cd}")
#let snowboarding = symbol("\u{f7ce}")
#let snowflake = symbol("\u{f2dc}")
#let snowman = symbol("\u{f7d0}")
#let snowplow = symbol("\u{f7d2}")
#let soap = symbol("\u{e06e}")
#let socks = symbol("\u{f696}")
#let solar-panel = symbol("\u{f5ba}")
#let sort = symbol(
"\u{f0dc}",
("alpha.down", "\u{f15d}"),
("alpha.down.alt", "\u{f881}"),
("alpha.up", "\u{f15e}"),
("alpha.up.alt", "\u{f882}"),
("amount.down", "\u{f160}"),
("amount.down.alt", "\u{f884}"),
("amount.up", "\u{f161}"),
("amount.up.alt", "\u{f885}"),
("down", "\u{f0dd}"),
("numeric.down", "\u{f162}"),
("numeric.down.alt", "\u{f886}"),
("numeric.up", "\u{f163}"),
("numeric.up.alt", "\u{f887}"),
("up", "\u{f0de}"),
)
#let spa = symbol("\u{f5bb}")
#let space-shuttle = symbol("\u{f197}")
#let spell-check = symbol("\u{f891}")
#let spider = symbol("\u{f717}")
#let spinner = symbol("\u{f110}")
#let splotch = symbol("\u{f5bc}")
#let spray-can = symbol("\u{f5bd}")
#let square = symbol(
"\u{f0c8}",
("full", "\u{f45c}"),
)
#let square-root = symbol("\u{f698}")
#let stamp = symbol("\u{f5bf}")
#let star = symbol(
"\u{f005}",
("crescent", "\u{f699}"),
("half", "\u{f089}"),
("half.alt", "\u{f5c0}"),
("david", "\u{f69a}"),
("life", "\u{f621}"),
)
#let step-backward = symbol("\u{f048}")
#let step-forward = symbol("\u{f051}")
#let stethoscope = symbol("\u{f0f1}")
#let sticky-note = symbol("\u{f249}")
#let stop = symbol(
"\u{f04d}",
("circle", "\u{f28d}"),
)
#let stopwatch = symbol(
"\u{f2f2}",
("sec20", "\u{e06f}"),
)
#let store = symbol(
"\u{f54e}",
("slash", "\u{e071}"),
("alt", "\u{f54f}"),
("alt.slash", "\u{e070}"),
)
#let stream = symbol("\u{f550}")
#let street-view = symbol("\u{f21d}")
#let strikethrough = symbol("\u{f0cc}")
#let stroopwafel = symbol("\u{f551}")
#let subscript = symbol("\u{f12c}")
#let subway = symbol("\u{f239}")
#let suitcase = symbol(
"\u{f0f2}",
("rolling", "\u{f5c1}"),
)
#let sun = symbol("\u{f185}")
#let superscript = symbol("\u{f12b}")
#let surprise = symbol("\u{f5c2}")
#let swatchbook = symbol("\u{f5c3}")
#let swimmer = symbol("\u{f5c4}")
#let swimming-pool = symbol("\u{f5c5}")
#let synagogue = symbol("\u{f69b}")
#let sync = symbol(
"\u{f021}",
("alt", "\u{f2f1}"),
)
#let syringe = symbol("\u{f48e}")
#let table = symbol("\u{f0ce}")
#let table-tennis = symbol("\u{f45d}")
#let tablet = symbol(
"\u{f10a}",
("alt", "\u{f3fa}"),
)
#let tablets = symbol("\u{f490}")
#let tachometer = symbol("\u{f3fd}")
#let tag = symbol(
"\u{f02b}",
("plural", "\u{f02c}"),
)
#let tape = symbol("\u{f4db}")
#let tasks = symbol("\u{f0ae}")
#let taxi = symbol("\u{f1ba}")
#let teeth = symbol(
"\u{f62e}",
("open", "\u{f62f}"),
)
#let temperature = symbol(
("high", "\u{f769}"),
("low", "\u{f76b}"),
)
#let tenge = symbol("\u{f7d7}")
#let terminal = symbol("\u{f120}")
#let text-height = symbol("\u{f034}")
#let text-width = symbol("\u{f035}")
#let th = symbol(
"\u{f00a}",
("large", "\u{f009}"),
("list", "\u{f00b}"),
)
#let theater-masks = symbol("\u{f630}")
#let thermometer = symbol(
"\u{f491}",
("empty", "\u{f2cb}"),
("full", "\u{f2c7}"),
("half", "\u{f2c9}"),
("quarter", "\u{f2ca}"),
("three-quarters", "\u{f2c8}"),
)
#let thumbs = symbol(
("up", "\u{f164}"),
("down", "\u{f165}"),
)
#let thumbtack = symbol("\u{f08d}")
#let ticket = symbol("\u{f3ff}")
#let times = symbol(
"\u{f00d}",
("circle", "\u{f057}"),
)
#let tint = symbol(
"\u{f043}",
("slash", "\u{f5c7}"),
)
#let tired = symbol("\u{f5c8}")
#let toggle = symbol(
("off", "\u{f204}"),
("on", "\u{f205}"),
)
#let toilet = symbol("\u{f7d8}")
#let toilet-paper = symbol(
"\u{f71e}",
("slash", "\u{e072}"),
)
#let toolbox = symbol("\u{f552}")
#let tools = symbol("\u{f7d9}")
#let tooth = symbol("\u{f5c9}")
#let torah = symbol("\u{f6a0}")
#let torii-gate = symbol("\u{f6a1}")
#let tractor = symbol("\u{f722}")
#let trademark = symbol("\u{f25c}")
#let traffic-light = symbol("\u{f637}")
#let trailer = symbol("\u{e041}")
#let train = symbol("\u{f238}")
#let tram = symbol("\u{f7da}")
#let transgender = symbol(
"\u{f224}",
("alt", "\u{f225}"),
)
#let trash = symbol(
"\u{f1f8}",
("alt", "\u{f2ed}"),
("restore", "\u{f829}"),
("restore.alt", "\u{f82a}"),
)
#let tree = symbol("\u{f1bb}")
#let trophy = symbol("\u{f091}")
#let truck = symbol(
"\u{f0d1}",
("loading", "\u{f4de}"),
("monster", "\u{f63b}"),
("moving", "\u{f4df}"),
("pickup", "\u{f63c}"),
)
#let tshirt = symbol("\u{f553}")
#let tty = symbol("\u{f1e4}")
#let tv = symbol("\u{f26c}")
#let umbrella = symbol(
"\u{f0e9}",
("beach", "\u{f5ca}"),
)
#let underline-icon = symbol("\u{f0cd}")
#let undo = symbol(
"\u{f0e2}",
("alt", "\u{f2ea}"),
)
#let universal-access = symbol("\u{f29a}")
#let university = symbol("\u{f19c}")
#let unlink = symbol("\u{f127}")
#let unlock = symbol(
"\u{f09c}",
("alt", "\u{f13e}"),
)
#let upload = symbol("\u{f093}")
#let user = symbol(
"\u{f007}",
("alt", "\u{f406}"),
("alt.slash", "\u{f4fa}"),
("astronaut", "\u{f4fb}"),
("check", "\u{f4fc}"),
("circle", "\u{f2bd}"),
("clock", "\u{f4fd}"),
("cog", "\u{f4fe}"),
("edit", "\u{f4ff}"),
("friends", "\u{f500}"),
("graduate", "\u{f501}"),
("injured", "\u{f728}"),
("lock", "\u{f502}"),
("md", "\u{f0f0}"),
("minus", "\u{f503}"),
("ninja", "\u{f504}"),
("nurse", "\u{f82f}"),
("plus", "\u{f234}"),
("secret", "\u{f21b}"),
("shield", "\u{f505}"),
("slash", "\u{f506}"),
("tag", "\u{f507}"),
("tie", "\u{f508}"),
("times", "\u{f235}"),
("plural", "\u{f0c0}"),
("plural.cog", "\u{f509}"),
("plural.slash", "\u{e073}"),
)
#let utensils = symbol(
"\u{f2e7}",
("spoon", "\u{f2e5}"),
)
#let vector-square = symbol("\u{f5cb}")
#let venus = symbol(
"\u{f221}",
("double", "\u{f226}"),
("mars", "\u{f228}"),
)
#let vest = symbol(
"\u{e085}",
("patches", "\u{e086}"),
)
#let vial = symbol(
"\u{f492}",
("plural", "\u{f493}"),
)
#let video = symbol(
"\u{f03d}",
("slash", "\u{f4e2}"),
)
#let vihara = symbol("\u{f6a7}")
#let virus = symbol(
"\u{e074}",
("slash", "\u{e075}"),
("plural", "\u{e076}"),
)
#let voicemail = symbol("\u{f897}")
#let volume = symbol(
("down", "\u{f027}"),
("mute", "\u{f6a9}"),
("off", "\u{f026}"),
("up", "\u{f028}"),
)
#let vote-yea = symbol("\u{f772}")
#let vr-cardboard = symbol("\u{f729}")
#let walking = symbol("\u{f554}")
#let wallet = symbol("\u{f555}")
#let warehouse = symbol("\u{f494}")
#let water = symbol("\u{f773}")
#let wave-square = symbol("\u{f83e}")
#let weight = symbol("\u{f496}")
#let weight-hanging = symbol("\u{f5cd}")
#let wheelchair = symbol("\u{f193}")
#let wifi = symbol("\u{f1eb}")
#let wind = symbol("\u{f72e}")
#let window = symbol(
("close", "\u{f410}"),
("maximize", "\u{f2d0}"),
("minimize", "\u{f2d1}"),
("restore", "\u{f2d2}"),
)
#let wine = symbol(
("bottle", "\u{f72f}"),
("glass", "\u{f4e3}"),
("glass-alt", "\u{f5ce}"),
)
#let wrench = symbol("\u{f0ad}")
#let x-ray = symbol("\u{f497}")
#let yin-yang = symbol("\u{f6ad}")
// Brand icons
#let px500 = symbol("\u{f26e}")
#let accessible-icon = symbol("\u{f368}")
#let accusoft = symbol("\u{f369}")
#let acquisitions-incorporated = symbol("\u{f6af}")
#let adn = symbol("\u{f170}")
#let adversal = symbol("\u{f36a}")
#let affiliatetheme = symbol("\u{f36b}")
#let airbnb = symbol("\u{f834}")
#let algolia = symbol("\u{f36c}")
#let alipay = symbol("\u{f642}")
#let amazon = symbol(
"\u{f270}",
("pay", "\u{f42c}"),
("pay.cc", "\u{f42d}")
)
#let amilia = symbol("\u{f36d}")
#let android = symbol("\u{f17b}")
#let angellist = symbol("\u{f209}")
#let angrycreative = symbol("\u{f36e}")
#let angular = symbol("\u{f420}")
#let app-store = symbol(
"\u{f36f}",
("ios", "\u{f370}"),
)
#let apper = symbol("\u{f371}")
#let artstation = symbol("\u{f77a}")
#let asymmetrik = symbol("\u{f372}")
#let atlassian = symbol("\u{f77b}")
#let audible = symbol("\u{f373}")
#let autoprefixer = symbol("\u{f41c}")
#let avianex = symbol("\u{f374}")
#let aviato = symbol("\u{f421}")
#let aws = symbol("\u{f375}")
#let bandcamp = symbol("\u{f2d5}")
#let battle-net = symbol("\u{f835}")
#let behance = symbol(
"\u{f1b4}",
("square", "\u{f1b5}"),
)
#let bimobject = symbol("\u{f378}")
#let bitbucket = symbol("\u{f171}")
#let bitcoin = symbol("\u{f379}")
#let bity = symbol("\u{f37a}")
#let black-tie = symbol("\u{f27e}")
#let blackberry = symbol("\u{f37b}")
#let blogger = symbol(
"\u{f37c}",
("b", "\u{f37d}"),
)
#let bluetooth = symbol(
"\u{f293}",
("b", "\u{f294}"),
)
#let bootstrap = symbol("\u{f836}")
#let btc = symbol("\u{f15a}")
#let buffer = symbol("\u{f837}")
#let buromobelexperte = symbol("\u{f37f}")
#let buy-n-large = symbol("\u{f8a6}")
#let canadian-maple-leaf = symbol("\u{f785}")
#let amex = symbol("\u{f1f3}")
#let diners-club = symbol("\u{f24c}")
#let discover = symbol("\u{f1f2}")
#let jcb = symbol("\u{f24b}")
#let mastercard = symbol("\u{f1f1}")
#let visa = symbol("\u{f1f0}")
#let centercode = symbol("\u{f380}")
#let centos = symbol("\u{f789}")
#let chrome = symbol("\u{f268}")
#let chromecast = symbol("\u{f838}")
#let cloudflare = symbol("\u{e07d}")
#let cloudscale = symbol("\u{f383}")
#let cloudsmith = symbol("\u{f384}")
#let cloudversify = symbol("\u{f385}")
#let codepen = symbol("\u{f1cb}")
#let codiepie = symbol("\u{f284}")
#let confluence = symbol("\u{f78d}")
#let connectdevelop = symbol("\u{f20e}")
#let contao = symbol("\u{f26d}")
#let cotton-bureau = symbol("\u{f89e}")
#let cpanel = symbol("\u{f388}")
#let creative-commons = symbol(
"\u{f25e}",
("by", "\u{f4e7}"),
("nc", "\u{f4e8}"),
("nc.eu", "\u{f4e9}"),
("nc.jp", "\u{f4ea}"),
("nd", "\u{f4eb}"),
("pd", "\u{f4ec}"),
("pd.alt", "\u{f4ed}"),
("remix", "\u{f4ee}"),
("sa", "\u{f4ef}"),
("sampling", "\u{f4f0}"),
("sampling.plus", "\u{f4f1}"),
("share", "\u{f4f2}"),
("zero", "\u{f4f3}"),
)
#let critical-role = symbol("\u{f6c9}")
#let css3 = symbol(
"\u{f13c}",
("alt", "\u{f38b}"),
)
#let cuttlefish = symbol("\u{f38c}")
#let d-and-d = symbol("\u{f38d}")
#let d-and-d-beyond = symbol("\u{f6ca}")
#let dailymotion = symbol("\u{e052}")
#let dashcube = symbol("\u{f210}")
#let deezer = symbol("\u{e077}")
#let delicious = symbol("\u{f1a5}")
#let deploydog = symbol("\u{f38e}")
#let deskpro = symbol("\u{f38f}")
#let dev = symbol("\u{f6cc}")
#let deviantart = symbol("\u{f1bd}")
#let dhl = symbol("\u{f790}")
#let diaspora = symbol("\u{f791}")
#let digg = symbol("\u{f1a6}")
#let digital-ocean = symbol("\u{f391}")
#let discord = symbol("\u{f392}")
#let discourse = symbol("\u{f393}")
#let dochub = symbol("\u{f394}")
#let docker = symbol("\u{f395}")
#let draft2digital = symbol("\u{f396}")
#let dribbble = symbol(
"\u{f17d}",
("square", "\u{f397}"),
)
#let dropbox = symbol("\u{f16b}")
#let drupal = symbol("\u{f1a9}")
#let dyalog = symbol("\u{f399}")
#let earlybirds = symbol("\u{f39a}")
#let ebay = symbol("\u{f4f4}")
#let edge = symbol(
"\u{f282}",
("legacy", "\u{e078}"),
)
#let elementor = symbol("\u{f430}")
#let ello = symbol("\u{f5f1}")
#let ember = symbol("\u{f423}")
#let empire = symbol("\u{f1d1}")
#let envira = symbol("\u{f299}")
#let erlang = symbol("\u{f39d}")
#let ethereum = symbol("\u{f42e}")
#let etsy = symbol("\u{f2d7}")
#let evernote = symbol("\u{f839}")
#let expeditedssl = symbol("\u{f23e}")
#let facebook = symbol(
"\u{f09a}",
("f", "\u{f39e}"),
("messenger", "\u{f39f}"),
("square", "\u{f082}"),
)
#let fantasy-flight-games = symbol("\u{f6dc}")
#let fedex = symbol("\u{f797}")
#let fedora = symbol("\u{f798}")
#let figma = symbol("\u{f799}")
#let firefox = symbol(
"\u{f269}",
("browser", "\u{e007}"),
)
#let first-order = symbol(
"\u{f2b0}",
("alt", "\u{f50a}"),
)
#let firstdraft = symbol("\u{f3a1}")
#let flickr = symbol("\u{f16e}")
#let flipboard = symbol("\u{f44d}")
#let fly = symbol("\u{f417}")
#let font-awesome = symbol(
"\u{f2b4}",
("alt", "\u{f35c}"),
("flag", "\u{f425}"),
)
#let fonticons = symbol(
"\u{f280}",
("fi", "\u{f3a2}"),
)
#let fort-awesome = symbol(
"\u{f286}",
("alt", "\u{f3a3}"),
)
#let forumbee = symbol("\u{f211}")
#let foursquare = symbol("\u{f180}")
#let free-code-camp = symbol("\u{f2c5}")
#let freebsd = symbol("\u{f3a4}")
#let fulcrum = symbol("\u{f50b}")
#let galactic-republic = symbol("\u{f50c}")
#let galactic-senate = symbol("\u{f50d}")
#let get-pocket = symbol("\u{f265}")
#let gg = symbol(
"\u{f260}",
("circle", "\u{f261}"),
)
#let git = symbol(
"\u{f1d3}",
("alt", "\u{f841}"),
("square", "\u{f1d2}"),
)
#let github = symbol(
"\u{f09b}",
("alt", "\u{f113}"),
("square", "\u{f092}"),
)
#let gitkraken = symbol("\u{f3a6}")
#let gitlab = symbol("\u{f296}")
#let gitter = symbol("\u{f426}")
#let glide = symbol(
"\u{f2a5}",
("g", "\u{f2a6}"),
)
#let gofore = symbol("\u{f3a7}")
#let goodreads = symbol(
"\u{f3a8}",
("g", "\u{f3a9}"),
)
#let google = symbol(
"\u{f1a0}",
("drive", "\u{f3aa}"),
("pay", "\u{e079}"),
("play", "\u{f3ab}"),
("plus", "\u{f2b3}"),
("plus-g", "\u{f0d5}"),
("plus-square", "\u{f0d4}"),
("wallet", "\u{f1ee}"),
)
#let gratipay = symbol("\u{f184}")
#let grav = symbol("\u{f2d6}")
#let gripfire = symbol("\u{f3ac}")
#let grunt = symbol("\u{f3ad}")
#let guilded = symbol("\u{e07e}")
#let gulp = symbol("\u{f3ae}")
#let hacker-news = symbol(
"\u{f1d4}",
("square", "\u{f3af}"),
)
#let hackerrank = symbol("\u{f5f7}")
#let hips = symbol("\u{f452}")
#let hire-a-helper = symbol("\u{f3b0}")
#let hive = symbol("\u{e07f}")
#let hooli = symbol("\u{f427}")
#let hornbill = symbol("\u{f592}")
#let hotjar = symbol("\u{f3b1}")
#let houzz = symbol("\u{f27c}")
#let html5 = symbol("\u{f13b}")
#let hubspot = symbol("\u{f3b2}")
#let ideal = symbol("\u{e013}")
#let imdb = symbol("\u{f2d8}")
#let innosoft = symbol("\u{e080}")
#let instagram = symbol(
"\u{f16d}",
("square", "\u{e055}"),
)
#let instalod = symbol("\u{e081}")
#let intercom = symbol("\u{f7af}")
#let internet-explorer = symbol("\u{f26b}")
#let invision = symbol("\u{f7b0}")
#let ioxhost = symbol("\u{f208}")
#let itch-io = symbol("\u{f83a}")
#let itunes = symbol(
"\u{f3b4}",
("note", "\u{f3b5}"),
)
#let java = symbol("\u{f4e4}")
#let jedi-order = symbol("\u{f50e}")
#let jenkins = symbol("\u{f3b6}")
#let jira = symbol("\u{f7b1}")
#let joget = symbol("\u{f3b7}")
#let joomla = symbol("\u{f1aa}")
#let js = symbol(
"\u{f3b8}",
("square", "\u{f3b9}"),
)
#let jsfiddle = symbol("\u{f1cc}")
#let kaggle = symbol("\u{f5fa}")
#let keybase = symbol("\u{f4f5}")
#let keycdn = symbol("\u{f3ba}")
#let kickstarter = symbol(
"\u{f3bb}",
("k", "\u{f3bc}"),
)
#let korvue = symbol("\u{f42f}")
#let laravel = symbol("\u{f3bd}")
#let lastfm = symbol("\u{f202}")
#let lastfm-square = symbol("\u{f203}")
#let leanpub = symbol("\u{f212}")
#let less = symbol("\u{f41d}")
#let line-icon = symbol("\u{f3c0}")
#let linkedin = symbol(
"\u{f08c}",
("in", "\u{f0e1}"),
)
#let linode = symbol("\u{f2b8}")
#let linux = symbol("\u{f17c}")
#let lyft = symbol("\u{f3c3}")
#let magento = symbol("\u{f3c4}")
#let mailchimp = symbol("\u{f59e}")
#let mandalorian = symbol("\u{f50f}")
#let markdown = symbol("\u{f60f}")
#let mastodon = symbol("\u{f4f6}")
#let maxcdn = symbol("\u{f136}")
#let mdb = symbol("\u{f8ca}")
#let medapps = symbol("\u{f3c6}")
#let medium = symbol(
"\u{f23a}",
("m", "\u{f3c7}"),
)
#let medrt = symbol("\u{f3c8}")
#let meetup = symbol("\u{f2e0}")
#let megaport = symbol("\u{f5a3}")
#let mendeley = symbol("\u{f7b3}")
#let microblog = symbol("\u{e01a}")
#let microsoft = symbol("\u{f3ca}")
#let mix = symbol("\u{f3cb}")
#let mixcloud = symbol("\u{f289}")
#let mixer = symbol("\u{e056}")
#let mizuni = symbol("\u{f3cc}")
#let modx = symbol("\u{f285}")
#let monero = symbol("\u{f3d0}")
#let napster = symbol("\u{f3d2}")
#let neos = symbol("\u{f612}")
#let nimblr = symbol("\u{f5a8}")
#let node = symbol(
"\u{f419}",
("js", "\u{f3d3}"),
)
#let npm = symbol("\u{f3d4}")
#let ns8 = symbol("\u{f3d5}")
#let nutritionix = symbol("\u{f3d6}")
#let octopus-deploy = symbol("\u{e082}")
#let odnoklassniki = symbol(
"\u{f263}",
("square", "\u{f264}"),
)
#let old-republic = symbol("\u{f510}")
#let opencart = symbol("\u{f23d}")
#let openid = symbol("\u{f19b}")
#let opera = symbol("\u{f26a}")
#let optin-monster = symbol("\u{f23c}")
#let orcid = symbol("\u{f8d2}")
#let osi = symbol("\u{f41a}")
#let page4 = symbol("\u{f3d7}")
#let pagelines = symbol("\u{f18c}")
#let palfed = symbol("\u{f3d8}")
#let patreon = symbol("\u{f3d9}")
#let paypal = symbol(
"\u{f1ed}",
("cc", "\u{f1f4}"),
)
#let penny-arcade = symbol("\u{f704}")
#let perbyte = symbol("\u{e083}")
#let periscope = symbol("\u{f3da}")
#let phabricator = symbol("\u{f3db}")
#let phoenix-framework = symbol("\u{f3dc}")
#let phoenix-squadron = symbol("\u{f511}")
#let php = symbol("\u{f457}")
#let pied-piper = symbol(
"\u{f2ae}",
("alt", "\u{f1a8}"),
("hat", "\u{f4e5}"),
("pp", "\u{f1a7}"),
("square", "\u{e01e}"),
)
#let pinterest = symbol(
"\u{f0d2}",
("p", "\u{f231}"),
("square", "\u{f0d3}"),
)
#let playstation = symbol("\u{f3df}")
#let product-hunt = symbol("\u{f288}")
#let pushed = symbol("\u{f3e1}")
#let python = symbol("\u{f3e2}")
#let qq = symbol("\u{f1d6}")
#let quinscape = symbol("\u{f459}")
#let quora = symbol("\u{f2c4}")
#let r-project = symbol("\u{f4f7}")
#let raspberry-pi = symbol("\u{f7bb}")
#let ravelry = symbol("\u{f2d9}")
#let react = symbol("\u{f41b}")
#let reacteurope = symbol("\u{f75d}")
#let readme = symbol("\u{f4d5}")
#let rebel = symbol("\u{f1d0}")
#let red-river = symbol("\u{f3e3}")
#let reddit = symbol(
"\u{f1a1}",
("alien", "\u{f281}"),
("square", "\u{f1a2}"),
)
#let redhat = symbol("\u{f7bc}")
#let renren = symbol("\u{f18b}")
#let replyd = symbol("\u{f3e6}")
#let researchgate = symbol("\u{f4f8}")
#let resolving = symbol("\u{f3e7}")
#let rev = symbol("\u{f5b2}")
#let rocketchat = symbol("\u{f3e8}")
#let rockrms = symbol("\u{f3e9}")
#let rust = symbol("\u{e07a}")
#let safari = symbol("\u{f267}")
#let salesforce = symbol("\u{f83b}")
#let sass = symbol("\u{f41e}")
#let schlix = symbol("\u{f3ea}")
#let scribd = symbol("\u{f28a}")
#let searchengin = symbol("\u{f3eb}")
#let sellcast = symbol("\u{f2da}")
#let sellsy = symbol("\u{f213}")
#let servicestack = symbol("\u{f3ec}")
#let shirtsinbulk = symbol("\u{f214}")
#let shopify = symbol("\u{e057}")
#let shopware = symbol("\u{f5b5}")
#let simplybuilt = symbol("\u{f215}")
#let sistrix = symbol("\u{f3ee}")
#let sith = symbol("\u{f512}")
#let sketch = symbol("\u{f7c6}")
#let skyatlas = symbol("\u{f216}")
#let skype = symbol("\u{f17e}")
#let slack = symbol(
"\u{f198}",
("hash", "\u{f3ef}"),
)
#let slideshare = symbol("\u{f1e7}")
#let snapchat = symbol(
"\u{f2ab}",
("ghost", "\u{f2ac}"),
("square", "\u{f2ad}"),
)
#let soundcloud = symbol("\u{f1be}")
#let sourcetree = symbol("\u{f7d3}")
#let speakap = symbol("\u{f3f3}")
#let speaker-deck = symbol("\u{f83c}")
#let spotify = symbol("\u{f1bc}")
#let squarespace = symbol("\u{f5be}")
#let stack-exchange = symbol("\u{f18d}")
#let stack-overflow = symbol("\u{f16c}")
#let stackpath = symbol("\u{f842}")
#let staylinked = symbol("\u{f3f5}")
#let steam = symbol(
"\u{f1b6}",
("square", "\u{f1b7}"),
("symbol", "\u{f3f6}"),
)
#let sticker-mule = symbol("\u{f3f7}")
#let strava = symbol("\u{f428}")
#let stripe = symbol(
"\u{f429}",
("s", "\u{f42a}"),
("cc", "\u{f1f5}"),
)
#let studiovinari = symbol("\u{f3f8}")
#let stumbleupon = symbol(
"\u{f1a4}",
("circle", "\u{f1a3}"),
)
#let superpowers = symbol("\u{f2dd}")
#let supple = symbol("\u{f3f9}")
#let suse = symbol("\u{f7d6}")
#let swift = symbol("\u{f8e1}")
#let symfony = symbol("\u{f83d}")
#let teamspeak = symbol("\u{f4f9}")
#let telegram = symbol(
"\u{f2c6}",
("plane", "\u{f3fe}"),
)
#let tencent-weibo = symbol("\u{f1d5}")
#let the-red-yeti = symbol("\u{f69d}")
#let themeco = symbol("\u{f5c6}")
#let themeisle = symbol("\u{f2b2}")
#let think-peaks = symbol("\u{f731}")
#let tiktok = symbol("\u{e07b}")
#let trade-federation = symbol("\u{f513}")
#let trello = symbol("\u{f181}")
#let tumblr = symbol(
"\u{f173}",
("square", "\u{f174}"),
)
#let twitch = symbol("\u{f1e8}")
#let twitter = symbol(
"\u{f099}",
("square", "\u{f081}"),
)
#let typo3 = symbol("\u{f42b}")
#let uber = symbol("\u{f402}")
#let ubuntu = symbol("\u{f7df}")
#let uikit = symbol("\u{f403}")
#let umbraco = symbol("\u{f8e8}")
#let uncharted = symbol("\u{e084}")
#let uniregistry = symbol("\u{f404}")
#let unity = symbol("\u{e049}")
#let unsplash = symbol("\u{e07c}")
#let untappd = symbol("\u{f405}")
#let ups = symbol("\u{f7e0}")
#let usb = symbol("\u{f287}")
#let usps = symbol("\u{f7e1}")
#let ussunnah = symbol("\u{f407}")
#let vaadin = symbol("\u{f408}")
#let viacoin = symbol("\u{f237}")
#let viadeo = symbol(
"\u{f2a9}",
("square", "\u{f2aa}"),
)
#let viber = symbol("\u{f409}")
#let vimeo = symbol(
"\u{f40a}",
("square", "\u{f194}"),
("v", "\u{f27d}"),
)
#let vine = symbol("\u{f1ca}")
#let vk = symbol("\u{f189}")
#let vnv = symbol("\u{f40b}")
#let vuejs = symbol("\u{f41f}")
#let watchman-monitoring = symbol("\u{e087}")
#let waze = symbol("\u{f83f}")
#let weebly = symbol("\u{f5cc}")
#let weibo = symbol("\u{f18a}")
#let weixin = symbol("\u{f1d7}")
#let whatsapp = symbol(
"\u{f232}",
("square", "\u{f40c}"),
)
#let whmcs = symbol("\u{f40d}")
#let wikipedia = symbol("\u{f266}")
#let windows = symbol("\u{f17a}")
#let wix = symbol("\u{f5cf}")
#let wizards-of-the-coast = symbol("\u{f730}")
#let wodu = symbol("\u{e088}")
#let wolf-pack-battalion = symbol("\u{f514}")
#let wordpress = symbol(
"\u{f19a}",
("simple", "\u{f411}"),
)
#let wpbeginner = symbol("\u{f297}")
#let wpexplorer = symbol("\u{f2de}")
#let wpforms = symbol("\u{f298}")
#let wpressr = symbol("\u{f3e4}")
#let xbox = symbol("\u{f412}")
#let xing = symbol(
"\u{f168}",
("square", "\u{f169}"),
)
#let y-combinator = symbol("\u{f23b}")
#let yahoo = symbol("\u{f19e}")
#let yammer = symbol("\u{f840}")
#let yandex = symbol(
"\u{f413}",
("international", "\u{f414}"),
)
#let yarn = symbol("\u{f7e3}")
#let yelp = symbol("\u{f1e9}")
#let yoast = symbol("\u{f2b1}")
#let youtube = symbol(
"\u{f167}",
("square", "\u{f431}"),
)
#let zhihu = symbol("\u{f63f}")
|
https://github.com/npujol/chuli-cv | https://raw.githubusercontent.com/npujol/chuli-cv/main/template/letter.typ | typst | MIT License | #import "@local/typcv:0.1.0": *
#show: cover_letter
#set text(size: 12pt)
#letterHeader(
name: "<NAME>",
address: [1 Rue Gonnet \ 75003 Paris, France],
recipientName: [Bebop],
recipientAddress: [15 Sky Road \ 5000 Earth],
date: [06/05/2069],
subject: "Subject: Job Application for Anything"
)
Dear Hiring Manager,
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.
Sincerely,
#letterFooter(
name: "<NAME>",
)
#letterSignature(image("/media/signature.jpeg", width: 25%)) |
https://github.com/engboris/cv-template | https://raw.githubusercontent.com/engboris/cv-template/main/README.md | markdown | MIT License | # cv-template
Simple but effective CV template in Typst
|
https://github.com/zenor0/FZU-report-typst-template | https://raw.githubusercontent.com/zenor0/FZU-report-typst-template/main/fzu-report/parts/terminology.typ | typst | MIT License | #let terminology-conf(terminology) = {
set page(
numbering: "I",
number-align: center
)
heading(numbering: none, level: 1, outlined: true, bookmarked: true)[本论文专用术语的注释表]
terminology
} |
https://github.com/Ttajika/typst_template_tajika | https://raw.githubusercontent.com/Ttajika/typst_template_tajika/main/example.typ | typst | #import "libs/template.typ": *
//以下のテンプレートおよびその変数は自作です.template.typを見て,うまくカスタマイズしてください.
#show: project.with(
title: [Typst Template#footnote[This template assumes version 0.11.0]],
authors: (
"<NAME>", "The other Author"
), //,で区切って著者名を追加します
notes: ([日本大学経済学部, #link("mailto:<EMAIL>")[tajika.tomoya\u{0040}nihon-u.ac.jp]],[Institutions and mail address]), //AuthorにつけられるNoteです.
lang: "en", //ここをjpに変えると表や定理の名称が全て日本語になる.他の言語は未対応
date: Today(style:"ymd-jp"), //年月日のスタイル ymd-en, mdy-en,mdy-en-abr, ymd-jp, ymd-jp-warekiなどのスタイルがある
abstract: [Typstの機能の個人的なメモです。数ある機能のうちのほんの少しを紹介しています。Typst 0.11.0を前提にしています。],
//フォントサイズの設定
font-size: 12pt,
//フォントの設定, 以下はデフォルトです.フォントがない場合は適当なフォントで代替されます.使用できるフォントはコマンドラインで typst fonts で調べることができます.
body-font: ("Times","Hiragino Mincho Pro"), //地の文のフォント
sans-font: ("Times","Hiragino Kaku Gothic Pro"), //強調やheadingに使うフォント
math-font: ("STIX Two Math","Hiragino Mincho Pro"), //数式フォント
//行間の設定
leading: 1.2em,
//マージンの設定
margin: (left:1in, top:1in, right:1in, bottom:1in),
//その他
keywords:none,
JEL: none
)
#set raw(theme: "halcyon.tmTheme")
#show raw: it => box(
fill: rgb("#1d2433"),
inset: 4pt,
radius: 5pt,
text(fill: rgb("#a2aabc"), it)
,baseline: 20%)
= Typstについて
- TeX/LaTeXに代わる(かもしれない)組版システム
- 特徴
- TeX/LaTeXよりコンパイルが早い(リアルタイム)
- 直観的な構文
- カスタマイズの容易さ
- エラーメッセージのわかりやすさ
- 詳しく知りたい方は公式ドキュメント(https://typst.app/docs/reference)を読むこと。
= 使用方法/インストール方法
- 公式アプリ(https://typst.app)が使いやすいのでそちらを使ってみましょう。
- ローカルにインストールするには\ https://github.com/typst/typst#installation をご覧ください
- macならターミナルで以下のように入力する。
```c brew install typst```
- Windowsでもいろいろ方法があります。
- 例えば「アプリインストーラー」がインストールされていれば#footnote[Windows 10/11 であれば既にインストールされているか、Microsoft Storeにあります。「アプリインストーラー」で検索してみてください。]Powershell/コマンドプロンプトから以下のように入力します。
```c winget install --id Typst.Typst```
- エディタはいろいろありますが VS code では Typst LSP および Typst Preview の二つの拡張機能をインストールします.
- Typst のバージョンのアップデートには、インストール時と同じことをするか、v0.8.0以降であればpowershell/コマンドプロンプトやターミナルから
```c typst update```
でアップデートされます。
= 簡単な使い方
== はじめに
初めにいろいろ文字を入力してみましょう。Typstでは書いた文字がそのまま反映されます。
=== 見出し
見出しは次のように設定します。
```typ
= 見出しレベル1
== 見出しレベル2
```
見出しのレベルは`=`を重ねると下がります。
Typstでは特殊な機能を使うために`#`を用います。```#```のついた命令は *関数* といいます。
例えば見出しは次のようにも書くことができます。
```typ
#heading("見出し")
```
見出しのレベルを設定するには次のようにします。
```typ
#heading("見出し",level:2)
```
また、次のようにすれば見出しに番号をつけることができます。
```typ
#heading("見出し",numbering:"1.1")
```
//デフォルトで番号をつけるようにするには @default 節を参照してください。
=== 箇条書き
箇条書きは次のようにします。
```typ
- 箇条書き項目1
- 箇条書き項目2
```
これによって次のように出力されます。
- 箇条書き項目1
- 箇条書き項目2
箇条書きのレベルを下げるにはインデントを下げる(Tabキーで空白を開ける)だけで十分です。
```typ
- 箇条書き項目1
- 箇条書き項目2
```
また、番号付きの箇条書きをするには次のように入力します。
```typ
+ 箇条書き項目1
+ 箇条書き項目2
```
これによって次のように出力されます。
+ 箇条書き項目1
+ 箇条書き項目2
箇条書きの記号や番号の設定については @default をご覧ください。
=== 脚注
脚注は```typ #footnote[脚注の中身]```と入力します#footnote[このように脚注ができます。]。
=== 改行
改行には`\`を用います。
=== 段落の左/右/中央揃え
段落を右揃えにしたり中央揃えにするには```typ #align```を用います。
```typ
#align(center, "中央に配置")
```
と入力すれば次のように配置されます。
#align(center, "中央に配置")
=== 文章の強調
斜体は```typ _italic_```、あるいは```typ #emph[italic]```とします。そうすれば _italic_ と表示されます。太字は```typ *strong*```、あるいは```typ #strong[strong]```とします。そうすれば *strong* と表示されます。
=== 下線を引く
下線を引くには```typ #underline[下線を引く]```とします。そうすれば#underline[下線を引く]と出力されます。
=== 文字色/ハイライト
文字色を変更するには```typ #text(fill:red)[赤い文字]```とします。そうすると #text(fill:red)[赤い文字] と出力できます。
#highlight[ハイライトで強調]するには```typ #highlight[ハイライトで強調]```と入力します.
== 数式
Typstで数式は
```typ
$x^2$
```
などと入力します。これによって$x^2$と出力できます。基本的に`$`
で囲んだ領域は数式モードになります。
- いくつか関数などもあります。以下が例です.#footnote[LaTeXのように`\`をつける必要はありません。]
- $x_2$: ```typ x_2```
- $sin(x)$: ```typ $sin(x)$```
- $lim_(x -> infinity) x$: ```typ $lim_(x -> infinity) x$```
- $sum_(x=1)^n x^2$: ```typ $sum_(x=1)^n x^2$```
- $1/2$: ```typ $1/2$```
- $(diff f)/(diff x)$: ```typ $(diff f)/(diff x)$```
- $(dif f)/(dif x)$: ```typ $(dif f)/(dif x)$```
- $integral_a^b f(x)dif x$: ```typ $integral_a^b f(x)dif x$```
- $[1/2,1]$: ```typ $[1/2,1]$ ```
- $[1/2,1)$: ```typ $[1/2,1)$ ```
- $RR$: ```typ $RR$```
- 記号のリストについては以下を参照してください。\
https://typst.app/docs/reference/symbols/sym/
- こちらは手書きで記号を探すアプリです.\ https://detypify.quarticcat.com/
また、```typ $ f(x)$```のように```typ $```の後にスペースを入れるか、あるいは改行するとディスプレイ数式ができます。例えば次のような入力をしてみましょう。
```typ
$
f(x)&=integral_0^x y dif y \
&= x^2/2
$
```
すると次のように出力されます。
$
f(x)&=integral_0^x y dif y \
&= x^2/2
$
ここで`\`は改行、`&`は位置を揃えることを意味します。
またカッコの大きさは自動で調整されます.ただし||は自動調整されません.なので絶対値やノルムは ```typ $abs(a)$,$norm(x/2)$``` と入力します.そうすると$abs(a^2)$,$norm(x/2)$と出力されます,
長々しい数式を繰り返し使うときは```typ #let```をつかって省略してみましょう.例えば以下のようにしてみてください.
```typ
#let Bnm = $sum_(i=0)^(n) binom(n,i) x^i (1-x)^(n-i)$
$Bnm$
```
こうすることで```typ Bnm```を新しい数学記号として定義できるのです.
ここの文字列は既存のものとかぶっていなければ何でも良いです.(出力がおかしい場合には既存のものとかぶっている可能性があるので少し変更してみましょう)
数式について詳しくは https://typst.app/docs/reference/math/ をご覧ください.
== 図表
図表を
=== 図
図には```typ #image```を使います.画像を取り込むときは```typ #image(ファイル名.拡張子)```とします.詳しくは以下のページを参照してください
=== 表
表は以下のように書きます.
```typ
table(columns:3,[1],[2],[3],[4])
```
#table(columns:3,[1],[2],[3],[4])
このように columnsで列の数を指定すれば,あとは配列を書き連ねると表を組版してくれます.
より細かい設定は以下をご覧ください
https://typst.app/docs/reference/model/table/
== 相互参照/引用<ref>
引用したい図.数式や見出しにラベルをつけます.ラベルの名称は何でも良いです.
ラベルをつけられるのは, figure, heading, math.equation, footnoteのみです
```typ
= 引用したい節<label>
@label で引用できます.
```
- 図表を参照するには以下のようにfigureで囲む必要があります.figureの後ろにラベルをつけます.
```
#figure(
#table([],[],[])
caption: "my first table"
)<table>
```
- 詳しくは以下を参照してください
https://typst.app/docs/reference/model/figure/
- 文献の引用にはBibTeXが使えます.まずbibファイルを作成し#footnote[例えば https://mathlandscape.com/latex-bib/ を参照のこと],参考文献を出力したい場所に以下のように入力した上で参照キーを```typ @```を使って引用すれば引用文献が参考文献リストに現れます.
詳しくはこちらを参照してください
https://typst.app/docs/reference/model/bibliography/
== パッケージ
パッケージを利用することでTypstの機能を拡張できます。パッケージの一覧はこちらです。https://typst.app/universe
パッケージの一例を挙げれば次のようなものがあります.
/ #link("https://typst.app/universe/package/physica")[Physica]: 数式関数の拡張.より容易に数式を書くことができます.
/ #link("https://github.com/typst/packages/tree/main/packages/preview/lemmify/0.1.2")[Lemmify]: 定理環境
/ #link("https://github.com/typst/packages/tree/main/packages/preview/cetz/0.1.1")[CeTZ]: 図の描画(LaTeXで言うTikZのようなもの)
/ #link("https://github.com/typst/packages/tree/main/packages/preview/showybox/1.1.0")[Showybox]: カスタマイズ可能なボックス(LaTeXで言うtcolorbox)
= カスタマイズする
== set-show rule <default>
ここでは関数のデフォルトを変更することを考えます。
例えば、フォントを変更したいときには次のようにします。
```typ
#set text(font:"フォントの名前")
```
このように```typ #set```を使うことでデフォルトを変更できます。
他にも、箇条書きの記号を変更するときは次のようにします。
```typ
#set list(marker: ([•], [--]))
- Top-level
- Nested
- Items
- Items
```
これによって記号を次のように変更できます。
#set list(marker: ([•], [--]))
- Top-level
- Nested
- Items
- Items
Typstの関数にはカスタマイズできる項目が多数あり、それを
```typ #set```を使うことで変更しています。
これに対して、```typ #show```関数を使うと、関数を丸ごとカスタマイズすることができます。例えば以下のようにすれば強調関数をそのまま書き換えることができます。
```typ
#show strong: it => {text(fill:red)[[#it.body]]}
*強調*
```
set-rule や show-rule について詳しくは以下を見てください。
https://typst.app/docs/reference/styling/
== 自作関数/変数
```#let```命令を使うことで、自作の関数を作ることができます。
例えば以下のようにします。
```typ
#let pd(num,denom) = {$(diff num)/(diff denom)$}
$pd(f,x)$
```
そうすると次のように出力されます。
#let pd(num,denom) = {$(diff num)/(diff denom)$}
$pd(f,x)$
デフォルトを設定することもできます。例えば次のようにしてみましょう。
```typ
#let pd(num,denom,mode:none) = {
if mode == "D" {
$D_(denom) num$
}
else {
$(diff num)/(diff denom)$
}
}
```
#let pd(num,denom,mode:none) = {
if mode == "D" {
$D_(denom) num$
}
else {
$(diff num)/(diff denom)$
}
}
すると、デフォルトで```typ $pd(f,x)$```を入力すれば$pd(f,x)$が, ```typ $pd(f,x,mode:"D")$```とすれば$pd(f,x,mode:"D")$と主力されます。
なお,physicaパッケージを用いれば,偏微分などの記号は設定されています.
= このテンプレートに含まれる機能
このファイル自体がテンプレートになっています.必要に応じて,書き換えてみてください.
== 数式の自動参照
以下の関数を使うと,数式は,参照されたときのみ数式番号をつけます.
```typst
#aeq("math_eq")[$
integral_(-oo)^oo (1/root(,2 pi))e^(-x^2/2) dif x = 1
$]
```
#aeq(<math_eq>)[$
integral_(-oo)^oo (1/root(,2 pi))e^(-x^2/2) dif x = 1
$]
@math_eq は参照されています.
#aeq(<math_eq2>)[$
integral_(-oo)^oo (1/root(,2 pi))e^(-x^2/2) dif x = 1
$]
参照されない数式には番号はつきません
== 定理環境
以下の定理が使えます. projectのlangのところをenかjpにすれば,変更できます.
辞書の中身はlibs/translation.typにあるので,そこを編集すれば,変えられます.
#theorem[
定理の中身
]
#prop(name:"名称")[命題の中身]<prop>
#proof(name:[@prop])[証明を書く]
#assump[]
#ex[]
#fact[]
#cor[]
#lemma[]
|
|
https://github.com/lyzynec/orr-go-brr | https://raw.githubusercontent.com/lyzynec/orr-go-brr/main/02/main.typ | typst | #import "../lib.typ": *
#import "@preview/algo:0.3.3": algo, i, d
#knowledge[
#question(name: [Explain the main principle of descent direction methods for
unconstrained optimization. In particular, give the descent direction
condition.])[
First task is finding a descent direction, than we perform a line search
of minimizing over that direction.
$
bold(x)_(k+1) = bold(x)_k + alpha_k bold(d)_k
$
Descent direction condition is
$
gradient f(bold(x)_k)^T bold(d)_k < bold(0)
$
]
#question(name: [Give an overview of approaches for line search, that is, a
one--dimensional optimization.])[
There are three main options:
- fixed step
- exact search
- approximate search
#part(name: [Fixed step])[
Descent is poerfomed in fixed steps, meaining it must be estimated
beforehand what step size will be taken. This may result in poor
performance.
]
#part(name: [Exact search])[
In each step the step size is calculated to minimize the value.
This can be done using for example:
- bisection
- golden section
- Newton method
For quadratic functions, there is even a closed--form formula.
This may be computationaly expensive.
]
#box(width: 100%)[
*Approximate search:*
Most popular method is backtracking, where the fixed step size is
adjusted if it is too large:
with given $bold(x)_k$, $bold(d)_k$, $s$, $beta$, $gamma$
#algo[
$alpha_k = s$\
while $f(bold(x)_k) - f(bold(x)_k + alpha_k bold(d)_k) <
-gamma alpha_k bold(d)^T gradient f(bold(x)_k)$ do #i\
$alpha_k = beta alpha_k$ #d\
end\
]
]
]
#question(name: [Explain the steepest descent (aka gradient) method. Discuss
its shortcomings.])[
Steepest descent is a method od making steps in the direction of the
opposite of gradient.
$
bold(d)_k = -gradient f(bold(x)_k)\
bold(x)_(k+1) = bold(x)_k - alpha_k gradient f(bold(x)_k)
$
Its greatest shortoming is, that it does not perform well in proximity
of the local minimum, the approach significantly slows or zig--zags.
]
#question(name: [Explain conditioning of a matrix and what impact it has on
convergence of steepest descent algorithm. Propose a modification of a
steepest descent method that includes scaling of the original matrix such
that conditioning is improved.])[
Matrix conditioning can be checked by calculating the condition number
of given matrix
$
kappa(bold(A)) = norm(bold(A)^(-1)) dot norm(bold(A))
$
This can be also caluclated as ratio between largest and smallest
singular number
$
kappa(bold(A)) = (sigma_"max" (bold(A)))/(sigma_"min" (bold(A)))
$
Ideally $kappa(bold(A)) approx 1$ as for larger condition number, the
optimization algorithm will perform more steps.
We can improve the performance by introducing matrix $bold(S)$ which
transforms the vector $bold(x)$ into $bold(x) = bold(S) bold(y)$ ,thus
changing the original function as
$
f(bold(x)) = f(bold(S) bold(y))
$
For steepest descent, the iterations change
$
underbrace(bold(S) bold(y)_(k+1), bold(x)_(k+1)) =
underbrace(bold(S) bold(y)_k, bold(x)_k)
- alpha_k underbrace(bold(S) bold(S)^T, bold(D))
gradient underbrace( f(bold(S) bold(y)_k), f(bold(x)_k))
$
the iteration is than
$
bold(x)_(k+1) = bold(x)_k - alpha_k bold(D)_k gradient f(bold(x)_k)
$
The matrix $bold(S)$ should satisfy
$
gradient^2 f(bold(S) bold(y)) approx bold(I)
$
So good option is diagonal matrix $bold(D)$ with
$
bold(D)_(i i) = [gradient f(bold(x)_k)]_(i i)^(-1)
$
]
#question(name: [Explain the Newton method for unconstrained minimization.
Give also the its interpretation as a method for root finding. Discuss its
shortcomings.])[
We are trying to find a location where
$
f'(bold(x)) = bold(0)
$
For that we can use Newton method as it provides algorithm for finding
the root of a function.
As such to find
$
min_(bold(x) in RR^n) f(bold(x))
$
we perform
$
bold(x)_(k+1) = bold(x)_k -(gradient^2 f(bold(x)_k))^(-1)
gradient f(bold(x)_k)
$
For rootfinding in scalar form the algoritm can be used as
$
x_(k+1) = x_k - g(x_k)/(g'(x_k))
$
when trying to find a root of $g(x) = 0$.
The Newton method also scales the Hessian nicely, using the inverse
resolves the issue of matrix conditioning.
Main disadvantages of Newtons method for optimization are
- need to compute Hessian
- need to invert Hessian
- Hessian needs to be nonsingular and positive definite
Last two points may be resolved by using Quasi-Newton methods.
]
#question(name: [Discuss the issue of solving a set of linear equations
(in matrix-vector form) as they appear in the Newton method. Which matrix
factorization will be appropriate?])[]
#question(name: [Explain the key idea behind Quasi-Newton methods.])[
Main idea is replacing the inverse of the Hessian by another matrix
(denoted $bold(B)$). This may be perfomred using two main methods:
- Gauss--Newton method
- BFGS updates
]
#question(name: [Explain the key idea behind trust region methods for
unconstrained optimization. What are the advantages with respect to descent
direction methods?])[
Trust region method makes an approximation (often quadratic) of the
surroundings of the current point in which it expects the approximation
to hold.
It is in essence other option for line-serach as it first estimate step
size and than looks for direction in that region.
It changes the size of the region by estimating the quality of
approximation.
Greatest advantage is that it can be used in non--convex settings.
]
]
#skills[
#question(name: [Write Matlab code implementing a Quasi-Newton method for
minimization of a provided function.])[
```matlab
% first we initilize B
B = eye(n);
while norm(grad(x, f)) > epsilon
step = - B \ grad(x, f);
y = grad(x + step, f) - grad(x, f);
B = B - (B * s * s' * B)/(s' * B * s) + (y * y')/(s' * y);
x = x + step;
end
```
]
] |
|
https://github.com/7sDream/fonts-and-layout-zhCN | https://raw.githubusercontent.com/7sDream/fonts-and-layout-zhCN/master/chapters/02-concepts/dimension/dim-4.typ | typst | Other | #import "/lib/draw.typ": *
#import "/lib/glossary.typ": tr
#import "dim-2.typ": start, end, lt, rb, bbox-lt, bbox-rb, line-color, graph as dim2
#let end = (end.at(0), end.at(1))
#let sidebearing-y = bbox-lt.at(1) - 30
#let l-start = (lt.at(0), sidebearing-y)
#let l-end = (bbox-lt.at(0), sidebearing-y)
#let l-center = ((l-start.at(0) + l-end.at(0)) / 2, sidebearing-y)
#let r-start = (bbox-rb.at(0), sidebearing-y)
#let r-end = (rb.at(0), sidebearing-y)
#let r-center = ((r-start.at(0) + r-end.at(0)) / 2, sidebearing-y)
#let graph = with-unit((ux, uy) => {
// mesh(start, end, (50, 50), stroke: 1 * ux + gray)
let sidebearning-stroke = 1.4 * ux + line-color
segment(l-start, l-end, stroke: sidebearning-stroke)
segment(r-start,r-end, stroke: sidebearning-stroke)
let l-arrow-start = (l-center.at(0) - 40, l-center.at(1) + 10)
bezier(
l-arrow-start,
(l-center.at(0) - 20, l-center.at(1) + 18),
(l-center.at(0) - 1, l-center.at(1) + 15),
l-center,
stroke: sidebearning-stroke,
)
arrow-head(l-center, 4, theta: -80deg)
txt([左#tr[sidebearing]], l-arrow-start, anchor: "rc", size: 12 * ux)
let r-arrow-start = (r-center.at(0) + 40, r-center.at(1) + 10)
bezier(
r-arrow-start,
(r-center.at(0) + 20, r-center.at(1) + 18),
(r-center.at(0) + 1, r-center.at(1) + 15),
r-center,
stroke: sidebearning-stroke,
)
arrow-head(r-center, 4, theta: -110deg)
txt([右#tr[sidebearing]], r-arrow-start, anchor: "lc", size: 12 * ux)
dim2
})
#canvas(end, start: start, width: 55%, graph)
|
https://github.com/darioglasl/Arbeiten-Vorlage-Typst | https://raw.githubusercontent.com/darioglasl/Arbeiten-Vorlage-Typst/main/01_Einleitung/02_ausgangslage.typ | typst | == Ausgangslage <headingStartingPosition>
|
|
https://github.com/MrToWy/Bachelorarbeit | https://raw.githubusercontent.com/MrToWy/Bachelorarbeit/master/Chapters/2-Planung.typ | typst | #import "../Template/customFunctions.typ": *
= Anforderungsanalyse <anforderungsanalyse>
Die Planung des neuen Systems für Modulhandbücher beginnt mit der Anforderungsanalyse. Der Schritt der Anforderungsanalyse hat eine besondere Wichtigkeit, da es mit fortlaufender Projektlaufzeit immer aufwändiger wird, Fehler zu korrigieren oder Anpassungen vorzunehmen. @kleuker_grundkurs_2013[Seite 55] Damit diese wichtige Phase gründlich absolviert wird, folgt der Ablauf der Anforderungsanalyse den Empfehlungen von <NAME> und den #sophisten @rupp_requirements-engineering_2014. Es wird zunächst in @architecture die Umgebung des Systems erkundet. Anschließend wird mithilfe eines Interviews (@interview) der aktuelle Arbeitsprozess analysiert (@oldProcess) und dessen Probleme erkundet. Dann werden die Zielgruppen des neuen Systems ermittelt (@zielgruppen). Aus den Zielgruppen ergeben sich Use Cases (@usecases) und dazugehörige Anforderungen (@requirements). Zuletzt wird in @structure die Struktur eines Modulhandbuches untersucht.
== Systemumgebung <architecture>
In diesem Abschnitt soll zunächst die Umgebung des neuen Systems ermittelt werden. Hierzu werden die bestehenden Anwendungen untersucht. Das neue System soll dieselben Technologien wie die bestehenden Anwendungen verwenden. Dies hat den Vorteil, dass ein Entwickler nach Einarbeitung in die Technologien alle Anwendungen weiterentwickeln kann. Damit die Anforderungen an das neue System klar definiert werden können, muss also zunächst die Umgebung untersucht werden.
In der Abteilung Informatik der #hsh gibt es bereits mehrere Anwendungen, die ein gemeinsames Backend nutzen. Dieses Backend soll in dieser Arbeit erweitert werden, um auch den anderen Anwendungen die Auflistung der Modulhandbücher anbieten zu können. Zusätzlich wird eine neue Anwendung erstellt, die mit dem angepassten Backend kommunizieren wird.
=== Geplante Anwendungen <andereAnwendungen>
Zusätzlich zur Entwicklung dieses Projektes gibt es noch zwei weitere Anwendungen, die jedoch kein Teil dieser Arbeit sind. Im Folgenden werden die geplanten Anwendungen kurz erklärt.
Für Studierende, die planen möchten, welches Modul sie in welchem Semester erledigen, wird es die Anwendung #studyPlan geben. Hier können Studierende vom vorgeschlagenen Studienverlauf abweichen und dabei sicherstellen, trotzdem alle Module in der gewünschten Zeit zu erledigen. #studyPlan wird von dem angepassten Backend profitieren, weil #studyPlan eine stets aktuelle Auflistung aller Module inklusive deren Zeitaufwände benötigt, um die Planung des Studienverlaufs zu ermöglichen.
Die Entwicklung von #studyPlan läuft parallel zur Entwicklung dieser Bachelorarbeit – es muss also sichergestellt werden, dass es rechtzeitig nutzbare Ergebnisse gibt. Derzeit gibt es bereits einen ersten Prototyp von #studyPlan, welcher allerdings noch nicht produktiv genutzt wird.
Außerdem ist die Anwendung StudyGraph geplant, welche Studieninhalte visualisiert und somit auch die Informationen zu den angebotenen Modulen benötigt. @LernanwendungenAllerkampFakultat
=== Struktur des bestehenden Backends <backend>
Das bestehende Backend, auch #studybase genannt, ist mithilfe des auf JavaScript basierenden Framework #nest erstellt. #nest legt einen Fokus auf "effiziente, zuverlässige und skalierbare serverseitige Anwendungen" @nestjs.
Das #nest Backend ist modular aufgebaut.
Jede in @andereAnwendungen beschriebene Anwendung stellt im Backend ein Modul dar. Die Module der einzelnen Anwendungen enthalten ebenfalls Module, die die einzelnen Funktionen abbilden. Beispielsweise gibt es im Modul #studyPlan das Modul _degrees_, welches alle Studiengänge verwaltet.
Zusätzlich gibt es Module, die zwischen allen Anwendungen geteilt werden. Diese Shared-Modules bieten beispielsweise Funktionen zur Benutzerverwaltung und zum Versand von E-Mails an.
Um Funktionalitäten anbieten zu können, nutzen Module verschiedene Konzepte. Damit ein Modul beispielsweise eine HTTP-GET-Anfrage bearbeiten kann, muss es eine #text(controller)-Klasse haben. Ein #controller nimmt die Anfrage an und verarbeitet sie. Falls hierbei Daten benötigt werden, ruft der #controller eine Service-Klasse auf. Diese lädt die angefragten Daten aus der Datenbank und gibt sie an den #controller zurück. Für die Datenbankzugriffe wird Prisma genutzt.
Ein Auszug der Dateistruktur ist in @backendFiles zu sehen.
#pagebreak()
#treeFigure(<backendFiles>, "Ordnerstruktur der StudyBase")[
- StudyBase/src
- Plan
- Plan.Module
- Degrees
- Degree.Module
- Degree.Controller
- Degree.Service
- Shared
- Mailer
- Mailer.Module
- Mailer.Service
- Prisma
- Prisma.Module
- Prisma.Service
]
=== Struktur der bestehenden Datenbank <dbstructure>
Es gibt eine schema.prisma-Datei (@moduletable), in der die Struktur der relationalen Datenbank definiert ist. Somit muss kein SQL geschrieben werden, sondern es können Methoden von Prisma genutzt werden. Es gibt Tabellen für Module und Studiengänge. Die Tabellen werden von Prisma generiert. Änderungen an der Struktur müssen demnach an der schema.prisma-Datei erfolgen. Dadurch ist die Struktur der Datenbank versioniert und kann in einer Quellcodeverwaltung abgelegt werden.
In @moduletable ist beispielsweise zu sehen, wie eine Tabelle mit dem Namen "Module" definiert ist. Die Tabelle hat unter anderem eine Spalte id, mit dem Datentypen Int und einen name mit dem Datentypen String.
#pagebreak()
#codeFigure("Auszug aus schema.prisma", <moduletable>, "moduleTablePrisma")
=== Struktur einer beispielhaften Angular Anwendung <angularStructureExample>
Eine Vorgabe dieser Arbeit ist es, Angular für die Entwicklung der Weboberfläche zu nutzen. Durch die Nutzung von Angular gibt es einen einheitlichen Techstack, da die geplanten Anwendungen (@andereAnwendungen) ebenfalls in Angular entwickelt werden sollen.
Eine Angular Anwendung besteht aus Komponenten und Seiten. Auf einer Seite werden 0 bis n Komponenten in einer HTML-ähnlichen Struktur organisiert.
Eine Komponente ist ein wiederverwendbares Element auf einer Website – beispielsweise ein Dropdown, oder eine Textbox. Eine Komponente ist ebenfalls in der HTML-ähnlichen Struktur organisiert. In der Komponente können sich HTML-Elemente und andere Angular-Komponenten befinden.
Komponenten und Seiten haben eine .HTML-Datei für die Beschreibung der Struktur, eine .SCSS-Datei für die Beschreibung des Aussehens, sowie eine .TS-Datei für kleinere Logiken. Geschäftslogik wird meist in separate #service#text("-Klassen") ausgelagert – ähnlich wie schon in @backend beschrieben. @angularStructure
== Interview mit Studiendekan <interview>
Da die Anforderungen sowie der aktuelle Arbeitsablauf noch unklar waren, musste eine Methode gefunden werden, um beides gründlich zu durchleuchten. Hierzu soll im Folgenden ein Interview durchgeführt werden. Ein Interview hat den entscheidenden Vorteil, dass der Verlauf des Gesprächs individuell angepasst werden kann. Wenn sich neue Fragen ergeben, oder Fragen nicht ausreichend beantwortet wurden, kann im Interview direkt nachgefragt werden. @rupp_requirements-engineering_2014[Kapitel 6.3.3]
Das Interview wurde mit dem derzeitigen Studiendekan #heine durchgeführt. Das Interview orientierte sich an den Vorschlägen der #sophisten. Bereits bei der Einladung zum Interview wurden einige der Vorschläge beachtet. Der Studiendekan konnte sich den Interviewort selbst auswählen und erhielt die geplanten Fragen vorab zur Einsicht. Dadurch soll für den Interviewpartner eine möglichst angenehme Umgebung geschaffen werden, was zu einer erhöhten Kooperationsbereitschaft führen soll. @rupp_requirements-engineering_2014[Seite 107-109]
Die übersendeten Fragen können bei Interesse #link(<interviewFragen>)[im Anhang] nachgelesen werden.
Die Ergebnisse des Interviews sind in den folgenden Abschnitten zu lesen. Es ergaben sich zum einen die Konkretisierung der Zielgruppen, welche in @zielgruppen zu finden sind. Zum Anderen wurde der aktuelle Arbeitsprozess klar definiert, sowie dessen Schwachstellen aufgezeigt (@oldProcess).
== Analyse des aktuellen Arbeitsprozesses und Identifikation von Schwachstellen <oldProcess>
Der Prozess um Modulhandbücher zu bearbeiten hat sich bereits in der Planungsphase dieser Arbeit verändert. Bisher gab es für die Modulhandbücher Word-Dokumente, welche in einem Git-Repository verwaltet wurden. Bei Änderungen mussten jeweils das deutsche und das englische Word Dokument bearbeitet werden. Anschließend kann es notwendig sein, die Änderungen auch im Curriculum des Studienganges (@mdiCurr) und im Anhang des besonderen Teils der Prüfungsordnung (@currTable) vorzunehmen.
Die kritischste Schwachstelle sind hier Redundanzen. Die Eigenschaften eines Modulhandbuches sind an mehreren verschiedenen Stellen hinterlegt und müssen überall von Hand angepasst werden. Bei dem manuellen Eintragen von Daten können schnell Fehler auftreten, da die verschiedenen Stellen nicht automatisch synchronisiert werden. @goll_entwurfsprinzipien_2018
Als Vorbereitung für ein neues System wurden vom Studiendekan die zuvor genannten Word Dokumente maschinell eingelesen, in ein JSON-Format umgewandelt und anschließend in eine PostgresSQL-Datenbank eingespielt. Weiterhin wurde ein Python Script erstellt, welches aus den Datensätzen in der Datenbank mithilfe von LaTeX ein PDF-Dokument für die Modulhandbücher generieren kann. Die Datenbank enthält jedoch weiterhin Redundanzen und könnte daher optimiert werden.
#pagebreak()
== Zielgruppen <zielgruppen>
Im folgenden Abschnitt sollen die verschiedenen Zielgruppen eines Modulhandbuches ermittelt und definiert werden. Die Übersicht der Zielgruppen wird für die später folgende Ermittlung der Use Cases benötigt (@usecases). Hierdurch wird ermöglicht zu verstehen, wer das Modulhandbuch verwenden wird und welche Anforderungen die verschiedenen Gruppen haben. Zur Ermittlung wurde zum einen im ECTS User-Guide @ects recherchiert und zum anderen das Interview (@interview) genutzt.
=== Studieninteressierte <studieninteressiertePerson>
Der ECTS User-Guide @ects beschreibt, dass Modulhandbücher bereits bei der Wahl eines Studiengangs helfen können. So können Personen, die an einem bestimmten Studiengang interessiert sind, mithilfe der Beschreibungen in den Modulhandbüchern herausfinden, welche Inhalte gelehrt werden. Modulhandbücher sind demnach eine gute Anlaufstelle, um einen ersten Eindruck zu den angebotenen Modulen eines Studienganges zu erhalten.
=== Studierende <student>
Eine weitere Zielgruppe sind Studierende. Das neue System könnte bei der Suche nach einem geeigneten Wahlpflichtfach unterstützen. Auch könnten Studierende mithilfe der Modulbeschreibungen verstehen, welche Inhalte in einem Modul gelernt werden und welche Voraussetzungen es gibt. Dadurch können Studierende einschätzen, ob sie genug Vorwissen für ein bestimmtes Modul haben. Weiterhin können Studierende mithilfe der Modulhandbücher zu jedem Modul einen Überblick über die zu erbringende Arbeitszeit erhalten, sowie Informationen zu den Prüfungsleistungen finden.
=== Modulverantwortliche und Studiengangsverantwortliche <modulverantwortlicher>
Aus dem Interview mit dem Studiendekan (@interview) geht hervor, dass es neben den Studierenden noch andere zu betrachtende Zielgruppen gibt. Für die Bearbeitung von Modulhandbüchern sind an der #hsh verschiedene Personengruppen zuständig. Zum einen gibt es die studiengangverantwortliche Person (SVP). Diese ist für die Veröffentlichung des Dokumentes verantwortlich. Die SVP ist nicht dafür zuständig, die Inhalte der einzelnen Modulbeschreibungen anzupassen. Für diese Anpassungen gibt es die Modulverantwortlichen. Jedes Modul hat eine Person, die die Informationen der Modulbeschreibung aktuell halten soll und gleichzeitig Ansprechpartner für Fragen ist. In der Abteilung Informatik ist aktuell der Studiendekan gleichzeitig auch Studiengangverantwortlicher. Modulverantwortliche sind die Professoren und Dozierenden der Abteilung.
== Use Cases <usecases>
Im folgenden Abschnitt werden die Ergebnisse aus dem Interview und der Recherche im ECTS User Guide @ects verwendet, um aufzuzeigen, welche Funktionen die einzelnen Akteure im neuen System verwenden können.@rupp_requirements-engineering_2014[Seite~192] Hierzu werden Use Cases bestimmt, damit im nächsten Abschnitt (@requirements) daraus Anforderungen abgeleitet werden können. Die Use Cases wurden hergeleitet, indem die Bedürfnisse und Aufgaben der Akteure analysiert und mit den im ECTS User Guide beschriebenen Funktionen abgeglichen wurden. So soll sichergestellt werden, dass alle zuvor bestimmten Akteure ihre Aufgaben vollständig mit dem neuen System erledigen können.
/*
"Sie können Use Case-Beschreibungen als Ergänzung zu Use Case-Diagrammen erstellen, etwa um jeden einzelnen Use Case aus dem Diagramm genauer zu beleuchten. Use Case Beschreibungen können aber auch ohne Diagramm für sich stehen."
*/
#include("Planung/use-cases.typ")
Die Auflistung der Use Cases bildet eine Grundlage für die folgenden Abschnitte. Aus den Use Cases können nun konkrete Anforderungen ermittelt werden. Sicherlich können verschiedene Menschen noch weitere Ideen zur Verwendung des Systems haben, jedoch sollte diese Auflistung die wichtigsten Punkte umfassen, um ein System abzubilden, welches den aktuellen Workflow verbessert. Es ist wichtig zu betonen, dass sich Anforderungen stetig verändern können und dass es möglich ist in Zukunft auch andere Use Cases durch das System abzudecken. Das System soll deshalb so implementiert werden, dass zukünftige Änderungen einfach möglich sind.
== Anforderungen <requirements>
Als Nächstes sollen konkrete Anforderungen an das zukünftige System aufgestellt werden. Diese Anforderungen sollen zum einen dabei helfen, in der Entwurfs- und Implementierungsphase (@entwurf,~ @implementierung) konkrete Vorgaben zu haben, die abgearbeitet werden können und zum anderen in @review ermitteln zu können, ob das System einsetzbar ist.
Die Anforderungen an das System leiten sich aus den Use Cases, einer ISO-Norm und der Systemumgebung ab. Diese lassen sich in zwei Kategorien unterteilen: funktionale Anforderungen (basierend auf den Use Cases) und nicht-funktionale Anforderungen (abgeleitet aus der ISO-Norm und der Systemumgebung).
Um die Herkunft der Anforderungen klar darzustellen, werden sie in funktionale und nicht-funktionale Anforderungen gegliedert. Obwohl diese Trennung fachlich nicht zwingend erforderlich ist, dient sie der besseren Übersichtlichkeit der folgenden Auflistung.
Jede Anforderung in den folgenden Auflistungen enthält entweder das Wort "muss", "sollte", oder "könnte". @rupp_requirements-engineering_2014[Kapitel 1.5.2] Damit wird zwischen Anforderungen unterschieden, die zwingend erforderlich sind (muss), Anforderungen, die sehr sinnvoll sind (sollte) und Anforderungen, die nicht zwingend erforderlich sind, aber die Nutzer begeistern würden (könnte). Eine weitere Priorisierung wird an dieser Stelle nicht benötigt, sondern kann bei Bedarf erfolgen.
#import "@preview/gentle-clues:0.7.1": *
#block(breakable: false)[
=== Funtionale Anforderungen
Die funktionalen Anforderungen ergeben sich aus den zuvor ermittelten Use Cases (@usecases). Hierbei wurde überlegt, welche Anforderungen erfüllt sein müssen, um einen Use Case vollständig abbilden zu können.
In #link(<UseCaseInfoDegree>)[Use Case 1] ist beschrieben, wie eine nicht angemeldete Person (NP) Informationen zu einem Studiengang erhalten möchte. Damit die Übersicht eines Studienganges auf der Website der Hochschule verlinkt werden kann, muss das System einen Link bereitstellen können, der direkt zur Übersicht führt und sich nicht verändert. Außerdem muss es eine Funktion geben, um das PDF mit dem Modulverzeichnis des Studienganges zu öffnen.
#task(title:[Aus #link(<UseCaseInfoDegree>)[Use Case 1] ergeben sich folgende Anforderungen:])[
#narrowTrack("Link zur Übersichtsseite anbieten", type: "F", label: <StaticLink>)[System muss einen statischen Link zur Übersicht eines Studienganges bereitstellen.]
#narrowTrack("PDF anzeigen", type: "F", label: <PDF>)[NP muss ein PDF mit allen Modulbeschreibungen ansehen können.]
]
]
#linebreak()
#block(breakable: true)[
In #link(<UseCaseInfoModule>)[Use Case 2] ist beschrieben, wie eine Person Informationen zu einem Modul erhalten möchte. Das System muss hierzu alle Module des ausgewählten Studiengangs auflisten. Die Module müssen auswählbar sein, damit weitere Details angezeigt werden können. Im genannten Beispiel ist die Person auf der Suche nach einem Wahlpflichtmodul. Für diesen Fall muss das System die Möglichkeit bieten, nach bestimmten Informationen zu filtern. Denkbar wären Filter für die Informationen "Wahlpflichtfach", "Semester", "Erreichbare Credits".
#task(title: [Aus #link(<UseCaseInfoModule>)[Use Case 2] ergeben sich folgende Anforderungen:])[
#narrowTrack("Module auflisten", type: "F", label: <SHOWMODULES>)[NP muss eine Liste aller Module sehen können.]
#narrowTrack("Filterfunktion", type: "F", label: <FILTER>)[NP sollte Filter nutzen können, um das gesuchte Modul zu finden.]
#narrowTrack("Suchfunktion", type: "F", label: <SEARCH>)[NP sollte eine Suchfunktion nutzen können, um das gesuchte Modul zu finden.]
#narrowTrack("Module anzeigen", type: "F", label: <SHOWMODULEDETAIL>)[NP muss die Details eines Moduls ansehen können.]
]
]
#linebreak()
#block(breakable: true)[
In #link(<UseCaseEditModule>)[Use Case 3] ist beschrieben, wie eine Person Informationen zu einem Modul bearbeiten möchte. Damit dies nur vom genannten Akteur erledigt werden kann, wird eine Login-Funktion benötigt. Aus der Login-Funktion ergeben sich weitere Anforderungen. So kann ein Logout-Button sinnvoll sein und es könnte praktisch sein, das eigene Passwort ändern zu können. Weiterhin könnte es hilfreich sein, wenn die eingegebenen Informationen auf Plausibilität überprüft werden. Denkbar wäre beispielsweise eine Prüfung, ob die angegebenen ECTS mit dem angegebenen Zeitaufwand zusammenpasst.
#task(title: [Aus #link(<UseCaseEditModule>)[Use Case 3] ergeben sich folgende Anforderungen:])[
#narrowTrack("Login", type: "F", label: <LOGIN>)[Ein User muss sich anmelden können.] #linebreak()
#narrowTrack("Logout", type: "F", label: <LOGOUT>)[Ein User sollte sich ausloggen können.] #linebreak()
#narrowTrack("Passwörter zurücksetzen", type: "F", label: <RESETPW>)[SVP sollte Passwörter zurücksetzen können.]
#narrowTrack("Eigenes Passwort zurücksetzen", type: "F", label: <RESETMYPW>)[SVP sollte das eigene Passwort zurücksetzen können.]
#narrowTrack("Module bearbeiten", type: "F", label: <EDIT>)[Modulverantwortliche Person muss Module bearbeiten können, für die Sie als Ansprechpartner hinterlegt ist.]
#narrowTrack("Plausibilitätschecks bei Modulen", type: "F", label: <CHECKMOD>)[System sollte Änderungen an Modulen auf Plausibilität prüfen.]
]
]
#linebreak()
#block(breakable: true)[
In #link(<UseCaseCreate>)[Use Case 4] ist beschrieben, dass die Studiengangsverantwortliche Person Datensätze erstellen können muss. Für die verschiedenen Entitäten im neuen System muss es dementsprechend jeweils eine Bearbeitungsmaske geben. Im System müssen die Datensätze sowohl erstellbar als auch bearbeitbar sein. Außerdem muss man Datensätze löschen können. Aus dem Interview mit dem Studiendekan hat sich außerdem ergeben, dass Studiengänge ausblendbar sein müssen, damit alte Prüfungsordnungen versteckt werden können. Diese werden von Studierenden nicht benötigt, weil darin enthaltene Veranstaltungen möglicherweise nicht mehr angeboten werden. Die veralteten Studiengänge sollen jedoch nicht direkt gelöscht werden, damit der Studiendekan bei Bedarf auf alte Modulbeschreibungen zugreifen kann. Für die Erstellung einer neuen Prüfungsordnung schlägt der Studiendekan eine Funktion vor, die bestehende Studiengänge oder Module duplizieren kann, da es manchmal zwischen den Prüfungsordnungen nur geringfügige Änderungen gibt.
#task(title: [Aus #link(<UseCaseCreate>)[Use Case 4] ergeben sich folgende Anforderungen:])[
#narrowTrack("Module verwalten", type: "F", label: <MODULE>)[SVP muss Module verwalten (anlegen, bearbeiten, löschen) können.]
#narrowTrack("Module duplizieren", type: "F", label: <DUPLICATE>)[SVP sollte Module duplizieren können.]#linebreak()
#narrowTrack("Studiengänge verwalten", type: "F", label: <COURSE>)[SVP sollte Studiengänge verwalten können.]
#narrowTrack("Studiengänge duplizieren", type: "F", label: <DUPLICATECourse>)[SVP sollte Studiengänge duplizieren können.]
#narrowTrack("Studiengänge ausblenden", type: "F", label: <hideCourse>)[SVP sollte Studiengänge ausblenden können.]
#narrowTrack("Ausgeblendete Studiengänge ansehen", type: "F", label: <showHiddenCourses>)[SVP sollte ausgeblendete Studiengänge ansehen können.]
#narrowTrack("Benutzer verwalten", type: "F", label: <CRUSER>)[SVP sollte User verwalten können.]#linebreak()
#narrowTrack("Teilmodule verwalten", type: "F", label: <CreateSubmodules>)[SVP muss Teilmodule verwalten können.]
#narrowTrack("Voraussetzungen verwalten", type: "F", label: <CreateRequirements>)[SVP muss Voraussetzungen verwalten können.]
]
]
#block(breakable: false)[
In #link(<UCRevertChanges>)[Use Case 5] ist beschrieben, dass die Änderungen an einem Modul rückgängig gemacht werden können. Hierzu müssen diese zunächst angezeigt werden. Diese Funktion ist außerdem für Teilmodule und auch alle anderen Arten von Datensätzen sinnvoll.
#task(title: [Aus #link(<UCRevertChanges>)[Use Case 5] ergibt sich folgende Anforderung:])[
#narrowTrack("Änderungen anzeigen (Modul)", type: "F", label: <SHOWCHANGES>)[SVP sollte sich einzelne Änderungen an einem Modul anzeigen lassen können.]
#narrowTrack("Änderungen widerrufen (Modul)", type: "F", label: <REVERT>)[SVP könnte einzelne Änderungen an einem Modul rückgängig machen.]
#narrowTrack("Änderungen anzeigen", type: "F", label: <SHOWCHANGESmisc>)[SVP könnte sich einzelne Änderungen an beliebigen Datensätzen anzeigen lassen können.]
#narrowTrack("Änderungen widerrufen", type: "F", label: <REVERTmisc>)[SVP könnte einzelne Änderungen an beliebigen Datensätzen rückgängig machen.]
]
#linebreak()
In #link(<UseCaseTable>)[Use Case 6] ist beschrieben, wie die studiengangsverantwortliche Person den Anhang der Prüfungsordnung erstellt. Da die Prüfungsordnung ein wichtiges Dokument ist, soll diese auch in Zukunft zunächst manuell erstellt werden. Die im Anhang der Prüfungsordnung enthaltene Tabelle kann dann im System generiert werden und kann mit der manuell erstellten Tabelle verglichen werden. Hiermit ist dann sichergestellt, dass die Daten im neuen System und in der Prüfungsordnung übereinstimmen.
#task(title: [Aus #link(<UseCaseTable>)[Use Case 6] ergibt sich folgende Anforderung:])[
#narrowTrack("Anhang der Prüfungsordnung", type: "F", label: <COMPARE>)[SVP könnte sich die Auflistung aller Module als Tabelle anzeigen lassen, um sie mit dem Anhang der Prüfungsordnung vergleichen zu können.]
]
]
#pagebreak()
=== Nicht-Funtionale Anforderungen
Die Nicht-Funktionalen Anforderungen ergeben sich aus einem Brainstorming unter der Berücksichtigung der ISO-Norm ISO/IEC 25000 @rupp_requirements-engineering_2014[Kapitel 12] und ergeben sich aus den Bedingungen aus @architecture.
Die ISO-Norm 25000 beschreibt verschiedene Merkmale, die zur Messung von Softwarequalität genutzt werden können. Um eine gute Softwarequalität zu erreichen, sollten aus allen Merkmalen konkrete Anforderungen an das neue System abgeleitet werden. Die Merkmale sind jeweils in Submerkmale unterteilt. Nicht jedes Submerkmal ist für das neue System relevant, jedoch sollten möglichst viele Submerkmale in Anforderungen übersetzt werden, um eine gute Qualität sicherzustellen.
Das Merkmal #emph("Änderbarkeit") besteht aus den Submerkmalen #emph("Analysierbarkeit"), #emph("Modifizierbarkeit"), #emph("Stabilität") und #emph("Testbarkeit") @rupp_requirements-engineering_2014[12.4.1]. Damit Software diese Kriterien erfüllt, muss der Quellcode eine hohe Qualität aufweisen. Daher soll das System einigen Prinzipien folgen, die in von #cite(<clean_code_2012_robert_martin>, form: "author") beschrieben sind. @clean_code_2012_robert_martin Der Quellcode soll so geschrieben sein, dass mit geringem Aufwand jede Klasse und jede Methode verstanden werden kann. Alle Teile des Codes sollen selbsterklärend und möglichst kurz sein. Komplexe Abläufe sollen in Teilabläufe aufgeteilt werden, sodass Methoden und Klassen eine gewisse Größe und Komplexität nicht überschreiten und somit innerhalb kurzer Zeit von nachfolgenden Entwicklern verstanden werden können. @clean_code_2012_robert_martin[Kapitel 1] Der Quellcode kann dadurch auf eine effiziente Art von Entwickelnden analysiert werden (#emph("Analysierbarkeit")). Durch den Einsatz von Dependency Injection können Abhängigkeiten ausgetauscht werden (#emph("Modifizierbarkeit")). Durch das gezielte Einsetzen von Fehlermeldungen und Try-Catch-Blöcken wird für eine gute #emph("Stabilität") des Systems gesorgt. @clean_code_2012_robert_martin[Kapitel 7] Abschließend ergeben sich aus kleinen Komponenten mit genau einer Verantwortlichkeit und wenigen Abhängigkeiten gut testbare Einheiten, die mit automatisierten Tests getestet werden könnten. @clean_code_2012_robert_martin[Kapitel 9]
#task(title: [Änderbarkeit])[
#narrowTrack("Modularität", type:"N", label: <MODULAR>)[
Der Quellcode des Systems sollte aus Komponenten bestehen.
]
#narrowTrack("Wiederverwendbarkeit", type:"N", label: <TESTABLE>)[
Einzelne Komponenten könnten wiederverwendbar sein.
]
#narrowTrack("Hohe Kohärenz", type:"N", label: <Verantwortlichkeit>)[
Die Komponenten sollten genau eine Verantwortlichkeit haben.
]
#narrowTrack("Lose Kopplung", type:"N", label: <Kopplung>)[
Die Komponenten dürfen nicht zu viele Abhängigkeiten haben.
]
#narrowTrack("Komplexität", type:"N", label: <Komplex>)[
Methoden und Klassen sollen eine geringe Komplexität haben.
]
#narrowTrack("Dependency Injection", type:"N", label: <DepedencyInjection>)[
Durch die Nutzung von Dependency Injection sollen Abhängigkeiten austauschbar sein.
]
#narrowTrack("Stabilität", type:"N", label:<Stability>)[
Mithilfe von Fehlercodes und Try-Catch-Anweisungen sollen Fehler abgefangen werden.
]
#narrowTrack("Unittests", type:"N", label:<TEST>)[
Geschäftslogik könnte mithilfe von Unittests automatisiert getestet werden.
]
#narrowTrack("e2e-Tests", type:"N", label:<TESTUI>)[
System könnte mithilfe von e2e-Tests automatisiert getestet werden.
]
]
Das Merkmal #emph("Benutzbarkeit") besteht aus den Submerkmalen #emph("Verständlichkeit"), #emph("Erlernbarkeit"), #emph("Bedienbarkeit"), #emph("Attraktivität") und #emph("Konformität"). @rupp_requirements-engineering_2014[12.4.1]
Für die Ermittlung der folgenden Anforderungen wurde in einem Brainstorming überlegt, wie die Submerkmale der Benutzbarkeit in konkrete Anforderungen übersetzt werden können. Beispiel: Damit eine Oberfläche verständlich ist, sollte sie selbsterklärend sein und nicht das Lesen eines Benutzerhandbuches erfordern (#emph("Verständlichkeit")).
Die folgenden Anforderungen sind kein 1:1-Abbild der zukünftigen Anwendung, sondern legen eher die Grundprinzipien fest, die bei der Entwicklung beachtet werden sollen. Eine vollständige Spezifikation wäre an dieser Stelle sehr aufwändig und ist daher nicht notwendig.
#task(title: [Benutzbarkeit])[
#narrowTrack("Aktueller Pfad", type:"N", label: <PATH>)[
System könnte anzeigen, welcher Pfad aufgerufen wurde \ (z. B. Fakultät->Studiengang->Modul).
]
#narrowTrack("Rückfragen", type:"N", label:<ASK>)[
Vor dem Löschen eines Elements muss eine Rückfrage erscheinen.
]
#narrowTrack("Wiederherstellbarkeit", type:"N", label:<SOFTDELETE>)[
Gelöschte Elemente könnten wiederherstellbar sein.
]
#narrowTrack("Ladebalken", type:"N", label:<QUICK>)[
Ladezeiten >1s sollten einen Ladebalken zeigen.
]
#narrowTrack("Verständlichkeit", type:"N", label:<ERROR>)[
Fehlermeldungen sollten verständlich sein.
]
#narrowTrack("Lösung anbieten", type:"N", label:<ERRORSOLVE>)[
Fehlermeldungen könnten eine Lösung anbieten.
]
#narrowTrack("Responsive", type:"N", label:<RESPONSIVE>)[
Das System könnte auf verschiedenen Displaygrößen nutzbar sein.
]
#narrowTrack("Eingabemethoden", type:"N", label:<KEYBOARD>)[
Das System könnte verschiedene Eingabemethoden unterstützen.
]
#narrowTrack("Selbsterklärend", type:"N", label:<SELFEXPLAIN>)[
Das System sollte selbsterklärend sein und kein Handbuch benötigen.
]
]
Das Merkmal #emph("Effizienz") besteht aus den Submerkmalen #emph("Zeitverhalten"), #emph("Verbrauchsverhalten") und #emph("Konformität"). @rupp_requirements-engineering_2014[12.4.1]
Damit das System eine gute Effizienz hat, müssen alle Anfragen performant gestaltet werden. In den Anforderungen werden Grenzwerte gesetzt, die das System erreichen soll. Falls einzelne Seiten viele Daten laden müssen, sodass die gesetzten Ziele nicht erreicht werden können, müssen diese Daten im Hintergrund geladen werden, sodass die Seite selbst geladen wird und fehlende Daten dann nachträglich eingesetzt werden können. Unter dem Begriff der Effizienz könnte auch die Effizienz des Entwicklungsprozesses oder die Effizienz der Aufgabenerledigung verstanden werden, weshalb zu diesen Gebieten auch Anforderungen erstellt wurden.
#task(title: [Effizienz])[
#narrowTrack("Startzeit Frontend", type:"N", label:<STARTFRONTEND>)[
Jede Seite im Frontend sollte innerhalb einer Sekunde geladen sein.
]
#narrowTrack("Startzeit Backend", type:"N", label:<STARTBACKEND>)[
Das Backend sollte im kritischen Fehlerfall innerhalb einer Minute neu starten.
]
#narrowTrack("Deployment", type:"N", label:<DEPLOY>)[
Das Deployment könnte automatisiert sein.
]
#narrowTrack("Effizienz der Aufgabenerledigung", type:"N", label:<CLICKS>)[
Jeder Schritt im Use Case sollte mit möglichst wenigen Klicks absolvierbar sein.
]
]
Das Merkmal #emph("Funktionalität") besteht aus den Submerkmalen #emph("Angemessenheit"), #emph("Richtigkeit"), #emph("Interoperabilität"), #emph("Sicherheit") und #emph("Ordnungsmäßigkeit"). @rupp_requirements-engineering_2014[12.4.1] Da die Modulhandbücher bisher in Englisch und Deutsch bereitstehen, muss diese Funktionalität bestehen bleiben. Für die Zukunft wäre auch die Einführung weiterer Sprachen denkbar, weshalb die Mehrsprachenfähigkeit vorbereitet werden sollte. Um den Arbeitsaufwand gering zu halten, sollte das System sinnvolle Eingaben vorschlagen und das generierte PDF sollte dem ursprünglichen PDF ähneln. Außerdem muss sichergestellt sein, dass bestimmte Endpunkte nur von autorisierten Nutzern verwendet werden können.
#task(title: [Funktionalität])[
#narrowTrack("Zwei Sprachen", type:"N", label:<TRANSLATE>)[
Das System muss in Englisch und Deutsch verfügbar sein.
]
#narrowTrack("Mehrsprachenfähigkeit", type:"N", label:<TRANSLATEMULTIPLE>)[
Das System sollte für beliebig viele Sprachen erweiterbar sein.
]
#narrowTrack("Auswahlmöglichkeiten", type:"N", label: <lookup>)[
System sollte möglichst oft vorschlagen, welche Eingaben sinnvoll wären.
]
#narrowTrack("Ähnlichkeit zum ursprünglichen PDF", type:"N", label: <similarPdf>)[
Das generierte PDF sollte dem ursprünglichen PDF ähneln.
]
#narrowTrack("Sicherheit", type:"N", label: <security>)[
Es muss verhindert werden, dass nicht autorisierte Benutzer datenverändernde Endpunkte nutzen.
]
]
Das Merkmal #emph("Übertragbarkeit") besteht aus den Submerkmalen #emph("Anpassbarkeit"), #emph("Installierbarkeit"), #emph("Koexistenz"), #emph("Austauschbarkeit") und #emph("Konformität"). @rupp_requirements-engineering_2014[12.4.1] Eine vereinfachte Installierbarkeit könnte durch den Einsatz von Podman- oder Docker-Containern erreicht werden. Damit zukünftige Anwender das System installieren können, wird zudem eine Dokumentation benötigt. Weiterhin sollte das System aus austauschbaren Komponenten bestehen. Es ist beispielsweise denkbar, in Zukunft eine andere Datenbank zu nutzen, oder andere Kompilierungsserver einzusetzen.
#task(title: [Übertragbarkeit])[
#narrowTrack("Dokumentation zur Installation", type:"N", label: <DOKBACK>)[
Es sollte dokumentiert sein, wie das System installiert wird.
]
#narrowTrack("Container", type:"N", label: <containerAnf>)[
Es könnten Podman-Container genutzt werden, um die Komponenten des Systems bereitzustellen.
]
#narrowTrack("Austauschbarkeit", type:"N", label: <austauschbarkeit>)[
Einzelne Komponenten sollten austauschbar sein (Datenbank, Kompilierungsserver, Frontend).
]
]
Das Merkmal #emph("Zuverlässigkeit") besteht aus den Submerkmalen #emph("Reife"), #emph("Fehlertoleranz"), #emph("Robustheit"), #emph("Wiederherstellbarkeit") und #emph("Konformität"). Das System sollte mit Fehlern umgehen können. Diese sollten entweder abgefangen, oder dem Benutzer mitgeteilt werden. Besser wäre es, wenn während der Erledigung der Use Cases keine Fehler auftreten würden. Gegen den Schutz vor Angriffen könnten Rate-Limits ein sinnvoller Mechanismus sein, um beispielsweise nach mehreren fehlgeschlagenen Loginversuchen, weitere Versuche zu unterbinden.
#task(title: [Zuverlässigkeit])[
#narrowTrack("Stabilität", type:"N", label: <ERRORSTABLE>)[
Das System muss bei auftretenden Fehlern weiterhin funktionieren / sich selbst wiederherstellen.
]
#narrowTrack("Reife", type:"N", label: <reife>)[
Das System sollte beim Erledigen der Use Cases keine Fehler erzeugen.
]
#narrowTrack("Robustheit", type:"N", label: <robustheit>)[
Das System sollte Rate-Limits nutzen, um bei größeren Lasten gegebenenfalls Anfragen zu blockieren.
]
]
In @architecture sind die bereits bestehenden Anwendungen beschrieben. Aus diesen Erkenntnissen ergeben sich einige technische Anforderungen, die bei der Entwicklung beachtet werden müssen.
#task(title: [Technische Anforderungen])[
#narrowTrack("Neue Anwendung", type:"N", label: <FRONT>)[
Das Frontend muss eine neue Anwendung sein.
]
#narrowTrack("Technologien im Frontend", type:"N", label: <FRONT_TECH>)[
Das Frontend muss Angular nutzen.
]
#narrowTrack("Bestehende Anwendung", type:"N", label: <BACK>)[
Das bestehende Backend muss erweitert werden.
]
#narrowTrack("Technologien im Backend", type:"N", label: <BACK_TECH>)[
Das Backend muss Primsa und NestJS nutzen.
]
#narrowTrack("Bestehende Datenbank", type:"N", label: <DB>)[
Die bestehende Datenbank muss erweitert werden.
]
]
=== Ergebnis
Das Ergebnis dieses Abschnittes ist eine Auflistung der Anforderungen an das neue System. Diese sollte alle zuvor aufgestellten Use Cases abdecken. Außerdem gibt es weitere Anforderungen, die eine gute Softwarequalität gewährleisten sollen und die Rahmenbedingungen der späteren Entwicklung bestimmen. In @review kann anhand der Auflistung überprüft werden, ob das neue System für die produktive Verwendung einsatzbereit ist.
/*
@rupp_requirements-engineering_2014[Kapitel 5.3]
sollte / muss als Schlüsselwörter
qualitätskriterien für anforderungen
@rupp_requirements-engineering_2014[Kapitel 1.8.1]
@rupp_requirements-engineering_2014[Kapitel 5.3]
#image("../Images/image.png")
Tab. 5.1 Leitfragen zur Erstellung hoch-qualitativer Anforderungen
@broy_einfuhrung_2021[s.~209]
Kontextgrenzen
@rupp_requirements-engineering_2014[Kapitel 5.4.2]
6.2
#image("../Images/Faktoren.png")
Basisfaktoren
Wenn Ihnen das Fachgebiet geläufig ist, kennen Sie diese in vielen Fällen selbst und könnten sie selbst ergänzen.
Auf diese Leistungsfaktoren stoßen Sie zuerst, da die Stakeholder sie explizit nennen. Sie können also mittels Befragungstechniken ermittelt werden.
Beigeisterungsfaktoren
Brainstorming
Risiko, der Machbarkeit, Nützlichkeit und dem Begeisterungspotenzial.
*/
== Struktur eines Modulhandbuches <structure>
In diesem Unterabschnitt soll die Struktur eines Modulhandbuches analysiert werden, um herauszufinden, wie die spätere Datenbank aufgebaut sein muss. Damit ein Datenbankschema erstellt werden kann, müssen die verschiedenen Entitäten ermittelt werden, die Beziehung zwischen den Entitäten und die Attribute für jede Entität.
Die Modulhandbücher der Abteilung Informatik haben für alle drei Studiengänge (BIN, MDI und MIN) dieselbe Struktur. Es gibt eine Aufteilung in Module und Teilmodule. Ein Modul kann dabei 0 bis n verschiedene Teilmodule haben und jedes Teilmodul kann zu 1 bis n Modulen gehören. Teilmodule können studiengangsübergreifend mit Modulen verknüpft werden. #emph("Beispiel"): Es gibt das Modul "MDI-103 Grundlagen der Informatik" und das Modul "BIN-103 Grundlagen der Informatik". Beide verweisen auf das Teilmodul "BIN-103-01 Grundlagen der Informatik". Somit können studiengangsübergreifende Module abgebildet werden. In der Regel hat an der Abteilung Informatik jedes Modul genau ein Teilmodul und umgekehrt gehört in der Regel jedes Teilmodul zu genau einem Modul.
=== Moduleigenschaften <properties>
Das Modul enthält zunächst grundlegende Informationen. Diese werden aufgelistet, um ein besseres Verständnis der benötigten Datenstruktur zu erhalten. Jedes aufgelistete Feld soll später in @schema implementiert werden, daher ist es notwendig, die benötigten Felder und deren Inhalt herauszufinden.
#track("Titel", example: "BIN-100 Mathematik 1", label:<title>)[
Zusammengesetzt aus einem Kürzel des Studiengangs, einer eindeutigen Zahl und dem Namen des Moduls.
]
#track("Untertitel", example: "Mathematische Grundlagen der Informatik (BIN-MAT1) oder C/C++ (BIN-PR3)", label:<subTitle>)[
Ein alternativer, ggf. etwas präziserer Name des Moduls, sowie ein Kürzel. In den aktuell veröffentlichten Handbüchern ist hier oft nur das Kürzel angegeben.
]
#track("Modulniveau")[
Hier ist angegeben, ob das Modul ein Grundlagenmodul oder Vertiefungsmodul ist.
]
#track("Pflicht / Wahlpflicht")[
Hier ist angegeben, ob das Modul ein Pflichtmodul oder Wahlpflichtmodul ist.
Studierende müssen alle Pflichtmodule absolvieren und müssen eine bestimmte Anzahl an selbst ausgewählten Wahlpflichtmodulen absolvieren.
]
#track("Teilmodule", label:<submodules>)[
Eine Auflistung aller Teilmodule.
]
#track("Verantwortliche(r)", example: "<NAME>.", label: <responsible>)[
Name der verantwortlichen Person. Diese Person ist für die Bearbeitung des Modulhandbuches zuständig.
]
#track("Credits", label: <credits>)[
Anzahl erreichbarer ECTS bei Absolvierung dieses Moduls. Eine Zahl zwischen 2 (Englisch) und 30 (z. B. Masterarbeit).
]
#track("Präsenzstunden / Selbststudium", example: "68 h / 112 h", label:<hours>)[
Aufwand des Studiums, aufgeteilt nach der Zeit, die in der Hochschule verbracht wird und der Zeit, die im Selbststudium verbracht wird (Arbeit an Übungen, Prüfungsvorbereitung …).
]
#track("Studiensemester", label: <recommendedSemester>, example: "4-6")[
Vorgeschlagenes Semester. Anhand dieser Information wird das Curriculum generiert (@mdiCurr).
]
#track("Moduldauer", example: "1 Semester")[
Hier ist angegeben, wie lange es dauert, das Modul zu absolvieren.
]
#track("Voraussetzungen nach Prüfungsordnung", example: "Alle Modulprüfungen des 1. bis 3. Semesters")[
Für die Absolvierung des Moduls zwingend erforderliche Voraussetzungen.
]
#track("Empfohlene Voraussetzungen", example: "Alle Module der Semester 1 bis 3 sowie BIN-112 und BIN-202", label: <recommendedRequirements>)[
Für die Absolvierung des Moduls empfohlene Voraussetzungen.
]
#track("Studien-/ Prüfungsleistungen", example: "Referat (Hausarbeit plus Präsentation/Vortrag), Anwesenheitspflicht", label:<exam>)[
Eine kommagetrennte Auflistung der zu erbringenden Leistungen.
]
#track("Angestrebte Lernergebnisse", example: "Die Studierenden sind in der Lage, dreidimensionale Objekte zu gestalten, zu bewegen und zueinander in Beziehung zu setzen.", label:<erg>)[
Eine stichpunktartige, kommagetrennte Auflistung der Kompetenzen, die in diesem Modul erworben werden.
]
#track("Gruppe", example: "Wahlpflichtmodule 2. Studienabschnitt", label:<group>)[
Jedes Modul gehört zu einer Gruppe. Anhand der Gruppe werden die Module im PDF gedruckt.
]
#text(" ")<EndOfChapter>
=== Teilmoduleigenschaften<submoduleProps>
Die Teilmodule haben ebenfalls die Informationen: @subTitle, @responsible, @credits, @hours, @recommendedSemester, @recommendedRequirements, @exam und @erg.
Zusätzlich gibt es noch weitere benötigte Felder.
#context [
#for (value) in (range(counter(heading).at(<EndOfChapter>).last())) {
counter(heading).step(level: 9)
}
]
#track("Titel", example: "BIN-100-01 Mathematik 1")[
Der Titel des Teilmoduls setzt sich zusammen aus dem Kürzel des übergeordneten Moduls, einer eigenen Nummer und dem Namen des Teilmoduls.
]
#track("Sprache", example: ["nach Vereinbarung" oder "deutsch"])[
Hier ist angegeben, in welcher Sprache die Veranstaltung stattfindet.
]
#track("Zuordnung zu Curricula", example: "BIN, MDI")[
Eine kommagetrennte Auflistung aller Studiengänge, in denen dieses Teilmodul verwendet wird.
]
#track("Veranstaltungsart, SWS", example: "Vorlesung mit Übung, 4 SWS")[
Eine Kurzbeschreibung zum Ablauf der Veranstaltung, sowie deren Dauer in Semesterwochenstunden.
]
#track("Empfehlungen zum Selbststudium", example: "Aufbereitung der Lehrveranstaltung anhand von eigenen Projekten")[
Hier stehen Vorschläge, wie der Lehrinhalt im Selbststudium vertieft werden kann.
]
#track("Gruppengröße")[
Üblicherweise eine Zahl zwischen 1 (Bachelorarbeit) und 100 (Mathematik 1).
]
#track("Inhalt", example: "Neue und aktuelle Trends im Bereich Betriebssysteme und Netze")[
Die Inhalte der Veranstaltung kurz zusammengefasst.
]
#track("Anforderungen der Präsenzzeit", example: "Regelmäßige und aktive Teilnahme.")[
Hier ist kurz beschrieben, was von Studierenden in der Präsenzzeit erwartet wird.
]
#track("Anforderungen des Selbststudiums", example: "Vor- und Nachbereitung")[
Hier ist kurz beschrieben, was von Studierenden außerhalb der Präsenzzeit erwartet wird.
]
#track("Literatur", example: "Skript zur Vorlesung
<NAME>., <NAME>.: Building Java Programs, Prentice Hall", label: <literature>)[
Eine Auflistung empfohlener Literatur zur Vertiefung des behandelten Themas.
]
== Zwischenfazit
In diesem Kapitel wurden mithilfe verschiedener Methoden die Schwachstellen des alten Prozesses ermittelt und daraus im Anschluss Anforderungen an das neue System ermittelt. Hierbei half die Aufstellung von Zielgruppen und Anwendungsfällen. Die aufgestellten Anforderungen helfen bei der folgenden Planung der Anwendung und werden auch später im @review hilfreich, um zu ermitteln, ob das neue System eingesetzt werden kann. Die zum Ende des Kapitels herausgearbeitete Struktur der Modulhandbücher kann im Folgenden zur Entwicklung einer passenden Datenstruktur helfen.
|
|
https://github.com/Myriad-Dreamin/tinymist | https://raw.githubusercontent.com/Myriad-Dreamin/tinymist/main/crates/tinymist-query/src/fixtures/type_check/annotation_sum.typ | typst | Apache License 2.0 | /// #let args = `array(int)`
/// - args (args): The `args`.
#let sum(..args) = none
|
https://github.com/kajiLabTeam/ipsj-national-convention-typst-template | https://raw.githubusercontent.com/kajiLabTeam/ipsj-national-convention-typst-template/main/main.typ | typst | #import "template/template.typ": template
#import "@preview/roremu:0.1.0": roremu
#import "@preview/codelst:2.0.0": sourcecode
#import "template/functinos.typ": img, tbl
#show: template.with(
title: ("Typst を用いた", "論文のテンプレート"),
names: (
(ja: "佐藤智", en: "<NAME>", group: 1),
(ja: "斎藤彩都", en: "<NAME>", group: 2),
(ja: "山田邪馬", en: "<NAME>", group: 1),
),
affiliations: (
(ja: "愛知工業大学情報科学部", en: "Aichi Institute of Technology", group: 1),
(ja: "愛知工業大学大学院経営情報科学研究科", en: "Department of Information Science", group: 2),
),
)
= はじめに
非公式Typst 版 情報処理学会全国大会テンプレートです。このテンプレートの利用は自由ですが、このテンプレートを利用したことによるいかなる損害についても、作者は責任を負いません。
= 使用方法
== リポジトリ
このリポジトリ @リポジトリ はテンプレートリポジトリになっています。GitHubの画面右上から "Use this template" を押して新しいリポジトリを作成してください。
== 表
#tbl(
table(
columns: 2,
align: center,
stroke: (x, y) => (
top: if y == 0 {
0pt
} else if y == 1 {
1pt
} else {
0.5pt
},
),
[数学記号], [数学記号を表す文字列],
$sum$, "\sum",
$infinity$, "\infty",
$cos$, "\cos",
$sin$, "\sin",
$pi$, "\pi",
$integral$, "\int",
),
caption: [数式記号],
) <数式記号>
@数式記号 のように表を表示できます。
== 画像
#img(image("images/typst.svg", width: 20%), caption: [typstロゴ]) <typstロゴ>
@typstロゴ のように画像を表示することもできます。
== 数式
$
f(x) = a_0 + sum_(n=1)^infinity (a_n cos (n pi x) / L + b_n sin (n pi x) / L)
$
数式は以上のように TeX とは異なる記法で書くことができます @数式の書き方。
== コードブロック
#sourcecode[```c
#include <stdio.h>
int main() {
printf("Hello, World!\n");
return 0;
}
```]
= アデリーペンギンのかわいさ
アデリーペンギンとは、そのシンプルさや愛くるしさから JR東日本の発行する Suica @Suica をはじめとするマスコットキャラクタに採用されている。
== 名前の由来
アデリーペンギンの名前の由来は、フランスの探検家ジュール・デュモン・デュルヴィルが南極大陸のアデリーランドでこのペンギンを発見したことによる。アデリーランドはデュモン・デュルヴィルの妻アデリーへの献名であり、その地で発見されたペンギンもアデリーペンギンと名付けられた。
== 特徴
アデリーペンギンの魅力はなんといっても目の周りのアイリングである。このアイリングは目の周りを白く囲っている。そのため目を見開いているときはまん丸さを強調し、閉じているときは一直線のように見えるため、表情が豊かに見える。
また身体は柔らかくまるで液体かのようにみえことから、佐藤さとる @佐藤さとる は「ペンギン界のネコ」と呼んでいる。ただし、これは一般的ではない。
== まとめ
書くのが面倒なのでここで終わりにする。結局のところアデリーペンギンはかわいいのである。
= 吾輩は猫である
#roremu(359)
= 吾輩は企鵝である
吾輩は企鵝である。
名前はまだ無い。
どこで生れたかとんと見当がつかぬが多分南極圏である。
何でも非常に寒く感想した所でボエェーボエェー鳴いていた事だけは記憶している。
吾輩はここで始めて人間というものを見た。
しかもあとで聞くとそれは研究者という人間中で一番獰悪な種族であったそうだ。
この研究者というのは時々我々を捕えてセンサを取り付けるという話である。
しかしその当時は何という考もなかったから別段恐しいとも思わなかった。
ただ彼の掌に載せられて袋を被せられた時何だかフワフワした感じがあったばかりである。
膝の上で少し落ちついて研究者の顔を見たのがいわゆる人間というものの見始であろう。
この時妙なものだと思った感じが今でも残っている。
第一油をもって撥水されべきはずの身体がつるつるしてまるで海綿だ。
その後皇帝にもだいぶ逢ったがこんな片輪には一度も出会わした事がない。
#bibliography("refs.yml", title: "参考文献", style: "nature")
|
|
https://github.com/yhtq/Notes | https://raw.githubusercontent.com/yhtq/Notes/main/复变函数/作业/hw4.typ | typst | #import "../../template.typ": proof, note, corollary, lemma, theorem, definition, example, remark, proposition,der, partialDer
#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: note.with(
title: "作业4",
author: "YHTQ",
date: none,
logo: none,
withOutlined : false,
withTitle :false,
)
#let Gal = $G a l$
#set heading(numbering: none)
(应交时间为3月29日)
= p55
== 8
题设表明对于任意 $z in RR^infinity$,有:
$
(a z + b)/(c z + d) = (overline(a) z + overline(b))/(overline(c) z + overline(d)) = ((a + overline(a))z + (b + overline(b)))/((c + overline(c))z + (d + overline(d)))
$
令:
$
T'(z) = ((a + overline(a))z + (b + overline(b)))/((c + overline(c))z + (d + overline(d)))
$
上式表明在 $RR^infinity$ 上均有 $T = T'$,而分式线性变换只需三点便可确定,进而 $T= T'$
注意这里莫比乌斯变换由三点唯一确定是熟知的,而考虑包括退化情况同样也可被三点确定。事实上,若设 $T$ 是退化的,也即:
$
T = c
$
应当有:
$
(a' z_i + b')/(c' z_i + d') = c, i = 1, 2, 3
$
假设上式左侧不退化,$z_i$ 将成为同一个一次方程的三个不同零点——这是荒谬的
== 15
取:
$
f(z) = (z-1)/(1+z)
$
它将开圆盘映成左半平面\
因此:
$
e^(f(z))
$
将开圆盘映成 ${z:0 < abs(z) < 1}$
$
1/(z^2 - 1) = k\
z^2 = 1 + 1/k
$
= 25
#lemmaLinear[][
非平凡莫比乌斯变换 $S, T$ 交换当且仅当有相同的不动点
]
#proof[
讨论 $S$ 的不动点数量
- 设它有两个不动点,且 $S' = Inv(h) S h$ 的不动点恰为 $0, infinity$,则令 $T' = Inv(h) T h$
此时,可设:
$
S' = k z,
T' = (a z + b)/(c z + d)
$
- 若两者可交换,由 $S' T' = T' S'$ 得:
$
(a k z + b)/(c k z + d) = (a k z + b k)/(c z + d)\
(a k z + b)(c z + d) = (a k z + b k)(c k z + d)
$
观察二次项系数,可得:
$
a k c = a c k^2
$
由于 $k != 0, 1$,上式给出 $a c = 0$\
观察常数项系数,有:
$
b d = b k d => b d =0
$
观察一次项系数,有:
$
a k d + b c = a k d + b c k^2 => b c= 0
$
注意到 $a b$ 不同时为零,因此 $c = 0$,继而 $d != 0, b = 0$,故:
$
T' = a/d z
$
这表明 $T'$ 的不动点也为 $0, infinity$\
反之,若 $T'$ 的不动点也为 $0, infinity$,则可设 $T' = g z$ ,它们当然可交换
- 若 $S$ 有一个不动点,且 $S' = Inv(h) S h$ 的不动点恰为 $infinity$,则令 $T' = Inv(h) T h$
此时,可设:
$
S' = z + k\
T' = (a z + b)/(c z + d)
$
- 若两者可交换,由 $S' T' = T' S'$ 得:
$
(a z + b + a k)/(c z + d + c k) = (a z + b )/(c z + d) + k = ((a + k c) z + b + k d )/(c z + d)
$
将有:
$
a c = a c + k c^2 => k c^2 = 0 => c = 0\
d(b + a k) =d (b + k d) => k d^2 = a k d => d = a\
$
因此 $T' = z + b / d$,不动点恰为 $infinity$\
- 反之,若 $T'$ 的不动点也为 $infinity$,则可设 $T' = z + k'$ ,它们当然可交换
证毕
]
前面的习题说明了两个莫比乌斯变换交换当且仅当有相同的不动点,从而对于任何一个交换子群,其中的元素应该有相同的不动点。
通过适当的共轭(这是群自同构,不改变交换性),我们可以假设共同的不动点是:
- $0, infinity$,这表明整个子群中的元素都形如 $a z$,该群同构于 $ZZ^*$
- $infinity$,表明整个子群中的元素都是 $z + b$,同构于 $ZZ^+$
换言之,所有的交换子群恰为以上两群的所有子群对应的所有共轭类 |
|
https://github.com/frectonz/the-pg-book | https://raw.githubusercontent.com/frectonz/the-pg-book/main/book/008.%20rootsoflisp.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)
#v(10pt)
= The Roots of Lisp
#v(10pt)
_May 2001_
_(I wrote this article to help myself understand exactly what McCarthy discovered. You don't need to know this stuff to program in Lisp, but it should be helpful to anyone who wants to understand the essence of Lisp -- both in the sense of its origins and its semantic core. The fact that it has such a core is one of Lisp's distinguishing features, and the reason why, unlike other languages, Lisp has dialects.)_
In 1960, <NAME> published a remarkable paper in which he did for programming something like what Euclid did for geometry. He showed how, given a handful of simple operators and a notation for functions, you can build a whole programming language. He called this language Lisp, for "List Processing," because one of his key ideas was to use a simple data structure called a list for both code and data.
It's worth understanding what McCarthy discovered, not just as a landmark in the history of computers, but as a model for what programming is tending to become in our own time. It seems to me that there have been two really clean, consistent models of programming so far: the C model and the Lisp model. These two seem points of high ground, with swampy lowlands between them. As computers have grown more powerful, the new languages being developed have been moving steadily toward the Lisp model. A popular recipe for new programming languages in the past 20 years has been to take the C model of computing and add to it, piecemeal, parts taken from the Lisp model, like runtime typing and garbage collection.
In this article I'm going to try to explain in the simplest possible terms what McCarthy discovered. The point is not just to learn about an interesting theoretical result someone figured out forty years ago, but to show where languages are heading.The unusual thing about Lisp -- in fact, the defining quality of Lisp -- is that it can be written in itself. To understand what McCarthy meant by this, we're going to retrace his steps, with his mathematical notation translated into running Common Lisp code.
|
|
https://github.com/typst/packages | https://raw.githubusercontent.com/typst/packages/main/packages/preview/unichar/0.1.0/ucd/block-1ED00.typ | typst | Apache License 2.0 | #let data = (
(),
("OTTOMAN SIYAQ NUMBER ONE", "No", 0),
("OTTOMAN SIYAQ NUMBER TWO", "No", 0),
("OTTOMAN SIYAQ NUMBER THREE", "No", 0),
("OTTOMAN SIYAQ NUMBER FOUR", "No", 0),
("OTTOMAN SIYAQ NUMBER FIVE", "No", 0),
("OTTOMAN SIYAQ NUMBER SIX", "No", 0),
("OTTOMAN SIYAQ NUMBER SEVEN", "No", 0),
("OTTOMAN SIYAQ NUMBER EIGHT", "No", 0),
("OTTOMAN SIYAQ NUMBER NINE", "No", 0),
("OTTOMAN SIYAQ NUMBER TEN", "No", 0),
("OTTOMAN SIYAQ NUMBER TWENTY", "No", 0),
("OTTOMAN SIYAQ NUMBER THIRTY", "No", 0),
("OTTOMAN SIYAQ NUMBER FORTY", "No", 0),
("OTTOMAN SIYAQ NUMBER FIFTY", "No", 0),
("OTTOMAN SIYAQ NUMBER SIXTY", "No", 0),
("OTTOMAN SIYAQ NUMBER SEVENTY", "No", 0),
("OTTOMAN SIYAQ NUMBER EIGHTY", "No", 0),
("OTTOMAN SIYAQ NUMBER NINETY", "No", 0),
("OTTOMAN SIYAQ NUMBER ONE HUNDRED", "No", 0),
("OTTOMAN SIYAQ NUMBER TWO HUNDRED", "No", 0),
("OTTOMAN SIYAQ NUMBER THREE HUNDRED", "No", 0),
("OTTOMAN SIYAQ NUMBER FOUR HUNDRED", "No", 0),
("OTTOMAN SIYAQ NUMBER FIVE HUNDRED", "No", 0),
("OTTOMAN SIYAQ NUMBER SIX HUNDRED", "No", 0),
("OTTOMAN SIYAQ NUMBER SEVEN HUNDRED", "No", 0),
("OTTOMAN SIYAQ NUMBER EIGHT HUNDRED", "No", 0),
("OTTOMAN SIYAQ NUMBER NINE HUNDRED", "No", 0),
("OTTOMAN SIYAQ NUMBER ONE THOUSAND", "No", 0),
("OTTOMAN SIYAQ NUMBER TWO THOUSAND", "No", 0),
("OTTOMAN SIYAQ NUMBER THREE THOUSAND", "No", 0),
("OTTOMAN SIYAQ NUMBER FOUR THOUSAND", "No", 0),
("OTTOMAN SIYAQ NUMBER FIVE THOUSAND", "No", 0),
("OTTOMAN SIYAQ NUMBER SIX THOUSAND", "No", 0),
("OTTOMAN SIYAQ NUMBER SEVEN THOUSAND", "No", 0),
("OTTOMAN SIYAQ NUMBER EIGHT THOUSAND", "No", 0),
("OTTOMAN SIYAQ NUMBER NINE THOUSAND", "No", 0),
("OTTOMAN SIYAQ NUMBER TEN THOUSAND", "No", 0),
("OTTOMAN SIYAQ NUMBER TWENTY THOUSAND", "No", 0),
("OTTOMAN SIYAQ NUMBER THIRTY THOUSAND", "No", 0),
("OTTOMAN SIYAQ NUMBER FORTY THOUSAND", "No", 0),
("OTTOMAN SIYAQ NUMBER FIFTY THOUSAND", "No", 0),
("OTTOMAN SIYAQ NUMBER SIXTY THOUSAND", "No", 0),
("OTTOMAN SIYAQ NUMBER SEVENTY THOUSAND", "No", 0),
("OTTOMAN SIYAQ NUMBER EIGHTY THOUSAND", "No", 0),
("OTTOMAN SIYAQ NUMBER NINETY THOUSAND", "No", 0),
("OTTOMAN SIYAQ MARRATAN", "So", 0),
("OTTOMAN SIYAQ ALTERNATE NUMBER TWO", "No", 0),
("OTTOMAN SIYAQ ALTERNATE NUMBER THREE", "No", 0),
("OTTOMAN SIYAQ ALTERNATE NUMBER FOUR", "No", 0),
("OTTOMAN SIYAQ ALTERNATE NUMBER FIVE", "No", 0),
("OTTOMAN SIYAQ ALTERNATE NUMBER SIX", "No", 0),
("OTTOMAN SIYAQ ALTERNATE NUMBER SEVEN", "No", 0),
("OTTOMAN SIYAQ ALTERNATE NUMBER EIGHT", "No", 0),
("OTTOMAN SIYAQ ALTERNATE NUMBER NINE", "No", 0),
("OTTOMAN SIYAQ ALTERNATE NUMBER TEN", "No", 0),
("OTTOMAN SIYAQ ALTERNATE NUMBER FOUR HUNDRED", "No", 0),
("OTTOMAN SIYAQ ALTERNATE NUMBER SIX HUNDRED", "No", 0),
("OTTOMAN SIYAQ ALTERNATE NUMBER TWO THOUSAND", "No", 0),
("OTTOMAN SIYAQ ALTERNATE NUMBER TEN THOUSAND", "No", 0),
("OTTOMAN SIYAQ FRACTION ONE HALF", "No", 0),
("OTTOMAN SIYAQ FRACTION ONE SIXTH", "No", 0),
)
|
https://github.com/AxiomOfChoices/Typst | https://raw.githubusercontent.com/AxiomOfChoices/Typst/master/Miscellaneous/CV.typ | typst | #let name = "<NAME>"
#set document(
title: "Curriculum Vitae",
author: name,
keywords: (
"Mathematics",
"Analysis",
"Geometry",
"Geometric Analysis",
),
)
#set text(
size: 11pt,
font: (
"EB Garamond 12"
),
)
#set page(
margin: (
x: 1.0in,
y: 1.0in,
),
width: 7.5in,
height: 9.0in,
)
#set par(
first-line-indent: 0cm,
leading: (
0.9 * 0.65em
),
justify: true,
)
#let tab_width = 1.7cm
#let list_spacing = 1em
#let title(
it,
) = text(
weight: "bold",
size: 25pt,
)[#it]
#set list(
marker: [],
body-indent: 0pt,
tight: false,
spacing: list_spacing,
)
#set terms(separator: context (
h(
1em,
weak: true,
)
))
#let tabbed_list = table.with(
inset: 0pt,
column-gutter: 1em,
row-gutter: 1em,
stroke: none,
columns: (
1.4cm,
1fr,
),
)
#show heading: set block(
above: 22pt + 1em,
below: 4pt + 1em,
)
#show heading: set text(
font: "Tex Gyre Heros",
size: 10pt,
weight: "bold",
tracking: 0.03em,
)
#show heading: it => upper(it)
#let date = datetime.today()
#let month_year_date = date.display("[month repr:long] [year]")
#title(name)
#v(1em)
#table(
columns: 2,
stroke: none,
inset: 0pt,
block(width: 70%)[
Department of Mathematics\
McGill University
],
block(width: auto)[
#set align(end)
#link("mailto:<EMAIL>")[<EMAIL>]\
\+1~514~443~4196\
#link("https://axiomofchoice.dev")[axiomofchoice.dev]
],
)
= Education
#tabbed_list(
[M.S.],
[Mathematics and Statistics, McGill University, Montreal, 2022-2024],
[B.S.],
[Honours Mathematics and Computer Science, McGill University, Montreal, 2019-2022],
)
= Research Areas
- Geometric analysis, specifically geometric flows and their application to geometric inequalities.
- Mean Curvature Flow, Ricci Flow.
#bibliography(
"Preprints.bib",
style: "springer-mathphys",
full: true,
title: "Preprints",
)
|
|
https://github.com/grnin/Zusammenfassungen | https://raw.githubusercontent.com/grnin/Zusammenfassungen/main/Bsys2/Bsys2_Spick_FS24_NG_JT.typ | typst | // Compiled with Typst 0.11.1
#import "../template_zusammenf.typ": *
#import "@preview/wrap-it:0.1.0": wrap-content
#show: project.with(
authors: ("<NAME>", "<NAME>"),
fach: "BSys2",
fach-long: "Betriebssysteme 2",
semester: "FS24",
language: "de",
column-count: 5,
font-size: 4pt,
landscape: true,
)
#let wait = ```c wait()```
```c
int *px = &x; // &x = Adresse des ints, * = Pointer-Bezeichner
int y = *px; // *px = Wert einer int-Adresse, y = 5, * = Dereferenzoper.
```
#table(
columns: (auto,) * 5 + (2.75em,) * 4 + (1fr,) * 4,
[$4096$],[$2048$],[$1024$],[$512$],[$256$],[$128$],[$64$],[$32$],[$16$],[$8$],[$4$],[$2$],[$1$],
[$2^12$],[$2^11$],[$2^10$],[$2^9$],[$2^8$],[$2^7$],[$2^6$],[$2^5$],[$2^4$],[$2^3$],[$2^2$],[$2^1$],[$2^0$],
[#hex("1000")],[#hex("800")],[#hex("400")],[#hex("200")],[#hex("100")],[#hex("80")],[#hex("40")],[#hex("20")],[#hex("10")],[#hex("8")],[#hex("4")],[#hex("2")],[#hex("1")],
)
#table(
columns: (1fr,) * 6,
[$1'048'576$],[$65'536$],[$4'096$],[$256$],[$16$],[$1$],
[$16^5$],[$16^4$],[$16^3$],[$16^2$],[$16^1$],[$16^0$],
[#hex("10 0000")],[#hex("01 0000")],[#hex("00 1000")],[#hex("00 0100")],[#hex("00 0010")],[#hex("00 0001")],
)
#{
show raw: set text(size: 0.9em)
table(
columns: (1fr,) * 16,
align: (_, y) => if (y == 2) { center } else { left },
[$0$],[$1$],[$2$],[$3$],[$4$],[$5$],[$6$],[$7$],[$8$],[$9$],[$A$],[$B$],[$C$],[$D$],[$E$],[$F$],
[$0$],[$1$],[$2$],[$3$],[$4$],[$5$],[$6$],[$7$],[$8$],[$9$],[$10$],[$11$],[$12$],[$13$],[$14$],[$15$],
[`0000`],[`0001`],[`0010`],[`0011`],[`0100`],[`0101`],[`0110`],[`0111`],[`1000`],[`1001`],[`1010`],[`1011`],[`1100`],[`1101`],[`1110`],[`1111`],
)
}
= Betriebssystem API
*Aufgaben:*
Abstraktion, Portabilität, Ressourcenmanagement & Isolation der Anwendungen,
Benutzerverwaltung und Sicherheit.\
*Privilege Levels:*
_Kernel-Mode_ #hinweis[(darf alles ausführen, Ring 0)],
_User-Mode_ #hinweis[(darf nur beschränkte Menge an Instruktionen ausführen, Ring 3)]\
*Kernels:*
_Microkernel_ #hinweis[(nur kritische Teile laufen im Kernel-Mode)],
_Monolithisch_ #hinweis[(meiste OS, weniger Wechsel, weniger Schutz)],
_Unikernel_ #hinweis[(Kernel ist nur ein Programm)]\
*`syscall`*
veranlasst den Prozessor, in den Kernel Mode zu schalten. Jede OS-Kernel-Funktion
hat einen Code, der einem Register übergeben werden muss. #hinweis[(`exit` hat den Code 60)]\
*ABI:*
Application Binary Interface, Abstrakte Schnittstelle mit platformunabhängigen Aspekten.
*API:*
Application Programming Interface, Konkrete Schnittstellen, Calling Convention, Abbildung
von Datenstrukturen. _Linux-Kernels_ sind API-, aber nicht ABI-kompatibel.
#hinweis[(C-Wrapper-Funktionen)]\
*POSIX:*
Portable Operating System Interface. Sammlung von IEEE Standards, welche die Kombatibilität
zwischen OS gewährleistet. Windows ist nicht POSIX-konform.
== Programmargumente
`clang` *`-c abc.c -o abc.o`*. Die Shell teilt Programmargumente in Strings auf
#hinweis[(Trennung durch Leerzeichen, sonst Quotes)].
*Calling Convention:*
OS schreibt Argumente als null-terminierte Strings in den Speicherbereich des Programms.
Zusätzlich legt das OS ein Array `argv` an, dessen Elemente jeweils auf das erste Zeichen
eines Arguments zeigen. Die Art und Weise, wie das gehandhabt wird, ist die Calling Convention.
Werden explizit angegeben, nützlich für Informationen, die bei jedem Aufruf anders sind.\
```c int main(int argc, char ** argv) { ... } // argv[0] = program path```
== Umgebungsvariablen
Strings, die mindestens ein `Key=Value` enthalten #hinweis[`OPTER=1`, `PATH=/home/ost/bin`].
Der Key muss einzigartig sein. Unter POSIX verwaltet das OS die Umgebungsvariablen innerhalb
jedes laufenden Prozesses. Werden initial festgelegt. Das OS legt die Variablen als ein
null-terminiertes Array von Pointern auf null-terminierte Strings ab. Unter C zeigt die
Variable ```c extern char **environ``` darauf. Sollte nur über untenstehende Funktionen
manipuliert werden. Werden implizit bereitgestellt, nützlich für Informationen, die bei
jedem Aufruf gleich sind.
- *Abfragen einer Umgebungsvariable:* ```c char *value = getenv("PATH");```
- *Setzen einer Umgebungsvariable:* ```c int ret = setenv("HOME", "/usr/home", 1);```
- *Entfernen einer Umgebungsvariable:* ```c int ret = unsetenv("HOME");```
- *Hinzufügen einer Umgebungsvariable :* ```c int ret = putenv("HOME=/usr/home");```\
#hinweis[gefährlich wegen Pointer auf NULL]
_Grössere Konfigurationsinformationen_ sollten über _Dateien_ übermittelt werden.
= Dateisystem API
Applikationen dürfen nie annehmen, dass Daten gültig sind.\
*Arbeitsverzeichnis:*
Bezugspunkt für relative Pfade, jeder Prozess hat eines
#hinweis[(`getcwd()`, `chdir()`: nimmt String, `fchdir()`: nimmt File Deskriptor)].\
*Pfade:*
Absolut #hinweis[(beginnt mit /)],
Relativ #hinweis[(beginnt nicht mit /)],
Kanonisch #hinweis[(Absolut, ohne "." und "..". `realpath()`)]\
- _`NAME_MAX`:_ Maximale Länge eines Dateinamens (exklusive terminierender Null)
- _`PATH_MAX`:_ Maximale Länge eines Pfads (inklusive terminierender Null)
#hinweis[(beinhaltet Wert von `NAME_MAX`)]
- _`_POSIX_NAME_MAX`:_ Minimaler Wert von `NAME_MAX` nach POSIX #hinweis[(14)]
- _`_POSIX_PATH_MAX`:_ Minimaler Wert von `PATH_MAX` nach POSIX #hinweis[(256)]
```c int main (int argc, char ** argv) { char *wd = malloc(PATH_MAX); getcwd(wd, PATH_MAX); printf("Current WD is %s", wd); free(wd); return 0; } // Gibt Arbeitsverzeichnis aus```
*Zugriffsrechte:*
Je 3 Permission-Bits für Owner, Gruppe und andere Benutzer.
Bits sind: _`r`_ead, _`w`_rite, e_`x`_ecute. `r=4, w=2, x=1`.
_Beispiel:_ `0740` oder `rwx r-- ---`
#hinweis[Owner hat alle Rechte, Gruppe kann lesen, andere haben keine Rechte.]
*POSIX:*
_`S_IRWXU`_ `= 0700`, _`S_IWUSR`_ `= 0200`, _`S_IRGRP`_ `= 0040`, _`S_IXOTH`_ `= 0001`.
Werden mit | verknüpft.
*POSIX-API:*
für direkten Zugriff, alle Dateien sind rohe Binärdaten.
*C-API:*
für direkten Zugriff auf Streams.
*POSIX FILE API:*
für direkten, unformatierten Zugriff auf Inhalt der Datei. Nur für Binärdaten verwenden.
*`errno`:*
Makro oder globale Variable vom typ `int`.
Sollte direkt nach Auftreten eines Fehlers aufgerufen werden.
```c if (chdir("docs") < 0) { if (errno == EACCESS) { printf("Error: Denied"); }}```
*`strerror`*
gibt die Adresse eines Strings zurück, der den Fehlercode `code` textuell beschreibt.
*`perror`*
schreibt `text` gefolgt von einem Doppelpunkt und vom Ergebnis von `strerror(errno)`
auf den Errorstream.
== File-Descriptor (FD)
Files werden in der POSIX-API über FD's repräsentiert. Gilt nur _innerhalb eines Prozesses_.
Returnt _Index in Tabelle_ aller geöffneter Dateien im Prozess #sym.arrow
Enthält _Index in systemweite Tabelle_ #sym.arrow Enthält Daten zur Identifikation der Datei.
_`STDIN_FILENO = 0`:_ standard input,
_`STDOUT_FILENO = 1`:_ standard output,
_`STDERR_FILENO = 2`:_ standard error
*```c int open (char *path, int flags, ...)```:*
_öffnet_ eine Datei. Erzeugt FD auf Datei an `path`.
`flags` gibt an, *wie* die Datei geöffnet werden soll.
_`O_RDONLY`:_ nur lesen,
_`O_RDWR`:_ lesen und schreiben,
_`O_CREAT`:_ Erzeuge Datei, wenn sie nicht existiert,
_`O_APPEND`:_ Setze Offset ans Ende der Datei vor jedem Schreibzugriff,
_`O_TRUNC`:_ Setze Länge der Datei auf 0
*```c int close (int fd)```:*
_schliesst_ Datei bzw. _dealloziert_ den FD. Kann dann wieder für andere Dateien verwendet
werden. Wenn FD's nicht geschlossen werden, kann das FD-Limit erreicht werden, dann können
keine weiteren Dateien mehr geöffnet werden.
Wenn mehrere FDs die gleiche Datei öffnen, können sie sich gegenseitig Daten überschreiben.
```c
int fd = open("myfile.dat", O_RDONLY);
if (fd < 0) { /* error handling */ } /* read data; */ close(fd);
```
*```c ssize_t read(int fd, void * buffer, size_t n)```:*\
_kopiert_ die nächsten $n$ Bytes am aktuellen Offset _von fd in den Buffer_.\
*```c ssize_t write(int fd, void * buffer, size_t n)```:*\
_kopiert_ die nächsten $n$ Byte _vom `buffer` an den aktuellen Offset von `fd`_
```c
#define N 32
char buf[N]
char spath[PATH_MAX]; // source path
char dpath[PATH_MAX]; // destination path
// ... gets paths from somewhere
int src = open(spath, O_RDONLY);
int dst = open(dpath, O_WRONLY | O_CREAT, S_IRWXU);
ssize_t read_bytes = read(src, buf, N);
write(dst, buf, read_bytes); //if file gets closed early, use return value of "read_bytes"
close(src);
close(dst);
```
*```c off_t lseek(int fd, off_t offset, int origin)```:*
_Springen in einer Datei_. Verschiebt den Offset und gibt den neuen Offset zurück.
_`SEEK_SET`:_ Beginn der Datei,
_`SEEK_CUR`:_ Aktueller Offset,
_`SEEK_END`:_ Ende der Datei.
_`lseek(fd, 0, SEEK_CUR)`_ gibt aktuellen Offset zurück,
_`lseek(fd, 0, SEEK_END)`:_ gibt die Grösse der Datei zurück.
*```c ssize_t pread/pwrite(int fd, void * buffer, size_t n, off_t offset)```:*\
_Lesen und Schreiben ohne Offsetänderung_. Wie `read` bzw. `write`. Statt des Offsets von
`fd` wird der zusätzliche Parameter `offset` verwendet.
=== Unterschiede Windows und POSIX
Bestandteile von Pfaden werden durch _Backslash_ (`\`) getrennt, ein _Wurzelverzeichnis pro_
Datenträger/Partition, andere File-Handling-Funktionen.
== C Stream API
Unabhängig vom Betriebssystem, Stream-basiert, gepuffert oder ungepuffert,
hat einen eigenen File-Position-Indicator.\
*Streams:*
`FILE *` enthält _Informationen über einen Stream_. Soll nicht direkt verwendet oder kopiert
werden, sondern nur über von C-API erzeugte Pointer.
*```c FILE * fopen(char const *path, char const *mode)```:*
_Öffnen eine Datei._ Erzeugt `FILE`-Objekt für Datei an `path`. Flags für `mode`:
_`"r"`_ #hinweis[(Datei lesen)],
_`"w"`_ #hinweis[(in neue oder bestehende geleerte Datei schreiben)],
_`"a"`:_ #hinweis[(in neue oder bestehende Datei anfügen)],
_`"r+`:_ #hinweis[(Datei lesen & schreiben)],
_`"w+"`_ #hinweis[(neue oder geleerte bestehende Datei lesen & überschreiben)],
_`"a+"`_ #hinweis[(neue oder bestehende Datei lesen & an Datei anfügen)].
Gibt Pointer auf erzeugtes `FILE`-Objekt zurück oder 0 bei Fehler.
```c FILE * fdopen(int fd, char const * mode)```
ist gleich, aber statt Pfad wird direkt der FD übergeben.
```c int fileno (FILE *stream)```
gibt FD zurück. Nach API-Umwandlung vorherige nicht mehr verwenden.\
*```c int fclose(FILE *file)```:*
_Schliesst eine Datei._
Ruft ```c fflush()``` #hinweis[(schreibt Inhalt aus Speicher in die Datei)] auf, schliesst
den Stream, entfernt `file` aus Speicher und gibt 0 zurück wenn OK, andernfalls `EOF`.\
*```c int fgetc(FILE *stream)```:*
_Liest_ das nächste Byte und erhöht FPI um 1.\
```c char * fgets(char *buf, int n, FILE *stream)``` liest bis zu $n-1$ Zeichen aus `stream`.\
*```c int ungetc(int c, FILE *stream)```:*
_Lesen rückgängig machen._ Nutzt Unget-Stack.\
*```c int fputc(int c, FILE *stream)```: *
_Schreibt `c` in eine Datei._ ```c int fputs(char *s, FILE *stream)``` schreibt die Zeichen
vom String `s` bis zur terminierenden 0 in `stream`.
=== Dateiende und Fehler:
```c int feof(FILE *stream)``` gibt 0 zurück, wenn Dateiende _noch nicht_ erreicht wurde\
```c int ferror(FILE * stream)``` gibt 0 zurück, wenn _kein_ Fehler auftrat.
=== Manipulation des File-Position-Indicator (FPI):
```c long ftell(FILE *stream)``` gibt den gegenwärtigen FPI zurück,
```c int fseek (FILE *stream, long offset, int origin)``` setzt den FPI, analog zu `lseek`,
```c int rewind (FILE *stream)``` setzt den Stream zurück.
= Prozesse
Prozesse #hinweis[(aktiv)] sind die _Verwaltungseinheit_ des OS für Programme #hinweis[(passiv)].
Jedem Prozess ist ein _virtueller Adressraum_ zugeordnet.\
Ein Prozess umfasst das _Abbild eines Programms_ im Hauptspeicher #hinweis[(text section)],
die _globalen Variablen des Programms_ #hinweis[(data section)],
Speicher für den _Heap_ und Speicher für den _Stack_.\
*Process Control Block (PCB):*
Das Betriebssystem hält Daten über jeden Prozess in jeweils einem _PCB_ vor. Speicher für
alle Daten, die das OS benötigt, um die Ausführung des Prozesses ins Gesamtsystem zu
integrieren, u.a.: Diverse IDs, Speicher für Zustand, Scheduling-Informationen, Daten zur
Synchronisation, Security-Informationen etc.\
*Interrupts:*
_Kontext_ des aktuellen Prozesses muss im dazugehörigen PCB gespeichert werden #hinweis[(context save)]:
Register, Flags, Instruction Pointer, MMU-Konfiguration. _Interrupt-Handler_ überschreibt
den Kontext. Anschliessend wird Kontext aus PCB wiederhergestellt #hinweis[(context restore)].\
*Prozess-Erstellung:*
Das OS erzeugt den Prozess und lädt das Programm in den Prozess.
Unter POSIX getrennt, unter Windows eine einzige Funktion.\
*Prozess-Hierarchie:*
Baumstruktur, startet bei Prozess 1.
== Prozess-API
*```c pid_t fork(void)```*
erzeugt _exakte Kopie_ ($C$) als Kind des Prozesses ($P$), mit eigener Prozess-ID (>0).
Die Funktion führt in _beiden_ Prozessen den Code an derselben Stelle fort.\
*```c void exit(int code)```:* Beendet das Programm und gibt `code` zurück.\
*```c pid_t wait(int *status)```:* unterbricht Prozess, bis Child beendet wurde.\
*```c pid_t waitpid (pid_t pid, int *status, int options)```:*
wie #wait, aber `pid` bestimmt, auf welchen Child-Prozess man warten will
#hinweis[(> 0 = Prozess mit dieser ID, -1 = irgendeinen, 0 = alle C mit der gleichen Prozessgruppen-ID)].
```c
void spawn_worker (...) {
if (fork() == 0) { /* do something in worker process; */ exit(0); }
}
for (int i = 0; i < n; ++i) { spawn_worker(...); }
// ... do something in parent process
do { pid = wait(0); } while (pid > 0 || errno != ECHILD); // wait for all children
```
*`exec()`-Funktionen:*
Jede davon _ersetzt_ im gerade laufenden Prozess das Programmimage _durch ein anderes_.
Programmargumente müssen spezifiziert werden. #hinweis[(`..l` als Liste, `..v` als Array)]
#table(
columns: (auto, 1fr, auto, auto),
table.header(
[],
[],
[Programmargumente\ als Liste],
[Programmargumente\ als Array],
),
table.cell(rowspan: 2)[Angabe des Pfads],
[mit neuem Environment],
[`execle()`],
[`execve()`],
table.cell(rowspan: 2)[mit altem Environment],
[`execl()`],
[`execv()`],
[Suche über `PATH`],
[`execlp()`],
[`execvp()`]
)
=== Zombie- & Orphan-Prozesse
$C$ ist zwischen seinem Ende und dem Aufruf von #wait durch $P$ ein Zombie-Prozess.
_Dauerhafter Zombie-Prozess:_ $P$ ruft wegen Fehler #wait nie auf.
_Orphan-Prozess:_ $P$ wird vor $C$ beendet. $P$ kann somit nicht mehr auf $C$ warten, was
bei Beendung von $C$ in einem dauerhaften Zombie resultiert. Wenn $P$ beendet wird, werden
deshalb alle $C$ an Prozess mit `pid=1` übertragen, der #wait in einer Endlosschleife aufruft.
*```c unsigned int sleep (unsigned int seconds)```:*
_unterbricht_ Ausführung, bis eine Anzahl Sekunden ungefähr verstrichen ist.
Gibt vom Schlaf noch vorhandene Sekunden zurück.\
*```c int atexit (void (*function)(void))```:*
Registriert Funktionen für Aufräumarbeiten vor Ende.\
*```c pid_t getpid()/getppid()```* geben die (Parent-)Prozess-ID zurück.
= Programme und Bibliotheken
`C-Quelle -> Präprozessor -> Bereinigte C-Quelle -> Compiler -> Assembler-Datei -> Assembler -> Objekt-Datei -> Linker -> Executable`\
_Präprozessor:_ Die Ausgabe des Präprozessors ist eine reine C-Datei (Translation-Unit) ohne
Makros, Kommentare oder Präprozessor-Direktiven.
_Linker:_ Der Linker verknüpft Objekt-Dateien (und statische Bibliotheken) zu Executables
oder dynamischen Bibliotheken.
_Loader_ lädt Executables und eventuelle dynamische Bibliotheken dieser in den Hauptspeicher.
== ELF (Executable and Linking Format)
_Binär-Format_, das Kompilate spezifiziert. Besteht aus #tcolor("grün", "Linking View")
#hinweis[(wichtig für Linker, für Object-Files und Shared Objects)] und
#tcolor("orange", "Execution View") #hinweis[(wichtig für Loader, für Programme und Shared Objects)].
*Struktur:*
Besteht aus _Header_,
#tcolor("orange", "Programm Header Table") #hinweis[(execution view)],
#tcolor("orange", "Segmente") #hinweis[(execution view)],
#tcolor("grün", "Section Header Table") #hinweis[(linking view)],
#tcolor("grün", "Sektionen") #hinweis[(linking view)]
== Segmente und Sektionen
#tcolor("orange", "Segmente") und #tcolor("grün", "Sektionen") sind eine andere Einteilung
für die gleichen Speicherbereiche. View des #tcolor("orange", "Loaders") sind die
#tcolor("orange", "Segmente"), view des #tcolor("grün", "Compilers") die #tcolor("grün", "Sektionen").
Definieren "gleichartige" Daten. Der _Linker_ vermittelt zwischen beiden Views.
*Header:*
Beschreibt den _Aufbau_ der Datei: Typ, 32/64-bit, Encoding, Maschinenarchitektur,
Entrypoint, Infos zu den Einträgen in PHT und SHT.\
#tcolor("orange", "Segment/Program Header Table und Segmente:") Tabelle mit $n$ Einträgen,
jeder Eintrag #hinweis[(je 32 Byte)] beschreibt ein Segment #hinweis[(Typ und Flags, Offset
und Grösse, virtuelle Adresse und Grösse im Speicher - kann unterschiedlich zur Dateigrösse
sein)]. Ist Verbindung zwischen Segmenten im RAM und im File.
Definiert, wo ein Segment liegt und wohin der Loader es im RAM laden soll.\
Segmente werden vom _Loader_ dynamisch _zur Laufzeit_ verwendet.\
#tcolor("grün", "Section Header Table und Sektionen:") Tabelle mit $m$ Einträgen ($!=n$).
Jeder Eintrag #hinweis[(je 40 Byte)] beschreibt eine Sektion #hinweis[(Name, Section-Typ,
Flags, Offset und Grösse, ...)].
Werden vom _Linker_ verwendet: Verschmilzt Sektionen und erzeugt auführbares Executable.\
*String-Tabelle:*
Bereich in der Datei, der nacheinander _null-terminierte Strings enthält_.
Strings werden relativ zum Beginn der Tabelle referenziert.\
*Symbole & Symboltabelle:*
Die Symboltabelle enthält jeweils _einen Eintrag je Symbol_
#hinweis[(16 Byte: 4B Name, 4B Wert, 4B Grösse, 4B Info)].
== Bibliotheken
*Statische Bibliotheken:*
Archive von Objekt-Dateien. Name: `lib<name>.a`, referenziert wird nur `<name>`.
_Linker_ behandelt statische Bibliotheken wie _mehrere Objekt-Dateien_. Ursprünglich gab es
_nur statische Bibliotheken_ #hinweis[(Einfach zu implementieren, aber Funktionalität fix)].\
*Dynamische Bibliotheken:*
Linken erst zur Ladezeit bzw. Laufzeit des Programms. Höherer Aufwand, jedoch austauschbar.
Executable enthält nur Referenz auf Bibliothek. *Vorteile:* Entkoppelter Lebenszyklus,
Schnellere Ladezeiten durch Lazy Loading, Flexibler Funktionsumfang.
== POSIX Shared Objects API
*```c void * dlopen (char * filename, int mode)```:*
_öffnet_ eine dynamische Bibliothek und gibt ein Handle darauf zurück. `mode`:
_`RTLD_NOW`:_ #hinweis[(Alle Symbole werden beim Laden gebunden)]
_`RTLD_LAZY`:_ #hinweis[(Symbole werden bei Bedarf gebunden)],
_`RTLD_GLOBAL`:_ #hinweis[(Symbole können beim Binden anderer Objekt-Dateien verwendet
werden)],
_`RTLD_LOCAL`:_ #hinweis[(Symbole werden nicht für andere OD verwendet)]\
*```c void * dlsym (void * handle, char * name)```:*
gibt die _Adresse des Symbols_ `name` aus der mit `handle` bezeichneten _Bibliothek_ zurück.
Keine Typinformationen #hinweis[(Variabel? Funktion?)]
```c
// type "func_t" is a address of a function with a int param and int return type
typedef int (*func_t)(int);
handle = dlopen("libmylib.so", RTLD_NOW); // open library
func_t f = dlsym(handle, "my_function"); // write "my_function" addr into a func_t
int *i = dlsym(handle, "my_int"); // get address of "my_int"
(*f)(*i); // call "my_function" with "my_int" as parameter
```
*```c int dlclose (void * handle)```:*
schliesst das durch `handle` bezeichnete, zuvor geöffnete Objekt.\
*```c char * dlerror()```:*
gibt Fehlermeldung als null-terminierten String zurück.
*Konventionen:*
Shared Objects können _automatisch_ bei Bedarf geladen werden.
Der Linker verwendet den Linker-Namen, der Loader verwendet den SO-Namen.
_Linker-Name:_ `lib + Bibliotheksname + .so` #hinweis[(z.B. libmylib.so)],
_SO-Name:_ `Linker-Name + . + Versionsnummer` #hinweis[(z.B. libmylib.so.2)],
_Real-Name:_ `SO-name + . + Unterversionsnummer` #hinweis[(z.B. libmylib.so.2.1)]\
*Shared Objects:*
Nahezu alle Executeables benötigen _zwei Shared Objects_:
_`libc.so`:_ Standard C library,
_`ld-linux.so`:_ ELF Shared Object loader #hinweis[(Lädt Shared Objects und rekursiv alle
Dependencies)].\
*Implementierung dynamischer Bibliotheken:*
Müssen verschiebbar sein, mehrere müssen in den gleichen Prozess geladen werden.
Die Aufgabe des Linkers wird in den Loader bzw. Dynamic Linker verschoben
#hinweis[(Load Time Relocation)].
== Shared Memory
Dynamische Bibliotheken sollen _Code zwischen Programmen teilen_. Code soll _nicht mehrfach_
im Speicher abgelegt werden. Mit Shared Memory kann jedes Programm eine _eigene virtuelle
Page_ für den Code definieren. Diese werden auf denselben Frame im RAM gemappt.
Benötigt _Position-Independendent Code_ #hinweis[(Adressen nur relativ zum Instruction
Pointer, Prozessor muss relative Instruktionen anbieten)].\
*Relative Moves via Relative Calls:*
Mittels Hilfsfunktion wird Rücksprungadresse in Register abgelegt, somit kann relativ dazu
gearbeitet werden.\
*Global Offset Table (GOT):*
Pro dynamische Bibliothek & Executable vorhanden, enthält pro Symbol einen Eintrag.
Der Loader füllt zur Laufzeit die Adressen in die GOT ein.\
*Procedure Linkage Table (PLT):*
Implementiert Lazy Binding. Enthält pro Funktion einen Eintrag, dieser enthält Sprungbefehl
an Adresse in GOT-Eintrag. Dieser zeigt auf eine Proxy-Funktion, welche den GOT-Eintrag
überschreibt. _Vorteil:_ erspart bedingten Sprung.
= Threads
Jeder _Prozess_ hat virtuell den _ganzen Rechner_ für _sich alleine_.
_Prozesse_ sind gut geeignet für _unabhängige Applikationen_.
Nachteile: Realisierung _paralleler Abläufe_ innerhalb derselben Applikation ist _aufwändig_.
_Overhead_ zu gross falls nur kürzere Teilaktivitäten, _gemeinsame Ressourcennutzung_ ist _erschwert_.
*Threads:*
_parallel ablaufende Aktivitäten innerhalb eines Prozesses_, welche auf _alle_ Ressourcen im
Prozess gleichermassen Zugriff haben. Benötigen _eigenen Kontext_ und _eigenen Stack_.
Informationen werden in einem _Thread-Control-Block_ abgelegt.
== Amdahls Regel
Nur bestimmte Teile eines Algorithmus können parallelisiert werden.
/ $T$: Ausführungszeit, wenn _komplett seriell_ durchgeführt
#hinweis[Im Bild: $T = T_0 + T_1 + T_2 + T_3 + T_4 $]
/ $n$: Anzahl der Prozessoren
/ $T'$: Ausführungszeit, wenn _maximal parallelisiert_
#hinweis[gesuchte Grösse]
/ $T_s$: Ausführungszeit für den Anteil, der _seriell_ ausgeführt werden _muss_
#hinweis[Im Bild: $T_s = T_0 + T_2 + T_4$]
/ $T - T_s$: Ausführungszeit für den Anteil, der _parallel_ ausgeführt werden _kann_
#hinweis[Im Bild: $T_1 + T_3$]
#wrap-content(
image("img/bsys_25.png"),
align: top + right,
columns: (54%, 46%),
)[
/ $(T - T_s) / n$: Parallel-Anteil verteilt auf alle $n$ Prozessoren, Im Bild: $(T_1 + T_3) / n$
/ $T_s + (T - T_s) / n$: Serieller Teil + Paralleler Teil #hinweis[$= T^'$]
Die _serielle Variante_ benötigt also höchstens _$f$ mal mehr Zeit_ als die _parallele Variante_:
]
#block($ f <= T / T^' = T / (T_s + (T - T_s) / n) $)
$f$ heisst auch _Speedup-Faktor_, weil die parallele Variante max. $f$-mal schneller ist als
die serielle.
Definiert man $s = T_s/T$, also den seriellen Anteil am Algorithmus, dann ist
$s dot T = T_s$. Dadurch erhält man $f$ unabhängig von der Zeit:
#block($
f <= T / (T_s + (T - T_s) / n) = T / (s dot T + (T - s dot T) / n)
= T / (s dot T + (1 - s) / n dot T) => f <= 1 / (s + (1 - s) / n)
$)
#wrap-content(
image("img/bsys_26.png"),
align: top + right,
columns: (61%, 39%),
)[
=== Bedeutung
- Abschätzung einer _oberen Schranke_ für den maximalen Geschwindigkeitsgewinn
- Nur wenn _alles_ parallelisierbar ist, ist der Speedup _proportional_ und _maximal_
#hinweis[$f(0,n) = n$]
- Sonst ist der Speedup mit _höherer Prozessor-Anzahl_ immer _geringer_
#hinweis[(Kurve flacht ab)]
- $f(1,n)$: rein seriell
*Grenzwert:* Mit höherer Anzahl Prozessoren nähert sich der Speedup $1/s$ an:
]
#grid(
columns: (1fr, 1fr, 1fr),
[$ lim_(n -> infinity) (1 - s) / n = 0 $],
[$ lim_(n -> infinity) s + (1 - s) / n = s $],
[$ lim_(n -> infinity) 1 / (s + (1 - s) / n) = 1 / s $],
)
== POSIX THREAD API
*```c int pthread_create(
pthread_t * thread_id, pthread_attr_t const *attributes,
void * (*start_function) (void *), void *argument)
```*
_erzeugt einen Thread_, die ID des neuen Threads wird im Out-Parameter `thread_id`
zurückgegeben. _`attributes`_ ist ein opakes Objekt, mit dem z.B. die Stack-Grösse
spezifiziert werden kann. Die erste auszuführende Instruktion ist die Funktion in
`start_function`. `argument` ist ein Pointer auf eine Datenstruktur auf dem Heap für die
Argumente für `start_function`.
#grid(
columns: (40%, 60%),
gutter: 11pt,
[
```c
//Erstellung
struct T {
int value;
};
void * my_start (void * arg) {
struct T * p = arg;
printf ("%d\n", p->value);
free (arg);
return 0:
}
```
],
[
```c
//Verwendung
void start_my_thread (void) {
struct T * t = malloc (sizeof (struct T));
t->value = 109;
pthread_t tid;
pthread_create (
&tid,
0, // default attributes
&my_start,
t);}
```
],
)
*Thread-Attribute:*
```c
pthread_attr_t attr; // Variabel erstellen
pthread_attr_init (&attr); // Variabel initialisieren
pthread_attr_setstacksize (&attr, 1 << 16); // 64kb Stackgrösse
pthread_create (..., &attr, ...); // Thread erstellen
pthread_attr_destroy (&attr); // Attribute löschen
```
*Lebensdauer:*
Lebt solange, bis er aus der Funktion _`start_function`_ zurückspringt, er _`pthread_exit`_
oder ein anderer Thread _`pthread_cancel`_ aufruft oder sein Prozess beendet wird.
*```c void pthread_exit (void *return_value)```:*
_Beendet_ den Thread und gibt den `return_value` zurück.
Das ist äquivalent zum Rücksprung aus `start_function` mit dem Rückgabewert.\
*```c int pthread_cancel (pthread_t thread_id)```:*
Sendet eine _Anforderung_, dass der Thread mit `thread_id` _beendet_ werden soll.
Die Funktion _wartet nicht_, dass der Thread _tatsächlich beendet_ wurde. Der Rückgabewert
ist 0, wenn der Thread existiert, bzw. `ESRCH` #hinweis[(error_search)], wenn nicht.\
*```c int pthread_detach (pthread_t thread_id)```:*
_Entfernt den Speicher_, den ein Thread belegt hat, falls dieser _bereits beendet_ wurde.
Beendet den Thread aber _nicht_. #hinweis[(Erstellt Daemon Thread)]\
*```c int pthread_join (pthread_t thread_id, void **return_value)```:*
_Wartet_ solange, bis der Thread mit `thread_id` _beendet_ wurde.
Nimmt den _Rückgabewert_ des Threads im Out-Parameter _`return_value`_ entgegen.
Dieser kann _`NULL`_ sein, wenn nicht gewünscht. Ruft _`pthread_detach`_ auf.\
*```c pthread_t pthread_self (void)```:*
Gibt die _ID_ des _gerade laufenden_ Threads zurück.
== Thread-Local Storage (TLS)
TLS ist ein Mechanismus, der _globale Variablen per Thread_ zur Verfügung stellt.
Dies benötigt mehrere explizite Einzelschritte:
*Bevor Threads erzeugt werden:*
Anlegen eines _Keys_, der die TLS-Variable _identifiziert_,
_Speichern_ des Keys in einer _globalen Variable_
*Im Thread:*
_Auslesen_ des Keys aus der globalen Variable,
_Auslesen / Schreiben_ des Werts anhand des Keys.
*```c int pthread_key_create(pthread_key_t *key, void (*destructor) (void*))```:*
Erzeugt einen _neuen Key_ im Out-Parameter `key`. _Opake Datenstruktur_.
Am Thread-Ende Call auf `destructor`.\
*```c int pthread_key_delete (pthread_key_t key)```:*
_Entfernt den Key_ und die entsprechenden Values aus allen Threads. Der Key darf nach diesem
Aufruf _nicht mehr verwendet_ werden. Sollte erst aufgerufen werden, wenn alle dazugehörende
Threads beendet sind.\
*```c int pthread_setspecific(pthread_key_t key, const void * value)```\
```c void * pthread_getspecific( pthread_key_t key )```*
_schreibt_ bzw. _liest_ den Wert, der mit dem Key in diesem Thread assoziiert ist.
Oft als _Pointer auf einen Speicherbereich_ verwendet.
#grid(
columns: (auto,) * 2,
[
```c
// Setup
typedef struct {
int code;
char *message;
} error_t;
pthread_key_t error;
void set_up_error (void) {
// am Anfang des Threads aufgerufen
pthread_setspecific(
error, malloc(sizeof(error_t)))}
```
],[
```c
// Lesen und Schreiben im Thread
void print_error (void) {
error_t * e = pthread_getspecific(error);
printf("Error %d: %s\n",
e->code, e->message);}
int force_error (void) {
error_t * e = pthread_getspecific(error);
e->code = 98;
e->message = "file not found";
return -1;}
```
])
```c
// Main und Thread
void *thread_function (void *) {
setu_up_error();
if (force_error () == -1) { print_error (); }
}
int main (int argc, char **argv) {
pthread_key_create (&error, NULL); // Key erzeugen
pthread_t tid;
pthread_create (&tid, NULL, &thread_function, NULL); // Threads erzeugen
pthread_join (tid, NULL);
}
```
= Scheduling
#wrap-content(
image("img/bsys_27.png"),
align: top + right,
columns: (50%, 50%),
)[
Auf einem Prozessor läuft zu einem Zeitpunkt immer _höchstens ein Thread_.
Es gibt folgende Zustände:
_Running_ #hinweis[(der Thread, der gerade läuft)],
_Ready_ #hinweis[(Threads die laufen können, es aber gerade nicht tun)],
_Waiting:_ #hinweis[(Threads, die auf ein Ereignis warten, können nicht direkt in den
Running State wechseln)].
_Übergänge_ von einem Status zum anderen werden _immer vom OS_ vorgenommen.
Dieser Teil vom OS heisst _Scheduler_.
]
#wrap-content(
image("img/bsys_28.png"),
align: top + right,
columns: (40%, 60%),
)[
Das OS _registriert Threads_ auf ein Ereignis und setzt sie in den Zustant "waiting".
Tritt das Ereignis auf, ändert das OS den Zustand auf _ready_.
#hinweis[(Es laufen nur Threads auf dem Prozessor, die _nicht warten_.)] \
*Ready-Queue:*
In der Ready-Queue #hinweis[(kann auch ein Tree sein)] befinden sich alle Threads, die
_bereit sind zu laufen_.\
*Powerdown-Modus:*
Wenn kein Thread _laufbereit_ ist, schaltet das OS den Prozessor in _Standby_ und wird
durch _Interrupt_ wieder geweckt.
]
*Arten von Threads:*
_I/O-lastig_ #hinweis[(Wenig rechnen, viel I/O-Geräte-Kommunikation)],
_Prozessor-lastig_ #hinweis[(Viel rechnen, wenig Kommunikation)]\
*Arten der Nebenläufigkeit:*
_Kooperativ_ #hinweis[(Threads entscheiden selbst über Abgabe des Prozessors)],
_Präemptiv_ #hinweis[(Scheduler entscheidet, wann einem Thread der Prozessor entzogen wird)]\
*Präemptives Multithreading:*
Thread läuft, bis er auf etwas zu _warten_ beginnt, Prozessor _yielded_,
ein _System-Timer-Interrupt_ auftritt oder ein _bevorzugter Thread_ erzeugt oder ready wird.\
*Parallele, quasiparallele und nebenläufige Ausführung:*
_Parallel_ #hinweis[(Tatsächliche Gleichzeitigkeit, $n$ Prozessoren für $n$ Threads)],
_Quasiparallel_ #hinweis[($n$ Threads auf $<n$ Prozessoren abwechselnd)],
_Nebenläufig_ #hinweis[(Überbegriff für parallel oder quasiparallel)]
#wrap-content(
image("img/bsys_29.png"),
align: top + right,
columns: (37%, 63%),
)[
*Bursts:*
_Prozessor-Burst_ #hinweis[(Thread belegt Prozessor voll)],
_I/O-Burst_ #hinweis[(Thread belegt Prozessor nicht)].
Jeder Thread kann als _Abfolge_ von _Prozessor-Bursts_ und\ _I/O-Bursts_ betrachtet werden.
]
== Scheduling-Strategien
Anforderungen an einen Scheduler können vielfältig sein.
_Geschlossene Systeme_ #hinweis[(Hersteller kennt Anwendungen und ihre Beziehungen)] vs.
_Offene Systeme_ #hinweis[(Hersteller muss von typischen Anwendungen ausgehen)]
*Anwendungssicht, Minimierung von:*
_Durchlaufzeit_ #hinweis[(Zeit vom Starten des Threads bis zu seinem Ende)],
_Antwortzeit_ #hinweis[(Zeit vom Empfang eines Requests bis die Antwort zur Verfügung steht)],
_Wartezeit_ #hinweis[(Zeit, die ein Thread in der Ready-Queue verbringt)].\
*Aus Systemsicht, Maximierung von:*
_Durchsatz_ #hinweis[(Anzahl Threads, die pro Intervall bearbeitet werden)],
_Prozessor-Verwendung_ #hinweis[(Prozentsatz der Verwendung des Prozessors gegenüber der Nichtverwendung)]\
*Latenz*
ist die durchschnittliche Zeit zwischen Auftreten und Verarbeiten eines Ereignisses.
Im schlimmsten Fall tritt das Ereignis dann auf, wenn der Thread gerade vom Prozessor
entfernt wurde. Um die Antwortzeit zu verringern, muss jeder Thread öfters ausgeführt
werden, was jedoch zu mehr Thread-Wechsel und somit zu mehr Overhead führt.
_Die Utilization nimmt also ab, wenn die Antwortzeit verringert wird._
*Idealfall: Parallele Ausführung* #hinweis[(Dient als _idealisierte Schranke_)]
#image("img/bsys_30.png", width: 80%)
*FCFS-Strategie* #hinweis[(First Come, First Served)]\
_Nicht präemptiv:_ Threads geben den Prozessor nur ab, wenn sie auf waiting wechseln oder
sich beenden.
#image("img/bsys_31.png", width: 80%)
*SJF-Strategie* #hinweis[(Shortest Job First)]\
Scheduler wählt den Thread aus, der den _kürzesten_ Prozessor-Burst hat. Bei gleicher Länge
wird nach FCFS ausgewählt. Kann _kooperativ_ oder _präemptiv_ sein. Ergibt _optimale
Wartezeit_, kann jedoch nur _korrekt implementiert_ werden, wenn die Länge der Bursts
_bekannt_ sind.
#image("img/bsys_32.png", width: 80%)
*Round-Robin:*
_Zeitscheibe_ von etwa 10 bis 100ms. _FCFS_, aber ein Thread kann nur solange laufen,
bis seine _Zeitscheibe erschöpft_ ist, dann wird der in der _Queue hinten angehängt_.
#image("img/bsys_33.png", width: 80%)
*Prioritäten-basiert:*
Jeder Thread erhält _eine Nummer_, seine _Priorität_. Threads mit höherer Priorität werden
vor Threads mit niedriger Priorität ausgewählt. Threads mit gleicher Priorität werden nach
FCFS ausgewählt. Prioritäten je nach OS unterschiedlich.\
*Starvation:*
Thread mit niedriger Priorität wird immer _übergangen_ und kann nie laufen.
Abhilfe z.B. mit _Aging:_ in bestimmten Abständen wird die Priorität um 1 erhöht.\
*Multi-Level Scheduling:*
Threads werden in _Level_ aufgeteilt #hinweis[(Priorität, Prozesstyp, Hinter-/Vordergrund)],
jedes Level hat eigene Ready-Queue und kann individuell geschedulet werden.
#hinweis[(zB. Timeslice/Queue)]\
*Multi-Level Scheduling mit Feedback:*
Erschöpft ein Thread seine Zeitscheibe, wird seine Priorität um 1 verringert.
Typischerweise werden die Zeitscheiben mit _niedrigerer Priorität grösser_ und Threads mit
_kurzen Prozessor-Bursts bevorzugt_. Threads in tiefen Queues dürfen zum Ausgleich länger am
Stück laufen.
#image("img/bsys_34.png", width: 80%)
== Prioritäten in POSIX
*Nice-Wert:*
Jeder Prozess hat einen Nice-Wert von $-20$ #hinweis[(soll bevorzugt werden)]
bis $+19$ #hinweis[(nicht bevorzugt)]
*```sh nice [-n increment] utility [argument...]```:*
Nice-Wert beim Start erhöhen oder verringern\
*```c int nice (int i)```:*
Nice-Wert im Prozess erhöhen oder verringern. #hinweis[(Addiert `i` zum Wert dazu.)]\
*```c int getpriority (int which, id_t who)```:*
gibt den Nice-Wert von $p$ zurück\
*```c int setpriority (int which, id_t who, int prio)```:*
setzt den Nice-Wert.\
#hinweis[(_`which`:_ `PRIO_PROCESS`, `PRIO_PGRP` oder `PRIO_USER`,
_`who`:_ ID des Prozesses, der Gruppe oder des Users)]
==== Priorität bei Thread-Erzeugung setzen
Funktionen ohne `attr` bevor Thread gestartet wird:\
```c int pthread_getschedparam(pthread_t thread, int * policy, struct sched_param * param)```
bzw. ```c int pthread_setschedparam(pthread_t thread, int policy, const struct sched_param * param)```
```c
pthread_attr_t a;
pthread_attr_init (&a);
struct sched_param p;
pthread_attr_getschedparam ( &a, &p ); // read parameter
// set p.sched_priority
pthread_attr_setschedparam ( &a, &p );
pthread_create ( &id, &a, thread_function, argument );
pthread_attr_destroy ( &a ); // destroy attributes
```
= Mutexe und Semaphore
Jeder Thread hat seinen _eigenen_ Instruction-Pointer und Stack-Pointer. Wenn Ergebnisse von
der _Ausführungsreihenfolge_ einzelner Instruktionen abhängen, spricht man von einer _Race
Condition_. Threads müssen _synchronisiert_ werden, damit keine _Race Condition_ entsteht.\
*Critical Section:*
Code-Bereich, in dem Daten mit anderen Threads _geteilt_ werden. Muss unbedingt
synchronisiert werden.\
*Atomare Instruktionen:*
Eine atomare Instruktion kann vom Prozessor _unterbrechungsfrei_ ausgeführt werden.
#hinweis[*Achtung:* Selbst einzelne Assembly-Instruktionen nicht immer atomar]\
*Anforderungen an Synchronisations-Mechanismen:*
_Gegenseitiger Ausschluss_ #hinweis[(Nur ein Thread darf in Critical Section sein)],
_Fortschritt_ #hinweis[(Entscheidung, wer in die Critical Section darf, muss in endlicher Zeit getroffen werden)],
_Begrenztes Warten_ #hinweis[(Thread wird nur $n$ mal übergangen, bevor er in die Critical Section darf)].\
*Implementierung:*
Nur _mit HW-Unterstützung_ möglich. Es gibt zwei atomare Instruktionen,
_Test-And-Set_ #hinweis[(Setzt einen `int` auf 1 und returnt den vorherigen Wert:
```c test_and_set(int * target) {int value = *target; *target = 1; return value;}```)] und
_Compare-and-Swap_ #hinweis[(Überschreibt einen `int` mit einem spezifizierten Wert, wenn
dieser dem erwarteten Wert entspricht:
```c compare_and_swap (int *a, int expected, int new_a) {int value = *a; if (value == expected) { *a = new_a; } return value;}```)].
== Semaphore
Enthält Zähler $z >= 0$. Wird nur über _`Post(v)`_ #hinweis[(Erhöht $z$ um 1)] und
_`Wait(v)`_ zugegriffen #hinweis[(Wenn $z > 0$, verringert $z$ um $1$ und fährt fort.
Wenn $z = 0$, setzt den Thread in waiting, bis anderer Thread $z$ erhöht)].\
*```c int sem_init (sem_t *sem, int pshared, unsigned int value)```:*
_Initialisiert_ den Semaphor, typischerweise als _globale Variable_.
`pshared = 1`: Verwendung über mehrere Prozesse: ```c sem_t sem; int main ( int argc, char ** argv ) { sem_init (&sem, 0, 4); }```
oder als Parameter für den Thread #hinweis[(Speicher auf dem Stack oder Heap)]:
```c struct T { sem_t *sem; ... };```
*```c int sem_wait (sem_t *sem); int sem_post (sem_t *sem)```:*
implementieren _Post_ und _Wait_.
*```c int sem_trywait (sem_t *sem); int sem_timedwait (sem_t *sem, const struct timespec *abs_timeout)```:*
Sind wie `sem_wait`, aber _brechen ab_, falls Dekrement _nicht_ durchgeführt werden kann.
`sem_trywait` bricht sofort ab, `sem_timedwait` nach der angegebenen Zeitdauer.\
*```c int sem_destroy (sem_t *sem)```:*
_Entfernt Speicher_, den das OS mit `sem` _assoziiert_ hat.
```c
semaphore free = n;
semaphore used = 0;
```
#grid(
columns: (auto, auto),
[
```c
// Producer
while (1) {
// Warte, falls Customer zu langsam
WAIT (free); // Hat es Platz in Queue?
produce_item (&buffer[w], ...);
POST (used); // 1 Element mehr in Queue
w = (w+1) % BUFFER_SIZE;
}
```
],
[
```c
// Consumer
while (1) {
// Warte, falls Producer zu langsam
WAIT (used); // Hat es Elemente in Queue?
consume (&buffer[r]);
POST (free); // 1 Element weniger in Q
r = (r+1) % BUFFER_SIZE;
}
```
],
)
== Mutexe
Ein Mutex hat einen _binären Zustand $bold(z)$_, der nur durch zwei Funktionen verändert werden kann:
_Acquire_ #hinweis[(Wenn $z = 0$, setze $z$ auf 1 und fahre fort. Wenn $z = 1$, blockiere
den Thread, bis $z = 0$)],
_Release_ #hinweis[(Setzt $z = 0$)]. Auch als non-blocking-Funktion:
```c int pthread_mutex_trylock (pthread_mutex_t *mutex)```
#grid(
columns: (auto, auto),
[
```c
// Beispiel Initialisierung
pthread_mutex_t mutex; // global
int main() {
pthread_mutex_init (&mutex, 0);
// run threads & wait for them to finish
pthread_mutex_destroy (&mutex);
}
```
],
[
```c
// Beispiel Verwendung in Threads
void * thread_function (void * args) {
while (running) { ...
// Enter critical section:
pthread_mutex_lock (&mutex);
// Leave critical section:
pthread_mutex_unlock (&mutex);...}}
```
],
)
*Priority Inversion:*
Ein _hoch-priorisierter_ Thread $C$ wartet auf eine Ressource, die von einem _niedriger
priorisierten_ Thread $A$ _gehalten_ wird. Ein Thread mit Prioriät zwischen diesen beiden
Threads erhält den Prozessor. Kann mit *Priority Inheritance* gelöst werden: Die Priorität
von $A$ wird temporär auf die Priorität von $C$ gesetzt, damit der Mutex schnell wieder
freigegeben wird.
= Signale, Pipes und Sockets
== Signale
Signale ermöglichen es, einen Prozess _von aussen_ zu unterbrechen, wie ein _Interrupt_.
_Unterbrechen_ des gerade laufenden Prozesses/Threads, Auswahl und Ausführen der
_Signal-Handler-Funktionen_, _Fortsetzen_ des Prozesses. Werden über ungültige Instruktionen
oder Abbruch auf Seitens Benutzer ausgelöst. Jeder Prozess hat pro Signal einen Handler.\
*Handler:*
_Ignore-Handler_ #hinweis[(ignoriert das Signal)],
_Terminate-Handler_ #hinweis[(beendet das Programm)],
_Abnormal-Terminate-Handler_ #hinweis[(beendet Programm und erzeugt Core-Dump)].
Fast alle Signale ausser `SIGKILL` und `SIGSTOP` können _überschrieben_ werden.\
*Programmfehler-Signale:*
_`SIGFPE`_ #hinweis[(Fehler in arithmetischen Operation)],
_`SIGILL`_ #hinweis[(Ungültige Instruktion)],
_`SIGSEGV`_ #hinweis[(Ungültiger Speicherzugriff)],
_`SIGSYS`_ #hinweis[(Ungültiger Systemaufruf)]\
*Prozesse abbrechen:*
_`SIGTERM`_ #hinweis[(Normale Anfrage an den Prozess, sich zu beenden)],
_`SIGINT`_ #hinweis[(Nachdrücklichere Aufforderung an den Prozess, sich zu beenden)],
_`SIGQUIT`_ #hinweis[(Wie `SIGINT`, aber anormale Terminierung)],
_`SIGABRT`_ #hinweis[(Wie `SIGQUIT`, aber vom Prozess an sich selber)],
_`SIGKILL`_ #hinweis[(Prozess wird "abgewürgt", kann nicht verhindert werden)]\
*Stop and Continue:*
_`SIGTSTP`_ #hinweis[(Versetzt den Prozess in den Zustand _stopped_, ähnlich wie _waiting_)],
_`SIGSTOP`_ #hinweis[(Wie `SIGTSTP`, aber kann nicht ignoriert oder abgefangen werden)],
_`SIGCONT`_ #hinweis[(Setzt den Prozess fort)]\
*Signale von der Shell senden:*
_`kill 1234 5678`_ sendet `SIGTERM` an Prozesse `1234` und `5678`\
*```c int sigaction (int signal, struct sigaction *new, struct sigaction *old)```:*\
Definiert Signal-Handler für `signal`, wenn `new` $!= 0$.
#hinweis[(Eigene Signal-Handler definiert via `sigaction` struct:
`sa_handler`: Zu callende Funktion,
`sa_mask`: Blockierte Signale während Ausführung,
bearbeitet nur durch `sig*set()`-Funktionen:
`sigemptyset`, `sigfillset`, `sigaddset`, `sigdelset`, `sigismember`)]\
== Pipes
Eine geöffnete Datei entspricht einem _Eintrag in der File-Descriptor-Tabelle (FDT)_ im
Prozess. Zugriff über _File-API_ #hinweis[(`open`, `close`, `read`, `write`, ...)].
Das OS speichert _je Eintrag der Prozess-FDT_ einen _Verweis auf die globale FDT_.
Bei `fork()` wird die FDT auch kopiert.\
*```c int dup (int source_fd); int dup2 (int source_fd, int destination_fd)```:*
_Duplizieren_ den File-Descriptor `source_fd`. _`dup`_ alloziert einen neuen FD,
_`dup2`_ überschreibt `destination_fd`.
=== Umleiten des Ausgabestreams
```c
int fd = open ("log.txt", ...);
int id = fork ();
if (id == 0) { // child
dup2 (fd, 1); // duplicate fd for log.txt as standard output
// e.g. load new image with exec*, fd's remain
} else { /* parent */ close (fd); }
```
Eine *Pipe* ist eine "Datei" #hinweis[(Eine Datei muss nur `open`, `close` etc.
unterstützen)] im Hauptspeicher, die über zwei File-Deskriptoren verwendet wird:
_read end_ und _write end_. Daten, die in _write end_ geschrieben werden, können aus
_read end_ genau _einmal_ und als _FIFO_ gelesen werden. Pipes erlauben _Kommunikation über
Prozess-Grenzen hinweg_. Ist unidirektional.
#grid(
columns: (50%, auto),
gutter: 0.5em,
[
```c
int fd [2]; // 0 = read, 1 = write
pipe (fd);
int id = fork();
```
Pipe lebt nur so lange, wie mind. ein Ende geöffnet ist. Alle Read-Ends geschlossen
#sym.arrow `SIGPIPE` an Write-End. Mehrere Writes können zusammengefasst werden.
Lesen mehrere Prozesse dieselbe Pipe, ist unklar, wer die Daten erhält.
],
[
```c
if (id == 0) { // Child
close (fd [1]); // don't use write end
char buffer [BSIZE];
int n = read (fd[0], buffer, BSIZE);
} else {
close (fd[0]); // don't use read end
char * text = "La li lu";
write (fd [1], text, strlen(text) + 1);
}
```
],
)
*```c int mkfifo (const char *path, mode_t mode)```:*
Erzeugt eine Pipe _mit Namen und Pfad_ im Dateisystem. Hat via `mode` permission bits wie
normale Datei. Lebt unabhängig vom erzeugenden Prozess, je nach System auch über Reboots
hinweg. Muss explizit mit `unlink` gelöscht werden.
== Sockets
Ein Socket _repräsentiert einen Endpunkt auf einer Maschine_.
Kommunikation findet im Regelfall zwischen zwei Sockets statt
#hinweis[(UDP, TCP über IP sowie Unix-Domain-Sockets)].
Sockets benötigen für Kommunikation einen Namen: #hinweis[(IP: IP-Adresse, Portnr.)]\
*```c int socket(int domain, int type, int protocol)```: *
_Erzeugt_ einen neuen Socket als "Datei". Socket sind nach Erzeugung zunächst _unbenannt_.
Alle Operationen blockieren per default.\
_`Domain`_ #hinweis[(`AF_UNIX`, `AF_INET`)],
_`type`_ #hinweis[(`SOCK_DGRAM`, `SOCK_STREAM`)],
_`protocol`_ #hinweis[(System-spezifisch, 0 = Default-Protocol)]\
*Client:*
_`connect`_ #hinweis[(Verbindung unter Angabe einer Adresse aufbauen)],
_`send` / `write`_ #hinweis[(Senden von Daten, $0 - infinity$ mal)],
_`recv` / `read`_ #hinweis[(Empfangen von Daten, $0 - infinity$ mal)],
_`close`_ #hinweis[(Schliessen der Verbindung)]\
*Server:*
_`bind`_ #hinweis[(Festlegen einer nach aussen sichtbaren Adresse)],
_`listen`_ #hinweis[(Bereitstellen einer Queue zum Sammeln von Verbindungsanfragen von Clients)],
_`accept`_ #hinweis[(Erzeugen einer Verbindung auf Anfrage von Client)],
_`recv` / `read`_ #hinweis[(Empfangen von Daten, $0 - infinity$ mal)],
_`send` / `write`_ #hinweis[(Senden von Daten, $0 - infinity$ mal)],
_`close`_ #hinweis[(Schliessen der Verbindung)]\
```c
struct sockaddr_in ip_addr;
ip_addr.sin_port = htons (443); // default HTTPS port
inet_pton (AF_INET, "192.168.0.1", &ip_addr.sin_addr.s_addr);
// port in memory: 0x01 0xBB
// addr in memory: 0xC0 0xA8 0x00 0x01
```
_`htons`_ konvertiert 16 Bit von Host-Byte-order #hinweis[(LE)] zu Network-Byte-Order
#hinweis[(BE)], _`htonl`_ 32 Bit. _`ntohs`_ und _`ntohl`_ sind Gegenstücke
_`inet_pton`_ konvertiert protokoll-spezifische Adresse von String zu Network-BO.
_`inet_ntop`_ ist das Gegenstück #hinweis[(network-to-presentation)].\
*```c int bind (int socket, const struct sockaddr *local_address, socklen_t addr_len)```:*
_Bindet_ den Socket an die angegebene, unbenutze lokale Adresse, wenn noch nicht gebunden.
Blockiert, bis der Vorgang abgeschlossen ist.\
*```c int connect (int socket, const struct sockaddr *remote_addr, socklen_t addr_len)```:*
_Aufbau_ einer Verbindung. Bindet den Socket an eine neue, unbenutzte lokale Addresse, wenn
noch nicht gebunden. Blockiert, bis Verbindung steht oder ein Timeout eintritt.\
*```c int listen (int socket, int backlog)```:*
_Markiert_ den Socket als "bereit zum Empfang von Verbindungen". Erzeugt eine Warteschlange,
die so viele Verbindungsanfragen aufnehmen kann, wie `backlog` angibt.\
*```c int accept (int socket, struct sockaddr *remote_address, socklen_t address_len)```:*
_Wartet_ bis eine Verbindungsanfrage in der Warteschlange eintrifft.
Erzeugt einen neuen Socket und bindet ihn an eine neue lokale Adresse. Die Adresse des
Clients wird in `remote_address` geschrieben. Der neue Socket kann keine weiteren
Verbindungen annehmen, der bestehende schon.
=== Typisches Muster für Server
```c
int server_fd = socket ( ... ); bind (server_fd, ...); listen (server_fd, ...);
while (running) {
int client_fd = accept (server_fd, 0, 0);
delegate_to_worker_thread (client_fd); // will call close(client_fd)
}
```
*```c send (fd, buf, len, 0) = write (fd, buf, len); recv (fd, buf, len, 0) = read (fd, buf, len)```:*
_Senden und Empfangen von Daten_. Puffern der Daten ist Aufgabe des Netzwerkstacks.\
*```c int close (int socket)```:*
_Schliesst_ den Socket für den aufrufenden Prozess. Hat ein anderer Prozess den Socket noch
geöffnet, bleibt die Verbindung bestehen. Die Gegenseite wird nicht benachrichtigt.
*```c int shutdown (int socket, int mode)```:*
_Schliesst_ den Socket für alle Prozesse und baut die entsprechende Verbindung ab. `mode`:
_`SHUT_RD`_ #hinweis[(Keine Lese-Zugriffe mehr)],
_`SHUT_WR`_ #hinweis[(Keine Schreib-Zugriffe mehr)],
_`SHUT_RDWR`_ #hinweis[(Keine Lese- oder Schreib-Zugriffe mehr)]
= Message Passing und Shared Memory
Prozesse sind voneinander isoliert, müssen jedoch trotzdem miteinander interagieren.
_Message-Passing_ ist ein Mechanismus mit zwei Operationen:
_Send_ #hinweis[(Kopiert die Nachricht _aus_ dem Prozess: ```c send (message)```)],
_Receive:_ #hinweis[(Kopiert die Nachricht _in_ den Prozess: ```c receive (message)```)].
Dabei können Implementierungen nach verschiedenen Kriterien unterschieden werden
#hinweis[(Feste oder Variable Nachrichtengrösse, direkte oder indirekte / synchrone oder
asynchrone Kommunikation, puffering, mit oder ohne Prioriäten für Nachrichten)]\
*Feste oder variable Nachrichtengrösse:*
feste Nachrichtengrösse ist einfacher zu implementieren, aber umständlicher zu verwenden als
variable Nachrichtengrösse.\
*Direkte Kommunikation:*
Kommunikation nur zwischen genau zwei Prozessen, Sender muss Empfänger kennen. Es gibt
_symmetrische direkte Kommunikation_ #hinweis[(Empfänger muss Sender auch kennen)] und
_asymmetrische direkte Kommunikation_ #hinweis[(Empfänger muss Sender nicht kennen)].\
*Indirekte Kommunikation:*
Prozess sendet Nachricht an _Mailboxen, Ports oder Queues_. Empfänger empfängt aus diesem
Objekt. Beide Teilnehmer müssen die gleiche(n) Mailbox(en) kennen.\
*Lebenszyklus Queue:*
Wenn diese Queue einem Prozess gehört, lebt sie solange wie der Prozess.
Wenn sie dem OS gehört, muss das OS das Löschen übernehmen.\
*Synchronisation:*
_Blockierendes Senden_ #hinweis[(Sender wird solange blockiert, bis die Nachricht vom Empfänger empfangen wurde)],
_Nicht-blockierendes Senden_ #hinweis[(Sender sendet Nachricht und fährt sofort weiter)],
_Blockierendes Empfangen_ #hinweis[(Empfänger wird blockiert, bis Nachricht verfügbar)],
_Nicht-blockierendes Empfangen_ #hinweis[(Empfänger erhält Nachricht, wenn verfügbar, oder 0)]\
*Rendezvous:*
Sind Empfang und Versand _beide blockierend_, kommt es zum Rendezvous, sobald beide Seiten
ihren Aufruf getätigt haben. _Impliziter Synchronisationsmechanismus_.
#grid(
columns: (auto, auto),
gutter: 0.5em,
[
```c
// Producer
message msg;
open (Q);
while (1) {
produce_next (&msg);
send (Q, &msg); // blocked until sent
}
```
],
[
```c
// Consumer
message msg;
open (Q);
while (1) {
receive (Q, &msg); // blocked until rec.
consume_next (&msg);
}
```
],
)
*Pufferung:*
_Keine_ #hinweis[(Queue-Länge ist 0, Sender muss blockieren)],
_Beschränkte_ #hinweis[(Maximal $n$ Nachrichten, Sender blockiert, wenn Queue voll ist.)],
_Unbeschränkte_ #hinweis[(Beliebig viele Nachrichten, Sender blockiert nie)].\
*Prioriäten:*
In manchen Systemen können Nachrichten mit _Prioritäten_ versehen werden.
Der Empfänger holt die Nachricht mit der _höchsten Priorität zuerst_ aus der Queue.
=== POSIX Message-Passing
OS-Message-Queues mit _variabler Länge_, haben mind. 32 Prioritäten und können
_synchron und asynchron_ verwendet werden.\
*```c mqd_t mq_open (const char *name, int flags, mode_t mode, struct mq_attr *attr)```:*
_Öffnet_ eine Message-Queue mit systemweitem `name`, returnt Message-Queue-Descriptor.
#hinweis[(`name` mit `/` beginnen, `flags` & `mode` wie bei Dateien,
`mq_attr`: Div. Konfigs & Queue-Status, R/W mit `mp_getattr`/`mq_setattr`)]\
*```c int mq_close (mqd_t queue)```:*
_Schliesst_ die Queue mit dem Descriptor `queue` für diesen Prozess.\
*```c int mq_unlink (const char *name)```:*
_Entfernt_ die Queue mit dem Namen `name` aus dem System.
_Name_ wird _sofort entfernt_ und Queue kann anschliessend _nicht mehr geöffnet_ werden.\
*```c int mq_send (mqd_t queue, const char *msg, size_t length, unsigned int priority)```:*
_Sendet_ die Nachricht, die an Adresse `msg` beginnt und `length` Bytes lang ist,
in die `queue`.\
*```c int mq_receive (mqd_t queue, const char *msg, size_t length, unsigned int *priority)```:*
_Kopiert_ die nächste Nachricht aus der Queue in den Puffer, der an Adresse `msg` beginnt
und `length` Bytes lang ist.
_Blockiert_, wenn die Queue _leer_ ist.
== Shared Memory
Frames des Hauptspeichers werden _zwei (oder mehr) Prozessen_ $P_1$ und $P_2$ _zugänglich_
gemacht. In $P_1$ wird Page $V_1$ auf einen Frame $F$ abgebildet. In $P_2$ wird Page $V_2$
auf _denselben_ Frame $F$ abgebildet. Beide Prozesse können _beliebig_ auf dieselben Daten
zugreifen. Im Shared Memory müssen _relative Adressen_ verwendet werden.
=== POSIX API
Das OS benötigt eine "Datei" _$bold(S)$_, das Informationen über den gemeinsamen Speicher
verwaltet und eine _Mapping Table_ je Prozess.
*```c int fd = shm_open ("/mysharedmemory", O_RDWR | O_CREAT, S_IRUSR | S_IWUSR)```:*\
Erzeugt falls nötig und öffnet Shared Memory /mysharedmemory zum Lesen und Schreiben.\
*```c int ftruncate (int fd, offset_t length)```:*
_Setzt_ Grösse der "Datei". Muss _zwingend_ nach SM-Erstellung gesetzt werden, um
entsprechend viele Frames zu allozieren.
Wird für Shared Memory mit ganzzahligen Vielfachen der Page-/Framegrösse verwendet.\
*```c int close (int fd)```:*
_Schliesst_ "Datei". Shared Memory _bleibt aber im System_.\
*```c int shm_unlink (const char * name)```:*
_Löscht_ das Shared Memory mit dem `name`.
#hinweis[(bleibt vorhanden, solange noch von Prozess geöffnet)]\
*```c int munmap (void *address, size_t length)```:*
_Entfernt_ das Mapping.
```c
void * address = mmap( // maps the shared memory into virt. address space of process
0, // void *hint_address (0 because nobody cares)
size_of_shared_memory, // size_t length (same as used in ftruncate)
PROT_READ | PROT_WRITE, // never use execute
MAP_SHARED, // int flags
fd, // int file_descriptor
0 // off_t offset (start map from first byte)
);
```
== Vergleich Message-Passing und Shared Memory
_Shared Memory_ ist schneller zu realisieren, aber schwer wartbar.
_Message-Passing_ erfordert mehr Engineering-Aufwand, schlussendlich aber in
Mehr-Prozessor-Systemen bald performanter.
== Vergleich Message-Queues und Pipes
#table(
columns: (auto, 1fr),
table.header(
[Message-Queues],
[Pipes],
),
[
- bidirektional
- Daten sind in einzelnen Messages organisiert
- beliebiger Zugriff
- Haben immer einen Namen
],
[
- unidirektional
- übermittelt Bytestrom an Daten
- FIFO-Zugriff
- Müssen keinen Namen haben
],
)
= Unicode
== ASCII - American Standard Code for Information Interchange
Hat _128 definierte Zeichen_ #hinweis[(erste Hexzahl = Zeile, zweite Hexzahl = Spalte,
d.h. #hex("41") = `A`)].
#image("img/bsys_40.png")
*Codepages:*
unabhängige Erweiterungen auf 8 Bit. Jede ist unterschiedlich und nicht erkennbar.\
*Unicode:*
Hat zum Ziel, einen eindeutigen Code für _jedes vorhandene Zeichen_ zu definieren.
#hex("D8 00") bis #hex("DF FF") sind wegen UTF-16 keine gültigen Code-Points.\
*Code-Points (CP):*
Nummer eines Zeichen - "welches Zeichen?"\
*Code-Unit (CU):*
Einheit, um Zeichen in einem Encoding darzustellen #hinweis[(bietet den Speicherplatz)]\
#hinweis[_$bold(P_i) =$_ $i$-tes Bit des unkodierten CPs,
_$bold(U_i) =$_ $i$-tes Code-Unit des kodierten CPs,
_$bold(B_i) =$_ $i$-tes Byte des kodierten CPs]
== UTF-32
Jede CU umfasst _32 Bit_, jeder CP kann mit _einer CU_ dargestellt werden. Direkte Kopie der
Bits in die CU bei Big Endian, bei Little Endian werden $P_0$ bis $P_7$ in $B_3$ kopiert usw.
Wird häufig intern in Programmen verwendet. Obere 11 Bits oft "zweckentfremdet".
#image("img/bsys_43.png")
== UTF-16
Jede CU umfasst _16 Bit_, ein CP benötigt _1 oder 2 CUs_. Encoding muss Endianness
berücksichtigen. Die 2 CUs werden Surrogate Pair genannt, $U_0$: high surrogate,
$U_1$: low surrogate. Bei _2 Bytes_ #hinweis[(1 CU)] wird direkt gemappt und vorne mit
Nullen aufgefüllt. Bei _4 Bytes_ sind #hex("D800") bis #hex("DFFF") #hinweis[(Bits 17-21)]
wegen dem Separator _ungültig_ und müssen "umgerechnet" werden.\
#image("img/bsys_45.png")
==== Beispiel
Encoding von U+10'437 (\u{10437})
#hinweis[#fxcolor("grün", bits("00 0100 0001", suffix: false))
#fxcolor("gelb", bits("00 0011 0111"))]:
1. Code-Point $P$ minus #hex("10000") rechnen und in Binär umwandlen\
$P = hex("10437"), Q = hex("10437") - hex("10000") = hex("0437")
= fxcolor("grün", #bits("00 0000 0001", suffix: false)) fxcolor("gelb", bits("00 0011 0111"))$
2. Obere & untere 10 Bits in Hex umwandlen\
$fxcolor("grün", #hex("0001", suffix: false)) fxcolor("gelb", hex("0137"))$\
3. Oberer Wert mit #hex("D800") und unterer Wert mit #hex("DC00") addieren, um Code-Units zu erhalten\
$U_1 = fxcolor("grün", hex("0001")) + hex("D800") = fxcolor("orange", hex("D801")),
U_2 = fxcolor("gelb", hex("0137")) + hex("DC00") = fxcolor("hellblau", hex("DD37"))$\
4. Zu BE/LE zusammensetzen\
$"BE" = underline(fxcolor("orange", #hex("D801", suffix: false)) thin
fxcolor("hellblau", hex("DD37"))), thick
"LE" = underline(fxcolor("orange", #hex("01D8", suffix: false)) thin
fxcolor("hellblau", hex("37DD")))$
== UTF-8
Jede CU umfasst _8 Bit_, ein CP benötigt _1 bis 4 CUs_. Encoding muss Endianness _nicht_
berücksichtigen. Standard für Webpages. Echte Erweiterung von ASCII.
#let nextCU = bits("10xx xxxx")
#table(
columns: (auto, 1fr, 1fr, 1fr, 1fr, 1fr),
table.header([Code-Point in], [$bold(U_3)$], [$bold(U_2)$], [$bold(U_1)$], [$bold(U_0)$], [signifikant]),
[#hex("0") - #hex("7F")], [], [], [], [#bits("0xxx xxxx")], [7 bits],
[#hex("80") - #hex("7FF")], [], [], [#bits("110x xxxx")], [#nextCU], [11 bits],
[#hex("800") - #hex("FFFF")], [], [#bits("1110 xxxx")], [#nextCU], [#nextCU], [16 bits],
[#hex("10000") - #hex("10FFFF")], [#bits("1111 0xxx")], [#nextCU], [#nextCU], [#nextCU], [21 bits],
)
#image("img/bsys_44.png")
==== Beispiele
- _ä_: $P = hex("E4") = fxcolor("grün", #bits("00011", suffix: false)) thin
fxcolor("gelb", bits("10 0110"))$\
$=> P_10 ... P_6 = fxcolor("grün", bits("00011")) = fxcolor("rot", hex("03")),
P_5 ... P_0 = fxcolor("gelb", bits("100100")) = fxcolor("orange", hex("24"))$\
$=> U_1 = hex("C0") (= bits("11000000")) + fxcolor("rot", hex("03")) = hex("C3"),
U_0 = hex("80") (= bits("10000000")) + fxcolor("orange", hex("24")) = hex("A4")$\
$=> ä = underline(hex("C3 A4"))$
- _ặ_: $P = hex("1EB7") = fxcolor("grün", #bits("0001", suffix: false)) thin
fxcolor("gelb", #bits("111010", suffix: false)) thin fxcolor("hellblau", bits("110111"))$\
$=> P_15 ... P_12 = fxcolor("grün", hex("01")),
P_11 ... P_6 = fxcolor("gelb", hex("3A")),
P_5 ... P_0 = fxcolor("hellblau", hex("37"))$\
$=> U_2 = hex("E0") (= #bits("11100000")) + fxcolor("grün", hex("01")) = hex("E1"),
U_1 = hex("80") + fxcolor("gelb", hex("3A")) = hex("BA"),
U_0 = hex("80") + fxcolor("hellblau", hex("37")) = hex("B7")$\
$=> ặ = underline(hex("E1 BA B7"))$
== Encoding-Beispiele
#{
set text(size: 0.94em)
table(
align: (_, y) => if (y == 0) { left } else { right },
columns: (auto,) + (1fr,) * 6,
table.header([Zeichen], [Code-Point], [UTF-32BE], [UTF-32LE], [UTF-8], [UTF-16BE], [UTF-16LE]),
[A],[#hex("41")],[#hex("00 00 00 41")],[#hex("41 00 00 00")],[#hex("41")],[#hex("00 41")],[#hex("41 00")],
[ä],[#hex("E4")],[#hex("00 00 00 E4")],[#hex("E4 00 00 00")],[#hex("C3 A4")],[#hex("00 E4")],[#hex("E4 00")],
[$alpha$],[#hex("3 B1")],[#hex("00 00 03 B1")],[#hex("B1 03 00 00")],[#hex("CE B1")],[#hex("03 B1")],[#hex("B1 03")],
[ặ],[#hex("1E B7")],[#hex("00 00 1E B7")],[#hex("B7 1E 00 00")],[#hex("E1 BA B7")],[#hex("1E B7")],[#hex("B7 1E")],
[𐌰],[#hex("1 03 30")],[#hex("00 01 03 30")],[#hex("30 03 01 00")],[#hex("F0 90 8C B0")],[#hex("D8 00 DF 30")],[#hex("00 D8 30 DF")],
)
}
#hinweis[Bei LE / BE werden nur die Zeichen _innerhalb_ eines Code-Points vertauscht,
nicht die Code-Points an sich.]
= Ext2-Dateisystem
_Partition_ #hinweis[(Ein Teil eines Datenträgers, wird selbst wie ein Datenträger behandelt.)],
_Volume_ #hinweis[(Ein Datenträger oder eine Partition davon.)],
_Sektor_ #hinweis[(Kleinste logische Untereinheit eines Volumes.
Daten werden als Sektoren transferiert. Grösse ist von HW definiert.
Enthält Header, Daten und Error-Correction-Codes.)],
_Format_ #hinweis[(Layout der logischen Strukturen auf dem Datenträger, wird vom Dateisystem definiert.)]\
== Block
Ein Block besteht aus _mehreren aufeinanderfolgenden Sektoren_ #hinweis[(1 KB, 2 KB oder
4 KB (normal))]. Das gesamte Volume ist in _Blöcke aufgeteilt_ und Speicher wird _nur in
Form von Blöcken_ alloziert. Ein Block enthält nur Daten einer _einzigen Datei_. Es gibt
_Logische Blocknummern_ #hinweis[(Blocknummer vom Anfang der Datei aus gesehen, wenn Datei
eine ununterbrochene Abfolge von Blöcken wäre)] und
_Physische Blocknummern_ #hinweis[(Tatsächliche Blocknummer auf dem Volume)].
== Inodes
#wrap-content(
image("img/bsys_42.png"),
align: top + right,
columns: (30%, 70%),
)[
Enthält _alle Metadaten_ über die Datei, _ausser Namen oder Pfad_ #hinweis[(Grösse,
Anzahl der verwendeten Blöcke, Erzeugungszeit, Zugriffszeit, Modifikationszeit,
Löschzeit, Owner-ID, Group-ID, Flags, Permission Bits)].
Hat eine _fixe Grösse_ je Volume: Zweierpotenz, mind. 128 Byte, max. 1 Block.
Der Inode _verweist auf die Blöcke_, die _Daten für eine Datei_ enthalten.
Enthält ein Array _`i_block`_ mit 15 Einträgen zu je 32 Bit.
]
*Lokalisierung:*
Alle Inodes aller Blockgruppen gelten als _eine grosse Tabelle_. Startet mit 1.\
*Erzeugung:*
Neue Verzeichnisse werden in der Blockgruppe angelegt, die von allen Blockgruppen mit
_überdurchschnittlich vielen freien Inodes_ die _meisten Blöcke frei_ hat, Dateien in der
Blockgruppe des Verzeichnis oder nahen Gruppen. Bestimmung anhand _Inode-Usage-Bitmaps_.\
*File-Holes:*
Bereiche in der Datei, in der _nur Nullen_ stehen. Ein solcher Block wird _nicht alloziert_.
== Blockgruppe
Eine Blockgruppe besteht aus _mehreren aufeinanderfolgenden Blöcken_ bis zu 8 mal der Anzahl
Bytes in einem Block.\
*Layout:*
_Block 0_ #hinweis[(Kopie des Superblocks)],
_Block $bold(1)$ bis $bold(n)$_ #hinweis[(Kopie der Gruppendeskriptorentabelle)],
_Block $bold(n+1)$_ #hinweis[(Block-Usage-Bitmap mit einem Bit je Block der Gruppe)],
_Block $bold(n+2)$_ #hinweis[(Inode-Usage-Bitmap mit einem Bit je Inode der Gruppe)],
_Block $bold(n+3)$ bis $bold(n+m+2)$_ #hinweis[(Tabelle aller Inodes in dieser Gruppe)],
_Block $bold(n+m+3)$ bis Ende der Gruppe_ #hinweis[(Blöcke der eigentlichen Daten)]\
*Superblock:*
Enthält _alle Metadaten_ über das Volume #hinweis[(Anzahlen, Zeitpunkte, Statusbits,
Erster Inode, ...)] \ immer an Byte 1024, wegen möglicher Bootdaten vorher.\
*Sparse Superblock:*
Kopien des Superblocks werden nur in Blockgruppe 0, 1 und allen reinen Potenzen von 3, 5
oder 7 gehalten #hinweis[(Sehr hoher Wiederherstellungsgrad, aber deutlich weniger
Platzverbrauch)].\
*Gruppendeskriptor:*
32 Byte _Beschreibung einer Blockgruppe_. #hinweis[(Blocknummer des Block-Usage-Bitmaps,
Blocknummer des Inode-Usage-Bitmaps, Nummer des ersten Blocks der Inode-Tabelle,
Anzahl freier Blöcke und Inodes in der Gruppe, Anzahl der Verzeichnisse in der Gruppe)]\
*Gruppendeskriptortabelle:*
Tabelle mit Gruppendeskriptor pro Blockgruppe im Volume. Folgt direkt auf Superblock(-kopie).
$32 dot n$ Bytes gross. Anzahl Sektoren $= (32 dot n)/"Sektorgrösse"$\
*Verzeichnisse:*
Enthält _Dateieinträge_ mit variabler Länge von 8 - 263 Byte
#hinweis[(4B Inode, 2B Eintraglänge, 1B Dateinamenlänge, 1B Dateityp, 0 - 255B Dateiname
aligned auf 4B).] Defaulteinträge: "." und ".."\
*Links:*
Es gibt _Hard-Links_ #hinweis[(gleicher Inode, verschiedene Pfade:
Wird von verschiedenen Dateieinträgen referenziert)] und
_Symbolische Links_ #hinweis[(Wie eine Datei, Datei enthält Pfad anderer Datei)].
== Vergleich FAT, NTFS, Ext2
#{
set text(size: 0.8em)
table(
columns: (1fr, 1fr, auto),
table.header([FAT], [Ext2], [NTFS]),
[
- Verzeichnis enthält alle Daten über die Datei
- Datei ist in einem einzigen Verzeichnis
- Keine Hard-Links möglich
],
[
- Dateien werden durch Inodes beschrieben
- Kein Link von der Datei zurück zum Verzeischnis
- Hard-Links möglich
],
[
- Dateien werden durch File-Records beschrieben
- Verzeichnis enthält Namen und Link auf Datei
- Link zum Verzeichnis und Name sind in einem Attribut
- Hard-Links möglich
],
)
}
= Ext4
_Vergrössert_ die wichtigen Datenstrukturen, besser für grosse Dateien, erlaubt höhere
maximale Dateigrösse. Blöcke werden mit _Extent Trees_ verwaltet, _Journaling_ wird eingeführt.
== Extents
Beschreiben ein _Intervall physisch konsekutiver Blöcke_. Ist 12 Byte gross
#hinweis[(4B logische Blocknummer, 6B physische Blocknummer, 2B Anzahl Blöcke)].
Positive Zahlen = Block initialisiert, Negativ = Block voralloziert. Im Inode hat es in den
60 Byte für direkte und indirekte Block-Adressierung Platz für 4 Extents und einen Header.\
*Extent Trees*
_Index-Knoten_ #hinweis[(Innerer Knoten des Baums, besteht aus Index-Eintrag und Index-Block)],
_Index-Eintrag_ #hinweis[(Enthält Nummer des physischen Index-Blocks und kleinste logische
Blocknummer aller Kindknoten)],
_Index-Block_ #hinweis[(Enthält eigenen Tree-Header und Referenz auf Kindknoten)]\
*Extent Tree Header:*
Benötigt ab 4 Extents, weil zusätzlicher Block.
Magic Number #hex("F30A") #hinweis[(2B)],
Anzahl Einträge, die direkt auf den Header folgen #hinweis[(2B)],
Anzahl Einträge, die maximal auf den Header folgen können #hinweis[(2B)],
Tiefe des Baums #hinweis[(2B)] - #hinweis[(0: Einträge sind Extents, $>=$1: Einträge sind Index Nodes)],
Reserviert #hinweis[(4B)]\
*Index Node:*
Spezifiziert einen Block, der _Extents enthält_. Besteht aus einem Header und den Extents
#hinweis[(max. 340 bei 4 KB Blockgrösse)]. Ab 1360 Extents zusätzlicher Block mit Index
Nodes nötig.
=== Notation
#{
set text(size: 0.8em)
table(
columns: (1fr, 1fr),
table.header([(in)direkte Addressierung], [Extent-Trees]),
[_direkte Blöcke:_ Index $|->$ Blocknr.],
[_Indexknoten:_ Index $|->$ (Kindblocknr, kleinste Nummer der 1. logischen Blöcke aller Kinder)],
[_indirekte Blöcke:_ indirekter Block.Index $|->$ direkter Block],
[_Blattknoten:_ Index $|->$ (1. logisch. Block, 1. phy. Block, Anz. Blöcke)],
[], [_Header:_ Index $|->$ (Anz. Einträge, Tiefe)],
)
}
==== Beispiel Berechnung 2MB grosse, konsekutiv gespeicherte Datei, 2KB Blöcke ab Block #hex("2000")
_(In-)direkte Block-Adressierung_\
2 MB = $2^21$B, 2 KB = $2^11$B, $ 2^(21-11) = 2^10 = #fxcolor("rot", hex("400"))$
Blöcke von #fxcolor("grün", hex("2000")) bis #fxcolor("orange", hex("23FF"))\
$0 arrow.bar #fxcolor("grün", hex("2000")), 1 arrow.bar #hex("2002"), ... , #hex("B")
arrow.bar #hex("200B")$
$#hex("C") arrow.bar #hex("2400")$ #hinweis[(indirekter Block)]\
$#hex("1400").#hex("0") arrow.bar #hex("200C"),
#hex("1400").#hex("1") arrow.bar #hex("200D"),
...,
#hex("1400").#hex("3F3") arrow.bar #fxcolor("orange", hex("23FF"))$
_Extent Trees_\
*Header:* $0 arrow.bar (1,0)$\
*Extent:* $1 arrow.bar (0, #fxcolor("grün", hex("2000")), #fxcolor("rot",hex("400")))$
== Journaling
Wenn Dateisystem beim _Erweitern_ einer Datei _unterbrochen_ wird, kann es zu
_Inkonsistenzen_ kommen. _Journaling_ verringert Zeit für Überprüfung von Inkonsistenzen erheblich.\
*Journal:*
Datei, in die Daten schnell geschrieben werden können. Bestenfalls 1 Extent.\
*Transaktion:*
Folge von Einzelschritten, die gesamtheitlich vorgenommen werden sollten.\
*Journaling:*
Daten als Transaktion ins Journal, dann an finale Position schreiben #hinweis[(committing)],
Transaktion aus dem Journal entfernen.\
*Journal Replay:*
Transaktionen im Journal werden nach Neustart noch einmal ausgeführt.\
*Journal Modi:*
_(Full) Journal_ #hinweis[(Metadaten und Datei-Inhalte ins Journal, sehr sicher aber langsam)],
_Ordered_ #hinweis[(Nur Metadaten ins Journal, Dateiinhalte werden immer vor Commit geschrieben)],
_Writeback_ #hinweis[(Nur Metadaten ins Journal, beliebige Reihenfolge, nicht sehr sicher aber schnell).]
= X Window System
Setzt _Grundfunktionen der Fensterdarstellung_. Ist austauschbar, realisiert Netzwerktransparenz.
Plattformunabhängig, legt die GUI-Gestaltung nicht fest.\
*Programmgesteuerte Interaktion:* Benutzer reagiert auf Programm.\
*Ereignisgesteuerte Interaktion:* Programm reagiert auf Benutzer.\
*Fenster:*
Rechteckiger Bereich des Bildschirms. Es gibt eine Baumstruktur aller Fenster,
der Bildschirm ist die Wurzel #hinweis[(z.B. Dialogbox, Scrollbar, Button...)].\
*Display:* Rechner mit Tastatur, Zeigegerät und 1..m Bildschirme\
*X Client:* Applikation, die einen Display nutzen will. Kann lokal oder entfernt laufen.\
*X Server:* Softwareteil des X Window System, der ein Display ansteuert. Beim Nutzer.
== GUI Architektur
Nicht nur X Window System, sondern auch _Window Manager_ #hinweis[(Verwaltung der sichtbaren
Fenster, Umrandung, Knöpfe. Läuft im Client und realisiert Window Layout Policy)] und
_Desktop Manager_ #hinweis[(Desktop-Hilfsmittel wie Taskleiste, Dateimanager, Papierkorb etc.)].\
== Xlib
Ist das _C Interface_ für das X Protocol. Wird meist nicht direkt verwendet.\
*Funktionen:*
```c XOpenDisplay()``` #hinweis[öffnet Verbindung zum Display,
NULL = Wert von `DISPLAY` Umgebungsvariabel)],
```c XCloseDisplay()``` #hinweis[schliesst Verbindung],
```c XCreateSimpleWindow()``` #hinweis[erzeugt ein Fenster],
```c XDestroyWindow()``` #hinweis[entfernt ein Fenster & Unterfenster],
```c XMapWindow()``` #hinweis[bestimmt, dass ein Fenster angezeigt werden soll (unhide)],
```c XMapRaised()``` #hinweis[bringt Fenster in den Vordergrund],
```c XMapSubwindows()``` #hinweis[zeigt alle Unterfenster an, `Expose` Event],
```c XUnmapWindow()``` #hinweis[versteckt Fenster],
```c XUnmapSubwindows()``` #hinweis[versteckt Unterfenster, `UnmapNotify` Event]
*X Protocol:*
Legt die _Formate für Nachrichten_ zwischen X Client und Server fest.
_Requests_ #hinweis[(Dienstanforderungen, Client #sym.arrow Server)],
_Replies_ #hinweis[( Antworten auf Requests, Client #sym.arrow.l Server)],
_Events_ #hinweis[(Ereignismeldungen, Client #sym.arrow.l Server)],
_Errors_ #hinweis[(Fehlermeldungen auf vorangegangene Requests, Client #sym.arrow.l Server)]\
*Request Buffer:*
Nachrichtenpufferung auf der Client Seite. Für _Effizienz_.
*Pufferung bei Ereignissen:*
Werden beim X Server und beim Client gepuffert.
_Server-Seitig_ berücksichtigt Netzwerkverfügbarkeit, _Client-Seitige_ hält Events bereit.\
*X Event Handling:*
Ereignisse werden vom Client verarbeitet oder weitergeleitet.
Muss _festlegen, welche_ Typen er empfangen will.
```c XSelectInput()``` #hinweis[legt fest, welche Events via Event-Masken emfpangen werden,
z.B. `ExposureMask`],
```c XNextEvent()``` #hinweis[kopiert den nächsten Event aus dem Buffer].
== Zeichnen
*Ressourcen:*
Server-seitige Datenhaltung zur Reduktion des Netzwerkverkehrs.
Halten Informationen im Auftrag von Clients. Diese identifizieren Informationen mit IDs.
Kein Hin- und Herkopieren komplexer Datenstrukturen nötig.
#hinweis[(z.B. Window, Pixmap, Colormap, Font, Graphics-Context)]\
*Pufferung verdeckter Fensterinhalte:*
_Minimal_ #hinweis[(keine Pufferung)] oder
_Optional_ #hinweis[(Hintergrundspeicher zum Sichern vorhanden)]\
*Pixmap:*
Server-Seitiger _Grafikspeicher_, wird immer gecached.\
*X Grafikfunktionen:*
Bilddarstellung mittels _Rastergrafik_ und _Farbtabelle_. Erlauben das Zeichnen von Figuren,
Strings und Texten. _Ziele_ für das Zeichnen können Fenster oder Pixmap sein.\
*Graphics Context:*
Legt diverse _Eigenschaften_ fest, die Systemaufrufe nicht direkt unterstützen
#hinweis[(z.B. Liniendicke, Farben, Füllmuster)].
Client kann mehrere GCs gleichzeitig nutzen.
== Fenster Schliessen
Schaltfläche wird vom _Window Manager_ erzeugt. X weiss _nichts_ über spezielle Bedeutung
der Schaltfläche, der Window Manager schliesst das Fenster. Es gibt ein _Protokoll_ zwischen
Window Manager und Applikation. `ClientMessage` Event mit `WM_DELETE_MESSAGE`.\
*Atoms:*
_ID eines Strings_, der für _Meta-Zwecke_ benötigt wird. Erspart Parsen der Strings.\
*Properties:*
Werden mit jedem Fenster assoziiert.
_Generischer Kommunikations-Mechanismus_ zwischen Applikation und Window Manager.\
*`WM_PROTOCOLS`:*
Von X Standard definierte Anzahl an Protokollen, die der Window Manager verstehen soll.
Ein Client kann sich für Protokolle _registrieren_. \
*`WM_DELETE_WINDOW`:*
Wird beim Drücken des "x" vom Window Manager an den Client geschickt.
= Meltdown
Meltdown ist eine _HW-Sicherheitslücke_, die es ermöglicht, den _gesamten physischen
Hauptspeicher auszulesen_.
Ein Prozess kann dadurch geheime Informationen anderer Prozesse lesen.\
Der Prozessor muss dazu gebracht werden können:
1. aus dem _geschützten Speicher_ an Adresse $a$ das Byte $m_a$ zu _lesen_
2. die Information $m_a$ in irgendeiner Form $f_a$ _zwischenzuspeichern_
3. _binäre Fragen_ der Form "$f_a eq.quest i$" zu beantworten
4. Von $i = 0$ bis $i = 255$ _iterieren_: $f_a eq.quest i$
5. Über alle $a$ _iterieren_
== Performance-Optimierungen
Mapping des Speichers in jeden virtuellen Adressraum, Out-of-Order Execution (03E),
Spekulative Ausführung.\
*Seiteneffekte O3E:*
Cache weiss nicht, ob Wert spekulativ angefordert wurde und speichert alles.
Da Wert als Teil des Tags gespeichert und die _Zeit gemessen_ werden kann, die ein
Speicherzugriff benötigt, kann man herausfinden, ob etwas im Cache ist oder nicht
#hinweis[(Timing Side Channel Attack)].\
*Tests:*
Verschiedene CPUs #hinweis[(Intel, einige ARMs, keine AMDs)] und verschiedene OS
#hinweis[(Linux, Windows 10)] sind betroffen.
_Geschwindigkeit_ bis zu 500 KB pro Sekunde bei 0.02% Fehlerrate.\
*Einsatz:*
Auslesen von Passwörtern, Zugriff auf andere Dockerimages. Nachweis schwierig.\
*Gegenmassnahmen:*
_Kernel page-table isolation "KAISER":_ verschiedene Page Tables für Kernel- bzw. User-Mode.
Nachteil: System wieder langsam.\
*Spectre:*
Gleiches Ziel, verwendet jedoch _Branch Prediction_ mit spekulativer Ausführung.
Branch Prediction wird nicht per Prozess _unterschieden_. Alle Prozesse, die auf dem selben
Prozessor laufen, verwenden die _selben Vorhersagen_. Ein Angreifer kann damit den Branch
Predictor _für einen anderen Prozess "trainieren"_. Der _Opfer-Prozess_ muss zur Kooperation
_"gezwungen"_ werden, indem im verworfenen Branch auf Speicher zugegriffen wird.
Nicht leicht zu fassen, aber auch nicht leicht zu implementieren.
|
|
https://github.com/jeffa5/typst-cambridge | https://raw.githubusercontent.com/jeffa5/typst-cambridge/main/thesis/manual-2.typ | typst | MIT License | #import "cambridge.typ": *
#show: chapter
= Work piece 1
#lorem(100)
== Some context
#lorem(500)
#lorem(100)
=== sub 1
#lorem(100)
#lorem(100)
=== sub 2
#lorem(100)
#lorem(100)
=== sub 3
#lorem(100)
=== more depth
==== getting niche
|
https://github.com/polarkac/MTG-Stories | https://raw.githubusercontent.com/polarkac/MTG-Stories/master/stories/057%20-%20Bloomburrow/002_Episode%202%3A%20An%20Expected%20Party.typ | typst | #import "@local/mtgstory:0.2.0": conf
#show: doc => conf(
"Episode 2: An Expected Party",
set_name: "Bloomburrow",
story_date: datetime(day: 02, month: 07, year: 2024),
author: "<NAME>",
doc
)
#strong[Helga]
Sometimes Helga's dreams felt so real that crossing the boundary of sleep in either direction was like stepping through a door and suddenly arriving in a different place. This time, her disorientation was worse because she didn't remember lying down and didn't recognize the room in which she found herself. She blinked at wood beams arching gracefully above the bed, tightly woven walls, golden sunlight slanting through pretty patchwork curtains, and wondered if she was still asleep.
She'd been dreaming of the Night Owl. Destruction, fire and smoke, screaming—except the homes were unfamiliar, the terrain shifting from forest to field to pond, as if she were seeing many attacks strung together like beads on a necklace. In each place, her gaze was drawn to the blurred form of a weaselfolk in a red hood, a scar over one eye … Who was he? Was this a vision and not a dream? If so, what did it mean?
Memories resurfaced, including her long trek along the creek-bed to—where? There had been sunlight, a mousefolk leaning over her, and then … this room. In one door, out another, nothing between.
Voices and laughter outside drew her attention. Helga sat up too quickly; her head swam, her legs and back ached. She groaned, loud enough to be heard elsewhere in the house presumably, because soon a pair of mousefolk stepped through the doorway.
They were about the same height, one with auburn fur, the other silver. The former wore an orange dress with a bright red holly button at her throat, while the latter wiped his paws on a flour-streaked apron partly covering a green tunic.
"You're safe here," said the brown one, moving closer. "I'm Mabel, and this is my husband, Clem."
"Charmed, despite the circumstances," Clem said.
"My name's Helga," she said. "I came from Pondside. I was—"
Mabel held up a paw. "Before you tell us your tale, would you fetch Oliver, please, Clem? Saves having to repeat anything. And have Rosalyn brew up a pot of mint tea."
"Consider it done, love." Clem left.
Mabel sat on the edge of the bed. "I cleaned you and washed your clothes. The ones you're wearing are a gift from Reed, one of our frogfolk. The healer says your injuries aren't serious. You collapsed from exhaustion, so we brought you here to rest."
"Where is here?" Helga asked. Voices outside rose and fell, the name "Oliver" shouted more than once.
"Goodhill," Mabel replied. "We're a few hours' walk from Pondside by road. Sometimes otterfolk sail here, but the creek's too low now."
Helga hadn't noticed. She'd been fleeing through mud and vegetation and the occasional patch of bare soil, afraid the Night Owl might follow her.
"This way, Oliver," Clem said, and within moments a small cinnamon-brown rabbit stood at the foot of the bed, wringing his paws.
"Welcome to Goodhill, my dear, welcome," Oliver said, a little too heartily. "I have no doubt Mabel is taking the very best care of you, and if you need anything at all, as mayor of this fine town, it's my duty to extend every hospitality to—"
"Thank you, Oliver," Mabel interrupted. "Helga is no doubt still tired, so perhaps we should hear her story and then let her rest?"
Helga's anxious smile widened. She'd known Mabel for only a few minutes, and she already had the sense that the mousefolk was a managing sort.
"Yes, of course, and I must return to the festivities." Oliver's ears shifted backward a fraction. "Tell us then, Helga, what brought you to our doorstep?"
"You said there was a Calamity Beast?" Mabel nudged. Oliver's ears twitched farther back, and his fur rippled as if he were cold.
Helga nodded, her throat constricted like a rill choked with debris. Slowly, in croaked whispers, she told the story of Maha's attack, the destruction of Pondside, the terrible darkness that erased the day like turpentine wiping away paint from a canvas.
And then, perhaps foolishly, she mentioned her dream that might have been a vision, and her drawings, including the one of the strange hawk. Mabel and Clem exchanged an unreadable look, the sort Helga's grandparents had, in the silent language of the long married.
Oliver huffed out a laugh. "That is quite a story," he said. "You're certain you didn't mistake the situation? Your imagination seems a touch overactive, which is to be expected of an artistic temperament. My own great-grandfather was a deft paw at whittling, and he once swore he saw—"
"Oliver," Mabel said sharply.
Helga burst into wracking sobs. She couldn't help it. All her fears as she ran for her life, her worries about her friends and neighbors, her frustrations at her visions being dismissed again—feelings overflowed like a cistern in a summer storm. She knew she needed to calm down, to explain, because if she didn't then how would she bring help back to Pondside? The words wouldn't come.
Oliver patted her arm. "Whatever happened, you've certainly had a long day, haven't you? I thought you might join the party—it's Mabel's birthday, you know, and we've put a grand celebration together—but perhaps it would be best if you stayed here and had a good rest."
Without further ado, he vacated the room, followed by Clem. Mabel took up her post on the bed again, sitting quietly. Through the wicker walls, Helga heard Oliver arrive outside, people calling his name and asking him about the poor little frogfolk.
"She's resting comfortably," Oliver assured them. "Mabel has things well in order, as she always does, and I'm sure she'll be joining us shortly."
"What's all this about a Calamity Beast, then?" someone asked.
"No need to fret," Oliver said. "The Spring Elk came through right when it should, didn't it? And the Sun Hawk isn't due for some while yet. The unpredictable ones, the Blight Snake and the Drought Cat and so on, don't intrude on the affairs of us little folk in Valley. Not since the Battle of Kell's Ridge, and before that, the time of the Order of the Holly Leaf. Now, enough of this grim talk. There's strawberry cake that wants eating!"
A ragged cheer went up, followed by a song plucked out on a bow harp, accompanied by wood flute and drum. Helga listened to the cheerful music with an ache in her chest.
The mayor wasn't entirely wrong about the beasts. They were rare compared to the distant past, when weavers first taught themselves to use magic to protect all animalfolk from the predators who ravaged the land with torrential storms and blizzards and wildfires and plagues. Lily of the Valley, champion of holly, had wielded the burning might of the sword Cragflame to drive those Calamity Beasts far away.
Then that same magic drove some weavers mad, and the rest set aside the great weavings in favor of small ones anyone could manage. Valley, haven within the high hills, lived in peace, even if other parts of Bloomburrow still suffered the whims of the Calamity Beasts.
And yet, the Night Owl had attacked Pondside. If Helga's dream was indeed a vision, it might attack again—or it already had. Or both.
"I didn't imagine anything," Helga croaked, her throat raw. "Not the Night Owl, not my dreams, and not my drawings."
Mabel was saved from answering by the arrival of Rosalyn with a tea tray. The child had her father's coloring and her mother's nose, and she wore a vest and pants stitched in a vine pattern. She stood solemnly while Mabel poured a cup of fragrant mint tea and offered it to Helga.
"Drink up," Mabel said. "It will help settle your nerves."
Helga obeyed, hands trembling. Rosalyn left the tray on a side table and, after a nod from her mother, departed. They sipped their drinks in silence, until finally Helga spoke.
"I shouldn't have run," Helga said. "I should have stayed. I could have done … something."
"Perhaps." Mabel stared into her cup as if the dregs held wisdom. "When my husband or children are ill, I don't want to leave their side, as if my presence alone will prevent them from worsening. Or if there's a bandit attack, surely my sword will mean the difference between victory and defeat. But I'm not the linchpin that keeps the wheel of the world from falling off, am I?"
"I suppose not." Helga knew this speech was meant to keep her from feeling guilty for her escape. It didn't. "It hurts not to know …" She couldn't make herself finish the dark thought.
"You'll know soon enough," Mabel said, and from her it sounded like a promise. She placed Helga's empty cup on the tray. "My birthday party is underway. You're welcome to join us if you don't want to be alone with your thoughts. There's plenty to eat and drink, and it might ease your heart. Good to celebrate life in hard times." She picked up the tray and left, closing the door behind her.
The music continued, joined by more instruments and voices and the rhythmic stomping of feet. The thought of dancing made the mint tea she'd drunk want to come right back up. Still, Mabel wasn't wrong. It might do her some good not to pickle in her own troubles. She needed to eat something, despite her lack of appetite.
#emph[Were her visions true or not?] Mabel hadn't said she believed Helga, but neither had she agreed with the mayor's assessment. She seemed to at least accept that the Night Owl had attacked Pondside. Any greater danger beyond that was uncertain, the only evidence the word of a single frogfolk who had never been trusted by anyone but her grandparents, may their spirits rest happily.
#emph[Oh, this was fruitless.] Helga told herself she really should get up and go. Not just yet, though. Not yet.
#v(0.35em)
#line(length: 100%, stroke: rgb(90%, 90%, 90%))
#v(0.35em)
#strong[Mabel]
Mabel placed the tea tray on the table in the kitchen next to the last cooling batch of strawberry cookies. The smells of sugar and fruit and spices filled the room as they always did, warm and comforting. Clem slung a towel over his shoulder and drew Mabel in for a hug, nuzzling her cheek and tickling her with his whiskers.
"How's our new friend?" Clem asked.
"Troubled," Mabel replied. "Poor thing is wrung out and ready to bolt."
"To be expected. Shall I ply her with sweets?"
"Soon." Mabel gathered her thoughts like a dropped skein of yarn. "Oliver thinks she's telling stories for attention, or some such nonsense."
Clem leaned back but didn't release her. "What do you think?"
"That she has visions, true visions, and isn't exaggerating or inventing a single thing."
Clem squeezed her gently and released her. "What are you planning?"
"Someone must travel to Pondside," Mabel said. "More than one someone, for safety."
"And you want to be one of those someones?"
Mabel nudged a cookie that was slightly out of place. "I don't want to leave you and the children."
"The banner is already hung, so I expect we'll be fine for at least another few hours," Clem joked. More seriously, he added, "The littles can be a pawful, but we can manage without you if needs must. Your family will come back from their trip, and mine never left. Even our neighbors will pitch in, you know. And I daresay I'm capable of keeping mouths fed and bums clean, even if they will outnumber me three to one."
"You're more than capable," Mabel protested.
Clem playfully snapped the towel at her. "Even so, big problems are best solved together. And this promises to be a very big problem, love."
"It does," Mabel agreed. Calamity Beasts were not merely a nuisance, like plant-eating insects. They could change day to night, warmth to a bitter freeze, robust crops to withered vines. They could burn down all of Bloomburrow, leaving only ashes.
Mabel rapped the table with her knuckles and stepped away. "I'm going up to the attic."
"You think it's needed, then?" Clem asked.
"For a Calamity Beast?" Mabel shrugged. "If not now, when?"
#v(0.35em)
#line(length: 100%, stroke: rgb(90%, 90%, 90%))
#v(0.35em)
The attic held an organized chaos of items used infrequently—holiday decorations, winter coats, future birthday presents hidden from prying child eyes. In one corner, furthest from the small window that illuminated the space, lay a bundle covered in a shamefully dusty sheet.
"It's not precisely a secret," Mabel's mother Iris had said when she passed it on to her daughter. "My mother gave it to me, and you'll give it to Rosalyn when you're no longer fit to wield it. Or perhaps Foggy or Pip, if Rosalyn isn't one to take up arms. No, not a secret, but a responsibility."
Mabel pulled the sheet off. Beneath it, a sword rested on a wooden stand. Unlike her thistle-hilt rapier, forged from the metal sap of ironroot trees, this weapon was crafted from a massive tooth, honed down to a size manageable for little folk. The sigil-etched blade curved, sharpened on both the true and false edges, tapering to a wicked point. The hilt was simple, cord-wrapped, while the pommel was carved into the shape of a dancing flame.
The sword once belonged to Lily of the Valley herself, so the story went, formed from the fang of the Wildfire Wolf that nearly destroyed Bloomburrow. Privately, Iris had expressed her doubts.
"Stories have power," Iris had said. "A story doesn't need to be true to be real, or perhaps the other way around? Whether the sword was Lily's or not, whether Lily really was your many-greats-grandmother, folks believe in the story, and in the sword. And it does have power, make no mistake."
Oliver had wanted to use Mabel's birthday as an excuse to make a spectacle of the relic. It was one thing to hear the tale of the Order of the Holly Leaf, and quite another to admire the physical evidence of their brave deeds. Mabel had found the prospect distasteful, but now? It might be necessary.
Mabel lifted the weapon off its stand. Heavier than her rapier, but well balanced. A rush of magic flowed up her arm and through her body, from ear to tail. Warm, but not unpleasant, like stepping off a shaded porch into full sunshine. The sigils on the blade briefly gave off a faint reddish light, as if banked coals beneath the bone-white surface were stirred.
They'd never done that before. Mabel took it as an omen. Her mother had claimed the weapon's enchanted flames could be called upon by its wielder in times of need, in defense of the innocent and vulnerable.
"Would someone try to steal it?" Mabel had asked. "To use it for their own selfish ends?"
Iris had laughed. "The sword doesn't take kindly to such things. I'm told your great-great-grandmother, bless her spirit, found what was left of a thief who threatened to harm her son with it."
"What was left?"
"Ashes, my heart. Only ashes."
#v(0.35em)
#line(length: 100%, stroke: rgb(90%, 90%, 90%))
#v(0.35em)
The party may have begun awkwardly, with concerns about strangers and Calamity Beasts overshadowing the festivities, but now it was lively and high-spirited. Tables laden with food clustered near Mabel's house; tarts and muffins disappeared into appreciative mouths, the strawberry crumble was nothing but crumbs, and some elderberry jam thumbprint cookies were wrapped in napkins and tucked into pockets for a future treat. Vann had not only made his chamomile fizzy drink but also a blackberry punch with an enticing clove and cinnamon scent. Clem drank two cups and pronounced himself inspired to create a new cake in its honor.
Silver the bard and a few others sat or stood on a platform near a neighbor's house, playing one merry tune after another as chipmunk danced with rabbit, vole with hedgehog, weasel with mouse—including Rosalyn, tail tucked close to her body, her eyes bright with pleasure. Gev, a lizardfolk notable for the handsome red circles around his eyes, wielded a pair of fire maces, swinging and spinning them in a dizzying display of grace and finesse, their flames leaving trails in the twilight.
Pip and Foggy, along with other neighborhood children, clambered over Hugs, a gruff old badger nearly three times Mabel's height. He tolerated being used as a playground with good humor, sometimes rolling sideways or arching his broad back, or stretching his arms up so the squealing littles could climb to new heights.
In an open area between houses, someone had erected an archery butt and a contest was underway. A sable-furred rabbitfolk in a wide straw hat was judging—Finneas, who had won the spring and autumn archery competitions too many times and been subsequently banned from participating. Even so, by request, he indulged in a few trick shots to impress the spectators. Mabel watched him loose three arrows at once, pinning the precise center of each leaf of a clover to the distant target.
#figure(image("002_Episode 2: An Expected Party/01.jpg", width: 100%), caption: [Art by: <NAME>], supplement: none, numbering: none)
A few batfolk clerics joined the festivities as the sun dipped below the rooftops, fireflies casting their gentle glow on the crowded street. Porfirio wore his high-collared black robe with its silver hem, decorated with the phases of the moon, while Zoraline's gauzy pale-green dress fluttered around her, circles winking from its folds like the eyes in a luna moth's wings. While Porfirio spoke with Clem's parents, Zoraline seemed distant, distracted, her gaze fixed on the horizon as if she expected something to crest it. The moon, perhaps, though she was looking in the wrong direction if so.
"Cake?" Clem asked, startling Mabel from her perusal of the guests. Mabel smiled and took the offered confection. A huge slice of strawberry adorned the thick frosting, precisely how she liked it.
"If I eat much more, I'll be fit to burst," Mabel said, cutting herself a bite.
"I'll help, then," Clem said, and stole the piece off her spoon.
"Oy, that's mine!"
"It's better when it's yours, you know that." He swiped frosting from the plate with a claw and licked it, whiskers twitching mischievously.
Mabel chewed pensively, then swallowed. "Everything is so peaceful here, but it feels fragile. As if a storm is about to break."
"Because of Helga?" Clem asked. Mabel nodded, and he leaned against her. "If there's a storm, we'll weather it. As my mam says, 'Don't miss the morning sun waiting for evening rain.' It's a fine day, you're among friends, and I've been told by trustworthy individuals that the cake isn't an utter disgrace."
"It must be delicious," Mabel teased, "or you wouldn't keep stealing it."
Helga appeared in the doorway, smiling nervously at no one in particular. She clasped her elbows as if unsure what to do with her hands, until someone approached and offered her a slice of carrot cake. She held the plate as if she'd forgotten how to eat.
"Here we go," Clem said, nudging Mabel.
She followed Clem's gaze. Oliver made his way to the platform where the musicians performed. Silver noticed and brought the song to a close, and everyone clapped and stomped appreciatively. Oliver raised his arms, and the clapping tapered into, if not silence, polite murmuring.
"Neighbors—nay, friends," Oliver began, "it's an honor and a pleasure to celebrate the birthday of our very own Mabel with you all this evening." He paused for a smattering of applause.
He gave nearly the same speech at every birthday party. Mabel nibbled her strawberry and resigned herself to paying attention, since she was the guest of honor. Oh, that was unworthy of her. Poor Oliver meant well.
"Mabel is a paragon of our community," Oliver continued. "In her youth, she joined a mousefolk band that traveled to the highest of hills in Valley, to scale the Cliff of Heroes as so many have before her."
"In your youth?" Clem whispered. "You're in your dotage now, are you?"
Mabel hushed him with a smile.
"She joined the local defenders when bandits attacked Goodhill, protecting the town and driving off the malicious miscreants."
A sorry skirmish that had been. She'd landed in a skunkfolk's stink spell and had to scrub her fur for an age.
"Most importantly," Oliver said, his nose twitching, "Mabel is a dedicated wife and mother, and her gardening and baking are the envy of us all. Truly, she exemplifies the bravery and loyalty to which everyone aspires."
"He needn't lay it on so thick," Mabel muttered.
"Oliver's always been more frosting than cake," Clem replied. "Speaking of cake, are you planning to finish yours?"
Mabel passed it to him, and he set to polishing it off. He offered her a bite, and she took it. He was right; it tasted better when shared. Love had ever been the most delicious spice.
Oliver chose that moment to hold an arm out to Mabel. "Let's hear a few words from our honoree! Come up here, Mabel, don't be shy." Cheers rose, and a few folk chuckled, no doubt at the thought of Mabel and shyness inhabiting the same shire.
Mabel swallowed as she climbed onto the platform next to Oliver. The crowd spread out in front of her, some listening intently, others engaged in their own quiet conversations. #emph[What could she say to them? No, what did she ] need#emph[ to say?] Her thoughts returned to her discussion with Clem and the sword she'd carefully rewrapped.
"Thank you all for coming," she began. "I hope you've had as lovely a time as I have, here among so many good friends."
"And good food!" someone yelled, followed by laughter and agreement.
Pip sat atop Rosalyn's shoulders and clutched her ears for balance, while Foggy jumped and waved to catch his mother's attention. Mabel smiled and waved back at him. Rosalyn herself simply watched, serious and somber as always.
#emph[How could Mabel think of leaving her family, even for a few days?] She wasn't getting any younger, dotage jokes aside. Surely others would be willing to help Pondside. She searched for her husband in the forest of faces, finding him near their front door, a few steps from Helga. Clem raised his spoon to his forehead in salute, then stepped inside.
Helga seemed not to have noticed him. Neither was she listening to Mabel. Instead, she stared at the sky as if it might fall, her uneaten cake still clutched in a trembling hand. Mabel imagined herself—or worse, her children and Clem—in the same position. To feel alone amid so many people, to be afraid and uncertain when everyone around you danced and laughed, must be nearly intolerable.
Mabel's wavering resolve solidified. She knew what needed to be done, and she could do it, so she would. Simple as that.
"Thank you especially, Oliver, for the kind words about me," Mabel said. "I don't think of myself as more brave or loyal than anyone present. Bravery doesn't always mean climbing mountains or fighting bandits. All of us stand ready to help each other in times of hardship, and that may be the bravest thing I can imagine."
A chorus of assent rose from her audience, but she wasn't finished.
"We have among us someone else who was brave." Mabel gestured at Helga, who froze as eyes and ears swiveled in her direction. "Helga came all the way from Pondside to get help for her village, and to warn us of an attack from the Night Owl."
#figure(image("002_Episode 2: An Expected Party/02.jpg", width: 100%), caption: [Art by: <NAME>], supplement: none, numbering: none)
Now the crowd turned anxious, the volume of murmurs louder. Oliver pinned his ears back but didn't contradict Mabel. Helga seemed to shrink in on herself like a new leaf in full sun.
"I haven't seen the destruction," Mabel said, raising her voice to be heard over the din. "But I have heard Helga's story. To disbelieve her is to risk suffering for ourselves and others, and I do not think that is very brave at all. Nor is it practical, and most of us are practical folk, aren't we?"
Reluctant agreement replied, nods and ear twitches and smoothed whiskers. Clem emerged from their home carrying a cloth-wrapped object and made his way toward her.
"The practical thing to do," Mabel said, "is to go to Pondside, to check on the villagers and render aid. Goodhill may be safe now, but if there is a Calamity Beast at large, we may not remain safe for much longer. Maha could spread darkness across not only all of Valley, but the farthest reaches of Bloomburrow."
Clem climbed up next to Mabel and passed her his bundle. Reverently, she unwrapped it to reveal the sword from her attic. As she held it aloft, a faint sheen of flame rippled along the carved tooth from hilt to tip. The crowd gasped, and Oliver no longer seemed quite so eager to see the relic.
"I intend to investigate the situation in Pondside," Mabel said, lowering the sword. "If necessary, I will follow any trails I find there to wherever they might lead, to preserve our peace. Who will come with me?"
Some of her friends and neighbors shook their heads, others dropped their gazes or nervously glanced around. Mabel wondered if she would be traveling alone after all.
"I'll go!" Finneas, the archer, raised his bow. His sisters protested, and they all began to quietly argue.
Hugs rose to his full height, towering over everyone else, and inclined his white-striped head at Mabel. Beside him, Gev hissed a sigh and blinked his third eyelid.
"If he's going," Gev said, "then I am also. I cannot permit him to get into trouble without me."
That made four. #emph[Would anyone else volunteer?]
To Mabel's surprise, Zoraline wove through the crowd, wings closed around her like a cloak. "The alignment of the stars has unsettled me," she said, her voice high and dreamy. "I believe Pondside is the lodestar that will guide me to where I am needed."
Helga leaped down the path and stumbled to a stop near the platform. "You must take me, too," she said breathlessly. "I know some cantrips. I studied weaving with <NAME> in Fountainport, as his apprentice. It's my village. I want to help. I #emph[need] to."
"As you wish," Mabel said. To the rest of the townsfolk, she said, "Thank you again for coming, everyone. Those of us traveling to Pondside must prepare to leave at first light." She wrapped the fang-sword in its cloth again, a signal that the moment had passed and the future must begin in earnest.
Someone clapped slowly, the applause building to a flood of cheers and stomping. Neighbors hugged Mabel and wished her well as she walked back toward her home. Rosalyn, Foggy, and Pip joined her, and Clem waited for her at the front door. Together, they went inside to prepare for what was to come.
#v(0.35em)
#line(length: 100%, stroke: rgb(90%, 90%, 90%))
#v(0.35em)
Helga assured Mabel she was thankful for her hospitality, but she would be fine at the town's traveler lodgings for the night. Clem helped Mabel wrangle Foggy and Pip, who chattered incessantly while their parents bathed them and cajoled them into nightclothes. Rosalyn tidied the minimal mess in the kitchen; Mabel suspected her eldest didn't want to remain idle when her thoughts and emotions were all awhirl, a sentiment she shared. Now Clem was packing Mabel's rucksack while she herded the littles to their beds and sent Rosalyn to finish her nightly scrub.
"I don't want you to leave, Mama," Pip cried, whiskers trembling.
"She's going to be a hero, Pip," Foggy said, bouncing on his bed. "She's going to have an adventure and do swordfights and use magic and then come back and tell us all her stories!"
"I don't care about stories," Pip insisted. "She already tells us stories. Da's are better anyway, because he does voices."
"While I'm gone," Mabel said patiently, "you must be good and kind and help him and Rosalyn, all right?"
"Yes, Mam," they answered in unison.
Rosalyn arrived wearing her favorite quilted nightdress. "I'll take care of them," she said quietly. "And I'll make sure Da can manage the baking."
Mabel pulled all her children into a hug, squeezing them as tightly as she dared. "You are my sweet and brave little mouselings, and I will love you from spring to winter and back again."
"Love you," they replied dutifully. She tucked them in, nuzzled their faces, carefully shooed their firefly from the bedroom, and closed the door.
Clem leaned against the table in the kitchen, his apron hanging on its hook near the pots and pans. He opened his arms as she reached him so they could hold each other quietly. He smelled of sugar and acorn flour and spices and everything good in the world, and she missed him already as much as she missed her children trying to sleep in the next room.
"You're doing the right thing," Clem said, stroking Mabel's back. "You're probably the most capable person in Goodhill to help poor Helga. A paragon, I've heard, from our dear mayor."
Mabel groaned, then laughed. "His speech will be twice as long next year because of this quest."
"I'll save honeycomb wax so we can fashion ear plugs."
They embraced silently for a time, eventually allowing their tender feelings to encourage them in the direction of their own bed. What the next day and beyond would bring, neither could say, but they spent the night snuggled together, warm and cherished and safe—for now.
|
|
https://github.com/polarkac/MTG-Stories | https://raw.githubusercontent.com/polarkac/MTG-Stories/master/stories/028%20-%20Kaladesh/006_Bottled%20Up.typ | typst | #import "@local/mtgstory:0.2.0": conf
#show: doc => conf(
"Bottled Up",
set_name: "Kaladesh",
story_date: datetime(day: 28, month: 09, year: 2016),
author: "<NAME>",
doc
)
#emph[Drawn to her home plane of Kaladesh by reports of the Consulate looking for a disruptive renegade, Chandra discovered, to her shock, that the renegade in question was her mother! Their reunion was cut short, though, by Consulate soldiers who took <NAME> into custody. While Liliana pursued a different lead, Chandra and Nissa found an old friend of Chandra's parents, <NAME>, and began looking for Pia's prison cell. By way of Oviya's many renegade contacts, they have learned that she is being held in the Dhund, a secret complex run by the vicious mage Baral—the same Baral who hunted a young Chandra down and killed her father.]
#v(0.35em)
#line(length: 100%, stroke: rgb(90%, 90%, 90%))
#v(0.35em)
Nissa's head swam as Mrs. Pashiri led her and Chandra away from the noise and smells of Yahenni's party and back into the darkness of the streets, where the explosive excitement of the Inventors' Fair had faded into the cheerful bustle of night.
Ghirapur was not as bad as Ravnica, with its sharp angles and gray streets. In fact, the city had clearly been laid out with an eye toward the flow of magic—of aether—through the streets and around the buildings. And the aesthetic of the place was all graceful curves and delicate lines, more like the forests of Zendikar than the hard edges of Ravnica.
Still, it was thronged with #emph[people] .
It was all Nissa could do to keep up—with the events of the day, with Chandra's palpable agitation, with the whole chaotic jumble of the plane.
"The Dhund," <NAME> said, shaking her head. "Of all places."
#figure(image("006_Bottled Up/01.jpg", width: 100%), caption: [<NAME>, Sage Lifecrafter | Art by Magali Villeneuve], supplement: none, numbering: none)
Chandra growled. "Baral! Why him? Shouldn't he be dead or...or retired or something by now?" She paused. "Preferably dead." Another few steps, as tiny flames licked around her fingers, which were clenched in tight fists. "In a fire."
"In a just world, he would be," the older woman said.
"Well, when I get my hands on him..." Chandra seemed to bite her tongue, maybe literally. "Sorry, <NAME>."
Nissa frowned. Until now, she had seen Chandra's fiery wrath directed only against the Eldrazi, or the twisted, corrupted creatures on Innistrad that might as well have been Eldrazi. The idea of her unleashing that anger against a person was unnerving. #emph[How much pain must he have caused her?] she wondered.
"Liliana told me I should hunt him down," Chandra said. "Find him and take my revenge. I should've listened to her."
Nissa wanted to reach out to her, put a hand on her shoulder, offer some kind of calm through her touch. But she was afraid—of what? Of causing pain, like touching a burn? Or of #emph[feeling] Chandra's pain more powerfully than she already did, coursing between them like fire?
"And where the hell #emph[is] Liliana, anyway? What the hell is more important than finding where they took my #emph[mom] ?"
Liliana's agitation had been less...heated when she left them, but no less palpable. It had been the first time Nissa had seen the necromancer in a state other than unflappable calm, and she suspected that whatever Liliana was doing, it was very important.
Chandra stopped dead, stamped her foot with a small puff of flame on the cobblestone, and said, "And where the hell are we #emph[going] ?"
"We need to get across the river," <NAME> said.
Chandra furrowed her brow. "What's across the river? The old energy plants?"
"Yes. And the worst-kept secret in Ghirapur." She lowered her voice. "Gonti's."
"What are gontis?" Chandra asked.
"#emph[Gonti] is another aetherborn. I think they made their fortune as a smuggler—I dealt with them once or twice, back in the day. Gonti's night market is sort of a hub for contraband aether and renegade inventors."
Chandra gripped the hair at her temples in exasperation, kindling more tongues of fire that licked at her head and hands before dwindling into smoke. "Why are we going there? Where's my mother?"
"I'm sorry, dear. I'm following the best information I have. I'm told the Dhund lies in tunnels beneath the night market."
#v(0.35em)
#line(length: 100%, stroke: rgb(90%, 90%, 90%))
#v(0.35em)
Chandra looked physically pained by having to stay in her seat while a small skiff carried them across the river, poled by a young man who feigned indifference as his face betrayed a keen interest in every word Chandra spoke. She vented her energy by furiously tapping her feet. Her hands were in constant motion, and she looked like she was chewing her tongue to avoid saying anything that might incriminate her.
But for those few minutes, away from the lights and the noise and the people of the city, Nissa looked up at the stars and the swirling, shifting blues of the aethersphere and felt calm...tempered only by the nagging worry that Chandra, in her anger and impatience, might set their little boat on fire. The strongest aether current in the sky mirrored the path of the river almost perfectly, and Nissa could #emph[feel] the agreement between them, as if aether and water were companions bound on the same journey together.
#figure(image("006_Bottled Up/02.jpg", width: 100%), caption: [Island | Art by Johannes Voss], supplement: none, numbering: none)
She thought of Ashaya then, her elemental companion, a fragment of the world-soul of Zendikar, and she wondered—not for the first time—why she had agreed to leave her home plane and embark on the madness of this journey with these humans. They had done important work together, to be sure, and she had found that they could battle very effectively together. Each of them contributed unique strengths to the team as a whole, and helped cover the weaknesses of the others. She enjoyed being a part of that, of something bigger and better than herself. In a way, it was like being connected to the soul of a plane, joined together in a greater purpose.
But in the whirlwind of fighting Eldrazi, she had found little opportunity to sort out the emotional relationships among the others. Those relationships were evidently...complicated. And finding her own place within that web of relationship was exhausting. It was all so utterly unlike the simple, wordless communion she had shared with Ashaya—as effortless as a touch.
When she touched Ashaya, energy...mana...no, #emph[life] flowed between them, uniting them—joining Nissa to the natural essence of Zendikar. The closest she had come to that with anyone else was Jace's wordless communication, the directness of his thoughts in her mind. In the heat of battle with the other Planeswalkers, with Jace facilitating their communication, she could control the flow of mana among them. She could lose herself in that flow and let herself be a part of their larger effort. She and Chandra had shared a powerful bond in those moments, open together to the flow of magic through the planes.
#figure(image("006_Bottled Up/03.jpg", width: 100%), caption: [Nissa, Voice of Zendikar | Art by Raymond Swanland], supplement: none, numbering: none)
Face to face, though—with Chandra or with any of them—it was so much harder. People expect to conduct their day-to-day interactions on a surface level. Just as Jace didn't use his mind-magic to replace everyday conversation, she couldn't expect to forge that same deep connection over breakfast in Jace's sanctum. And when Chandra was this upset and agitated, Nissa feared that opening herself to the pyromancer would be like opening a floodgate to loose a wave of fire.
She sighed and let herself become part of the flow around her, embraced between the aether above and the water below. She felt the beating heart of Kaladesh, and everything else melted away.
#v(0.35em)
#line(length: 100%, stroke: rgb(90%, 90%, 90%))
#v(0.35em)
Nissa tried to cling to that connection as Oviya led them into the throng of Gonti's night market, but it was snatched away with every step she took past inventors hawking their latest devices and smugglers offering great deals on illegal aether supplies. The noise pressed on her ears, the smell of close-crowded bodies assaulted her nose, and Chandra was a furnace of emotion creating her own personal bubble of intense heat in the midst of the press of bodies.
While Mrs. Pashiri spoke to yet one more contact—a surly dwarf with a suspiciously bite-shaped piece missing from one ear—about how to gain access to the Dhund, Nissa hesitantly extended a hand toward Chandra's shoulder. She wanted...she wasn't sure. To comfort Chandra, somehow. To take some of her anxiety into herself, if she could, to share the burden that Chandra was struggling to carry. But heat radiated from Chandra's metal armor and Nissa pulled her hand back, imagining the floodgates holding back the raging fire.
"Chandra," she said instead. "On Ravnica, you asked me...you wanted me to help...you were looking for calm."
Chandra wheeled on her, eyes blazing. "I don't #emph[want] to calm down," she said, her throat and face tight. "I want to find my mom." Her eyes ranged over Nissa's face for a moment—what was she looking for?—and then she turned away. "You just don't get it," she muttered.
#emph[I guess I don't,] Nissa thought. She closed her eyes and tried to block out the noise and the smell and the riot of colors as she took a long breath.
#emph[Interesting,] she thought. Aether traced winding paths through her awareness, blown by stray gusts of wind, carried by ventilation systems. #emph[I wonder...]
#figure(image("006_Bottled Up/04.jpg", width: 100%), caption: [Nissa, Vital Force | Art by <NAME>ley], supplement: none, numbering: none)
"Nothing," <NAME> said as the dwarf faded back into the darkness of an alleyway. "Everyone suspects that the Dhund is here somewhere. But either no one knows how to get there or they all know better than to tell me. If only I could find..." Her voice trailed off as she scanned the crowd.
Nissa's eyes fluttered open. "#emph[I] know," she said.
Mrs. Pashiri's eyes widened in surprise, but Chandra scowled. "Why didn't you say so? Damn it, Nissa, they could be torturing her down there. Or she could already be dead."
"I know." She did—she felt Chandra's fear and worry almost as keenly as she had once felt Zendikar protesting the violating presence of the Eldrazi. "I'm not #emph[hiding] anything from you; I just figured it out. It has to do with the way aether flows through the city. If I can concentrate..."
"I don't care," Chandra barked. "Just take us there!"
"#emph[If ] I can concentrate," Nissa repeated, "I think I can lead us there. Maybe even help us navigate down in the tunnels."
Chandra gripped her shoulders and almost shook her—though the heat of her agitation, pushing against the floodgates, was still more jarring. "So concentrate!"
"Chandra, dear," <NAME> said, laying a gentle hand on Chandra's back. "I think your friend needs a little space."
Nissa blinked. #emph[Your friend? I'm not...]
Ashaya had been her friend. With Ashaya she could reach out her hand and make a connection, perfectly casual, perfectly natural. Effortless. With Chandra—or Gideon, or Jace—nothing was effortless, not even a simple act of touching, like <NAME> had just done.
Chandra removed her hands and took a half-step back. "Oh, sorry." She stared expectantly at Nissa.
Nissa met her gaze, and suddenly all of Chandra's pain and anger and frustration burned into her. Tears stung her own eyes, and she looked away. "I'll try." She turned, squeezed her eyes shut and shoved her emotions aside, and pressed her fingers to her temples.
The world suddenly sprawled vast across her awareness, like a map unrolled and spread upon a table. Aether flowed through the plane like a vast river network, soaring through the sky here, dipping down to kiss the earth there; mirroring the paths of streams at times, winding through city streets at others. Refined aether, a different taste, streamed through pipelines above and below the street. Little knots of concentrated aether nestle underground in places, where it could not flow as easily.
#figure(image("006_Bottled Up/05.jpg", width: 100%), caption: [Attune with Aether | Art by <NAME>], supplement: none, numbering: none)
But through a system of tunnels, aether could move. Not the streams coursing high above in the aethersphere, but stray wisps and tributaries. Nissa had felt it under her feet—a mere trickle compared to the rush around and above them, but there. Focusing her mind on that part of the flow, she started searching for the points where aether entered and left the passageways.
"This way," Nissa said at last, pointing to her left.
<NAME> tilted her head. "How do you..."
But Chandra was already moving in the direction of Nissa's pointing finger. "Show me," she said. "Which way?"
Nissa hurried to catch up to her, and steered her toward a small sort of building erected up against the inside of the cavernous room that housed this portion of the market. A glance over her shoulder confirmed that <NAME> was still with them, and they wound their way through the crowd until they reached the steel door.
Chandra jiggled the handle. "Locked," she said.
<NAME> started rummaging in the voluminous folds of her clothes. "Let me get my tools..."
A blast of white-hot fire leapt from Chandra's hand to engulf the door handle and, presumably, its locking mechanism. Nissa had to shield her eyes from the bright flash, and she felt the intense heat on her face.
"You're attracting attention," <NAME> said under her breath.
Chandra kicked the door and it swung open. "Let them get in my way," she growled.
As if accepting Chandra's invitation, a massive hulk of a man strode over, backed up by an even more massive hulk of metal plates, filigree, and gearwork. He shoved Chandra to the side and interposed himself between her and the half-melted door. Either he hadn't seen Chandra's blast of fire or he wasn't wise enough to be afraid of it—Nissa suspected the latter. Or perhaps his sense of duty led him to disregard his own personal safety.
"Hey, now," he said. "Where do you think you're going?"
#figure(image("006_Bottled Up/06.jpg", width: 100%), caption: [Embraal Bruiser | Art by <NAME>], supplement: none, numbering: none)
Chandra's hair and both her fists ignited as she met the man's stern gaze. "Into the Dhund," she said. "Is this the way?"
Nissa saw a room behind the door, cluttered but disused, and a stairway leading downward. She could practically taste the trickle of aether coming up from the tunnels below.
"That's private property," the man said, apparently undaunted by Chandra's fiery display. Though he shared Gideon's physique, this brute lacked any of his charisma or good humor. He reminded Nissa more of the ogres of Murasa—and she felt a pang of longing for her beloved Zendikar.
"Why don't we discuss this in a little more privacy?" <NAME> said mildly, taking the man's arm and drawing him inside the small building.
Clearly, he lacked Gideon's intelligence as well, or perhaps he was put off his guard by Mrs. Pashiri's kindly appearance. While he was ducking his head to get through the doorway, Chandra planted a kick on his backside and sent him sprawling on the floor. His head thudded hard and he didn't raise it again. While Chandra seized Nissa's hand and pulled her inside, the man's automaton tried to come to his rescue. Too large to get through the door at all, it bent over and reached its arms inside. Waving Chandra and Mrs. Pashiri toward the stairs, Nissa drew on the magic pulsing through the earth beneath the creature. Vines broke through the concrete floor and coiled around its legs while others reached up right in front of Nissa and seized its flailing arms. Aether hissed out of it in dozens of tiny jets as the vines started disassembling the automaton.
Nissa followed the others down the stairs, down deep underground, and found herself in the middle of a long tunnel.
Chandra threw her arms around the elf. "You did it!"
Chandra's armor, still hot to the touch, poked Nissa's chest, and a strand of the pyromancer's hair—smelling of smoke—tickled her nose. And a different sort of heat, the raging fire of Chandra's boundless energy, pressed on her as well—the merest hint of a real connection. Then Chandra pulled away and turned back and forth, looking down the tunnel in both directions.
"Which way?" she said again.
"I...have no idea," Nissa confessed.
"What do you mean? You got us this far!"
"We were looking for the tunnels beneath the night market. I found them by tracking the flow of aether beneath our feet. Finding your mother down here is another matter entirely."
"Follow me," <NAME> said, starting off to the right of the stairs. "And quickly; that automaton's going to get noticed."
"And then stripped for parts, if I know night markets," Chandra said, shooting Nissa a wry grin.
#v(0.35em)
#line(length: 100%, stroke: rgb(90%, 90%, 90%))
#v(0.35em)
Once more, Nissa felt her head swimming. Chandra's frenetic motion, impelled by the desperate need to find her mother, left Nissa breathless from the ride. Every time <NAME> stopped to consider a branching passage, Chandra paced back and forth in the hall, her hands releasing puffs of flame as she flexed them into fists. Nissa wondered if she had led them into a useless network of access tunnels built for the old energy plants, since nothing here suggested a secret prison compound. People who looked like shifty renegades connected to the night market kept a very casual watch over some of the passages, and they were easily distracted when Oviya sent a small lifecraft animal or servo skittering down a hall.
"This can't be the right place," she said. "It's too easy. They're too inept to be highly trained secret police."
Chandra laughed. "Never underestimate human stupidity."
"They're on edge," <NAME> added. "Nerves wound up tight. So they go running after every clank in the darkness."
Both explanations seemed plausible, but Nissa wasn't convinced. She closed her eyes for a moment and drew a deep breath, trying to reclaim the calm she'd felt on the river.
Chandra jolted her out of it with a yank on her arm. "No time to meditate," she said.
Nissa scowled. "You might want to try a deep breath, too," she said, as gently as she could manage.
"Maybe later."
"Just one breath. Open yourself to the flow of energy through the world. Feel the vastness of it."
"I said later!" Chandra stomped down the passage.
Nissa hurried to catch up with her as Mrs. Pashiri trailed behind them.
"You're so closed up, Chandra. It's like you're curled up around all your pain and fear, clutching them to your chest."
Chandra's pain and anger erupted in flames again. "Of course I am!" she cried. "I can't relax, I can't calm down, not while they have my mom!"
"But you'll be better equipped to find her—"
Chandra wheeled on her and flames surged dangerously close to Nissa's face. "This is my mother! For #emph[twelve years] I thought she was dead. Don't you understand? Do you even #emph[have] a mother?"
Nissa stopped dead. Something had gripped her chest and was squeezing, driving the breath from her lungs.
Chandra's sudden rage seemed to ebb, as she saw the effect of her words. "I'm sorry..."
"Did you ever see <NAME>," Nissa said, "when you were on Zendikar?"
Chandra shook her head, blinking.
"It was the home of the Joraga, my people. And when Ulamog...escaped his prison, it was the first place he destroyed." She swallowed hard. "Dust."
"So your—your parents...?"
"They're not gone, or so the elders teach us. The spirits of past generations live among us. I expect they are helping those who seek to rebuild..." Nissa's voice broke. The last time she saw her mother was long before Ulamog awakened. She knew that some of the Joraga had survived. But she had never sought her mother.
Before she knew what was happening, Chandra pulled her into another hug, pinning her arms to her sides. Strangely, the pressure on her chest seemed to diminish.
#v(0.35em)
#line(length: 100%, stroke: rgb(90%, 90%, 90%))
#v(0.35em)
Mrs. Pashiri stood at a four-way intersection of unmarked identical tunnels somewhere deep in the maze beneath Gonti's night market.
"I know it can't be that way," she said, pointing to her right. "And it's not the way we came." She pointed her thumb over her shoulder. "But it could be either of these others."
"What even are we looking for?" Chandra said. "Do any of these tunnels #emph[go] anywhere?"
"If they didn't," Mrs. Pashiri said, "what would be the point of guarding them? I've been trying to figure out where we're going by seeing what tunnels they think are important enough to guard. But I #emph[think] we're just going in a big circle around the edge of it. I can't find a way to the middle."
Pouring a blast of fire down the tunnel to the right, Chandra roared, "No!" The twin roars of the flames and her voice echoed in the small passages. "You've been leading us around in circles while they have my mom?" She wheeled around and grabbed Nissa's shoulders again. "Nissa! Do your thing. Feel the aether flow or whatever. Figure it out!"
#figure(image("006_Bottled Up/07.jpg", width: 100%), caption: [Furious Reprisal | Art by <NAME>ov], supplement: none, numbering: none)
"I'll try," Nissa said, wincing at the heat of Chandra's hands on her. "It's...different down here."
Chandra stepped back to give her space.
Nissa stood at the center of the intersection and tried to listen—to feel—to awaken herself to the breath of air moving around her, the earth beneath and above and around her, the flow of aether, the ley lines, the magic suffusing it all. But no breath of wind was moving, the merest motes of aether hung motionless in the air, and the earth refused to yield its secrets.
"Pipelines," Chandra blurted. "They'll need refined aether in their little secret hideout or prison or whatever it is down here. Are there pipelines?"
"Yes," Nissa said, and she focused her attention on the distinctive feel of refined aether, a concentrated stream just above the tunnels. "That way," she said, pointing in the direction of the flow—the passage to the left.
Chandra took off down that passage, leaving Nissa and Mrs. Pashiri to straggle after her until they caught up at the next intersection...#emph[Wait.]
"Chandra, back here!" Nissa called. The pipeline had changed course, made a sudden right turn, but there was no tunnel following its course. Just bare stone wall—
"Yes," she said aloud. The tunnel walls were all stone, but decorated with the intricate swoops and whorls common to all the architecture she'd seen in the city. Pillars—probably just decorative, rather than load-bearing—emerged from the walls like bas-relief at even intervals along the length of the tunnel, and swirling filigree extended out from each one and linked to the next, forming decorative arches, with bare stone below.
Was it a coincidence that the pipeline bent right over one of those archways?
"What?" Chandra said. She had doubled back to where Nissa and <NAME> stood and was simultaneously drumming her fingers and tapping her foot—actually creating an interesting rhythm, Nissa noticed, whether she was aware of it or not.
"Could there be a hidden door here?" Nissa said, pointing to the wall.
Chandra stepped over and pressed her palms against the wall—and stumbled forward, disappearing through the stone as if it were a wall of water. Or an illusion.
She stuck her head back out, giving the gruesome impression of a head mounted on the wall as a trophy.
"No hidden door," she said. "But no wall either. Come on!"
#v(0.35em)
#line(length: 100%, stroke: rgb(90%, 90%, 90%))
#v(0.35em)
The tunnel network was utterly transformed. Instead of seemingly abandoned access tunnels, they found themselves moving through clean, well-maintained, and well-lit passages of more recent construction. Doors were spaced along the length of the halls, most of them ajar and revealing what looked like the offices of bureaucrats—eerily similar to Jace's paper-crowded office on Ravnica.
Who could work in an office down here? Nissa wondered.
There could be no question now that they were on the right track, and Nissa expected at any moment to find a prison compound filled with angry police guards. But there could be no turning back. She led them on through every intersection, following the path of the aether pipes. Soon they reached a juncture where an aether pipe came down from the ceiling, arced gracefully around the side of the passage, and disappeared below their feet.
"We must be close," Nissa said. "Other pipelines are converging right around here...all around us, actually."
"Uh, Nissa?" Chandra said.
Nissa looked up and saw armored figures closing in on them from every side, the blue glow from the aether pipeline glimmering on metal armor and drawn blades.
#figure(image("006_Bottled Up/08.jpg", width: 100%), caption: [Art by <NAME>], supplement: none, numbering: none)
One of the figures reached up and pulled off a filigree mask that covered his face. Nissa saw his incandescent blue eyes first, like windows into some light-filled eternity. They were surrounded by badly scarred skin that seemed almost as blue as his eyes in the weird glow.
Chandra erupted into a raging bonfire, and a firestorm swept down the tunnel toward the scarred man—giving a pretty clear picture of how he might have acquired those scars. But the flames vanished as they reached him, and Nissa saw the last tongues of fire as they were suctioned into the man's hand—presumably swallowed by some aether-powered device on his arm.
"Not this time, Pyromancer," he said. He reached to the wall and manipulated something, and just as Chandra began her charge toward him, she slammed into a wall that shot up from the floor.
#emph[Trapped!] Nissa heard her own pulse pounding.
Similar walls now enclosed them on every side, forming a tiny chamber that appeared to be tightly sealed. One side held what looked like a door, including a thick pane of glass—surrounded, of course, by ornate filigree.
#emph[Even death here is beautiful. ] The strange thought flitted through Nissa's mind.
Chandra slammed her fist against the door, making a blast of orange flame that was instantly transformed into shimmering blue sparks, scattering harmlessly away. She pressed her face to the glass and shouted, "Baral!"
#emph[So this is Baral] , Nissa thought.
She stepped back in surprise when the man's face appeared on the other side of the window. Nissa could better see his scars—half his nose, one cheek, and his forehead were all knotted with the characteristic scars left by terrible burns. Contempt curled his brow and twisted his mouth.
"Pyromancer." He spat the word, barely audible through the thick door. "Baan said you were back. I couldn't believe it. I don't know how you escaped me last time, or where you've been hiding all these years, but it won't happen again."
Chandra threw herself against the door again, pounding at the glass with both flame-wreathed fists, producing only more blue sparks—some form of counterspell magic, Nissa reasoned. "I'll kill you!" Chandra yelled. "You bastard!"
Baral didn't flinch at the outburst. "You're pathetic, little Nalaar. A pathetic freak of nature."
Nissa doubted that Baral could notice, but she saw it—his words cut Chandra, hit some sore spot from her childhood. She stepped closer to support Chandra and returned Baral's glare.
"I kicked your ass when I was just a kid!" Chandra screamed. "Wait'll you see what I can do now!"
"Burn all you like. You'll die more quickly if you burn up the air. Your friends, too."
Chandra threw a wild-eyed, helpless look over her shoulder at Nissa. Her pain and rage were so fierce, so #emph[hot,] that part of Nissa wanted to back away, but her hand reached out and her palm rested on Chandra's back—just as Mrs. Pashiri had done.
A channel opened between them, and Nissa felt Chandra's fire surging deep in her soul. She pulled her hand away and took a step back.
"Quickly or slowly," Baral continued, "you will die here. I've been waiting a long time for this, Pyromancer." He turned away, lifting his mask back into place and taking a few steps back the way he had come.
"Wait!" Chandra shouted. "My mom. Let her go. Your grudge is against me. Nissa, Mrs. Pashiri, you can let them go too. Kill me, just me."
Baral did not turn back around, and his voice was barely audible. "No."
Chandra roared, all words banished from her mind, and a wave of fire erupted from her body and crashed against the door. Like the sea washing against the great dam of Sea Gate, it sent up a great spray of blue sparks and then turned back on her.
#figure(image("006_Bottled Up/09.jpg", width: 100%), caption: [Chandra Ablaze | Art by <NAME>], supplement: none, numbering: none)
Nissa dove away, throwing her cloak over Mrs. Pashiri and trying to shield the older woman with her body as much as she could. The heat slammed into her back, knocking her to the ground, but it passed in an instant. She rolled onto her back to smother any fires that might have kindled in her cloak, then sat up.
Mrs. Pashiri seemed unharmed. Chandra was on her knees, shoulders slumped and head hanging, all her fire doused.
#emph[My turn,] Nissa thought.
She walked past Chandra and rested her hands on the door. Air-tight—she could feel that right away. And it wasn't just fire-quenching magic that hampered Chandra's spells, it was the twisted enchantment of a counterspell, apparently worked into the substance of the door.
Not the door, then.
She sank to one knee and touched the ground, stretching out her awareness, looking for roots and tendrils that could break through the floor in answer to her call. The smallest sapling, given time, could shatter concrete—and under her guiding hand, the time required for a plant to wrest the door from its hinges would be next to nothing.
"What's that smell?" Mrs. Pashiri asked.
Chandra poked her shoulder. "Nissa, look."
Nissa turned and let her gaze follow Chandra's pointing finger to the top of the wall. A fine grate, one of several set at intervals around the room, was emitting tiny cascades of greenish vapor that vanished from sight as it dispersed. She smelled it now, too—acrid and nauseating, an utterly unnatural chemical smell. "Poison," she said. "He means for us to suffocate more quickly after all."
Chandra slumped back to the floor, hugging her knees to her chest.
"It's all right," Nissa said, returning to her position kneeling by the door. "I'll have us out..."
But it wasn't working. The floor was imbued with the same dampening magic as the door and walls. She couldn't extend her senses, her will, her call into the earth. Nothing living grew within her reach.
The tightness in her chest returned. Being caught like an animal in a hunter's trap was bad enough. But only once before had she felt so utterly alone, so cut off from the life and soul of the world around her: when the demon <NAME> had disrupted the ley lines on Zendikar and torn Ashaya from her.
She sat down, leaning back on the door, gulping the air as she tried to calm her racing pulse.
"It's getting harder to breathe," Chandra said quietly.
Nissa met her gaze. "I don't know what to do," she said.
"Jace would have a plan." Chandra tried to force a smile, but it died on her lips.
"That...Baral? He's built quite a trap for us. Canceling our spells sending them back at us..."
"He's built his career on persecuting people like Chandra," Mrs. Pashiri said. "It stands to reason he would trap his lair to protect himself from retaliation."
"Gideon would probably just beat the door down," Chandra said. "It'd probably break before he did."
Nissa shook her head. "I'm completely cut off, Chandra. I can't reach even the nearest plants. I can't call up an elemental. I don't know what to do."
"Maybe Liliana will show up and save us. Like she did on Innistrad."
Chandra's despair was so plain on her face that Nissa wanted to embrace her and hold her to her chest. Even if it meant being caught up in the fire of Chandra's turmoil, even if it meant burning up...
Of course.
"Try something with me," she said, getting to her feet and holding a hand out to help Chandra up.
Chandra took her hand and Nissa's blood ran hot. Instead of closing the floodgate, she let the fire wash through her. She felt it all—all the rage, the desperation, the turmoil of finding her mother and losing her again...and the tiniest shred of hope. And she reached deep into herself and found something to offer in return: a deep breath of calm, an openness, a taste of the soul of this plane. Chandra's eyes widened.
"Let me fuel your fire," Nissa said. "Maybe together we can overpower Baral's counterspell."
Chandra's face brightened. "It's worth a try!" she said. "That connection..."
"A focused flame," Nissa said. "Not another big wave of fire—too dangerous. Small but as hot as you can manage, right at the edge of the door. Maybe we can melt the hinges."
"Let's do it! Pump me up!"
Chandra's excitement was as palpable as the rest of her emotions. Nissa drew a deep breath, pulling in mana from the living earth around her. That worked, at least—she couldn't extend her magic #emph[out,] but at least she could draw magic #emph[in.]
Her lungs began to sting. #emph[The poison.] She coughed, loosening her grip on the mana she was holding in. "Go," she gasped.
Chandra tried a similar centering breath, accompanied by a clumsy attempt at a stance she had probably learned from the monks on Regatha. #emph[Dear Chandra,] Nissa thought. #emph[Focus is really not your thing.]
But a blaze like a dagger appeared in Chandra's hand, small and controlled. Nissa began channeling her mana toward Chandra, and the blade burned brighter and hotter until it was blinding white. Grinning, Chandra turned the blade on their prison, trying to wedge it into the seal around the door.
Blue motes flew back at Chandra like sparks from a welder, and Chandra looked like she was exerting every muscle to keep the fire blazing and physically drive it into the seal.
For just a moment, it looked like it was working—Chandra's arm moved forward...but then a blue-white light flared with a crack like a whip and Chandra staggered backward into Nissa's arms, the last flames fizzling out in her hand.
"Damn it!" she yelled. "Damn you, Baral! Damn you, Consulate! Damned Kaladesh! Why the hell did I ever come back here? Damn-damn-damn-damn-damn!" She accented each expletive by slamming her fist into the door, creating a little spray of blue sparks each time.
#figure(image("006_Bottled Up/10.jpg", width: 100%), caption: [Deadlock Trap | Art by <NAME>ville], supplement: none, numbering: none)
She turned around and sank back to the floor, looking up at Nissa, all the rage on her face melting into sadness.
"How did this all go so wrong?" she said.
"Why did you come here?" Nissa asked. "What did you expect to find?"
"Pain. I don't know. Liliana said...I don't know." She chewed on her lip for a moment. "Why'd you join the Gatewatch, Nissa?"
"What?"
"You're so connected to Zendikar, right? Why leave? Why come with us humans and deal with all our crap?"
"We're stronger together," Nissa said. "We can use that strength to help other worlds, the same way we helped Zendikar. I don't want to see another plane suffer like Zendikar did."
"Stronger together. That's what Liliana said, isn't it? I don't think that's it."
"What do you mean?"
Chandra's gaze rested on Mrs. Pashiri, who was sitting against the opposite wall, conserving her strength. "We're Planeswalkers, right? And that means it's so easy to feel alone—cut off, like you said before. It will always mean leaving our families behind. Leaving the people we love. I found my mom, and <NAME>, but I don't think I could ever stay on Kaladesh forever. We're Planeswalkers—and the Gatewatch is about #emph[not] being alone anymore."
Nissa blinked. "Being a part of something larger than ourselves..."
"No. Just being a part of #emph[something.] Together. Having a family, no matter what plane we're on." She smiled weakly. "Having friends."
#figure(image("006_Bottled Up/11.jpg", width: 100%), caption: [Zendikar Resurgent | Art by <NAME>allis], supplement: none, numbering: none)
Nissa tried to remember the last person she had called a friend. Not Ashaya, the soul of Zendikar, but a #emph[person.]
Mazik? Back before I ever left Zendikar, before—
Chandra was on her feet again, face to face with her. "It's not just saving the Multiverse. It's saving each other. Helping each other. Like you coming here...for me. Helping me find my mom."
"I've never really had that..."
Chandra put a hand on her shoulder. "It means a lot to me, Nissa. Thank you."
As Nissa tried to come up with some kind of response, Chandra walked past her and knelt beside <NAME>.
"How are you doing, <NAME>?"
"I'm all right, child."
"You don't look all right." She looked up at Nissa, her forehead creased with worry. "You should go."
"What?"
"We're Planeswalkers, duh. You should just leave."
"What about you?"
Chandra smiled as tears welled in her eyes, and she shook her head. "I'm going to stay here with <NAME>. I think Mom would want that."
"Nonsense, child," <NAME> said. "If you have some way out of here, even if you can't take me, you both should go."
"No. I can't let you die here alone."
<NAME> took both of Chandra's hands in her own. "Go, Chandra. Go. I've lived a long, full, wonderful life. I buried my own partner years ago. I'm ready."
Chandra kept shaking her head. Keeping her hold on Mrs. Pashiri's hands, she sat down beside her.
"Chandra, you should find your—your mom," Nissa said. "Save her. I'll stay here with Mrs. Pashiri."
Chandra smiled and shook her head. "You're a good friend, Nissa."
It doesn't make any sense, Nissa thought. We're Planeswalkers. We're part of the Gatewatch. We promised to help protect the Multiverse—there's so much good we can do for so many people.
But I just want to stay here.
She sat down beside Chandra and <NAME>.
With my...my friend.
|
|
https://github.com/ckunte/m-one | https://raw.githubusercontent.com/ckunte/m-one/master/inc/tsa.typ | typst | = TSA for pile welds?
During a project schedule review a year ago, citing past experience, I was asked this following:
#quote()[
_Would the design for pile fatigue warrant applying TSA to pile welds? Any delay in realising this requirement, especially late in fabrication has the potential to adversely affect project schedule._
]
Failing to comprehend, I sought clarification --- for reasons I will get-to in a minute. But first some basics --- to appreciate the complexity of this question, and the rationale behind the response I offered.
To secure steel infrastructure to seabed, steel piles are commonly used. They are rolled from steel plates in 6m--12m segments and seam-welded longitudinally. For piles requiring lengths greater than stock-rolled lengths, segment ends are welded together.
Submerged steel structures are cathodically protected to prevent them from corroding underwater, and it is common practice to extend this protection to piles either in part or in full, as site conditions demand.#footnote[This depends on the potential for electro-chemical oxidation (i.e., corrosion) below seabed, which further depends on many factors, viz., (a) soil particle size, (b) dissolved oxygen, (c) salinity, (d) pH value, (e) electrical resistance, (f) temperature, etc. The other type, i.e., microbial corrosion, is not discussed here.] The most common cost-effective method of protecting submerged infrastructure below sea surface is by welding blocks of aluminium to steel parts and let saline seawater complete the electro-chemical circuit for ion exchange. This allows aluminium blocks to deplete sacrificially in lieu of corroding steel infrastructure in-place.
Aluminium can also be used as surface coating by hot-spraying over steel substrate due to its lower melting temperature (about 660$degree$C). To be effective and long lasting, however, thermal sprayed aluminium (TSA) demands greater control over quality and climate during application.#footnote[Humidity below 80%, thickness in microns thereby making this a porous application warranting filler material to cover the porosity resulting from spray, skilled labour, especially if done by hand, temperature controlled, dust-free, contamination-free environments, and stringent surface preparation requirements, etc.]
/ What is TSA?: It is a protective coating of aluminum sprayed over a steel substrate as an alternative method against external corrosion and corrosion under insulation.
In 1981, the US Navy approved the use of TSA coatings as a standard for its ships.@dod_std_2138, @mil_std_2138a
The first commercial use of TSA coating for offshore platforms in the North Sea area was for flare booms, and in June 1984, Hutton TLP was installed in 146m water depth with tsa coatings on its tethers, risers, and flare boom. Further, on Hutton TLP, the coating was used without a corrosion allowance.@fischer_1995 Whereas for the Heidrun TLP at Haltenbanken in the Norwegian Sea, the design used TSA coating in combination with a corrosion allowance --- this was due to the prevailing regulations at the time that classified TSA as a thin film coating; therefore the splash zone corrosion allowance was provided to meet the safety precautions of the Norwegian Petroleum Directorate Rules and Regulations.
Inspection after 8-years of exposure showed that the TSA coated area on Hutton TLP remained in very good conditions. A survey carried out by Conoco in 1992@salama_thomason_1984 noted the following:
+ A predicted service life in excess of 30-years for splash zone -- achievable with a 200$mu$ TSA coating applied according the prevailing state of technology. It was assumed that no maintenance would be required.
+ The excellent mechanical and adhesion properties prevent TSA coating from being scraped-off during handling and service (e.g., high pressure water jetting (27.4MPa) for marine fouling removal).
Within Shell group, the greatest use of tsa is known to be for Troll platform topsides (fabricated by Norske Shell, and operated by Statoil), and its associated land-based installations.
Going back to the question, my inability to grasp what was asked was simply this: what has surface coating, meant for protection against corrosion, got to do with fatigue? Upon asking I received this following feedback from engineers familiar with the case:
#quote()[_We originally specified TSA coating for the piles so that non-seawater S-N curves could be used for the fatigue analysis of the pile girth welds, etc. (Welds are exposed to seawater with no CP during driving.) In the end this requirement was waived and no TSA coating was applied._]
This was so telling that it blew my mind. It suggested that here was a team years ago trying to hack together a solution for a problem they presumably faced, but perhaps without sufficiently understanding corrosion or fatigue (as a phenomenon) or TSA (as a potential solution).
Let's dive into understanding the problem to see if this was a credible threat first, and then discuss if the solution considered was appropriate.
Corrosion fatigue is a long term phenomenon, since both corrosion and fatigue are, and it is exacerbated by surface roughness and surface temperature, among other things. Metal loss from corrosion in tropical to subtropical seawater temperatures typically ranging 0.2--0.4mm/year.#footnote[Heated surfaces amplify the rate of corrosion by up to ten times.] In other words, it takes years to eventuate. Whereas pile driving in soils (other than in calcarenite) can at worst take a couple of months to complete. The metal loss at the end of, say, three months can at worst be 0.1mm.
```python
# Corrosion rate
r = [0.2mm/year, 0.4mm/year]
# Metal loss
mloss(t) = map((x * t) in mm, r)
# For, say, a 3-month piling campaign
mloss(3 month) => [0.05 mm, 0.1 mm]
```
Fearing lack of cathodic protection during driving, and without realising the insignificant threat to pile weld integrity from low metal loss, the team truly believed in the unsubstantiated and therefore unrealistic threat of corrosion fatigue.
Alternatively, it may be that the performance of these girth welded joints in in-line fatigue were either never comforting to begin with or that it was realised too late --- I am speculating here, since the received feedback does not say. So it is possible that corrosion fatigue was used as a justification. In other words, fatigue may have been a problem all along, just not realistically attributable to corrosion-fatigue.
It is also possible that the team was looking for S-N curves for seawater without cathodic protection, i.e., for installation case only. Most standards do not offer this, since (a) it does not make sense to offer for such a short installation duration, and (b) there is insufficient specialist data to offer usable coefficients and factors for such a case.
Either way, the team appeared to have a fatigue problem in pile girth welds, and the available stress-cycle curves were not helping in improving design life. This may have led the team to consider non-seawater S-N curves, if they could somehow insulate the joint from seawater --- the surrounding medium.
I am certain that the non-seawater S-N curves were never meant to be used this way, and that the authors of international standards would be suitably shocked if they were made aware of such a use case. But even if we consider this debatable in the vein that unusual circumstances demand unusual methods and therefore merit justification, I am here to say that there are technical reasons why this perceived solution offers neither value nor the desired outcome. To illustrate why, let me first plot S-N curves for tubular joints, since a foundation pile is essentially a tube. Here, I will use the recipe from the ISO 19902 standard @iso19902_2020, but other standards can be considered too, if required.
#figure(
image("/img/sncurves-tj.svg", width: 100%),
caption: [
S-N curves for tubular joints in air and in seawater
]
) <tj>
Comparing the two curves in @tj, it is clear that there is not a lot of value here (20--40MPa relief in hotspot stresses) to take the trouble of insulating welds from seawater. I am also here to say that TSA can never offer the sort of insulation, which the team thought it would provide, for two reasons, (a) TSA is a thin-film surface coating whose thickness rarely exceeds 150$mu$ to be effective in adhesion. By virtue of its thickness (or lack thereof) and due to the method of application (i.e., hot metal spraying), the resulting coating is not only porous, but that it requires filler material to cover these pores for it to be effective, and (b) surface roughness is an issue as mentioned earlier. (Welded surfaces are rough unless ground smooth.)
So if this solution isn't a solution at all, and fatigue concerns persisted but were realised very late, then what could be done? Well, there are at least a couple of solutions to improve fatigue life of joints. They are by (a) weld geometry improvement methods (e.g., grinding), and (b) residual stress methods (e.g., peening) with increasing effectiveness. UIT peening#footnote[UIT peening is a cold remoulding of steel / weld by applying uniform stress-relieving controlled blows over the entire welded surface with an ultrasonic hand held gun.] for example is known to improve fatigue life by a factor of four (4). See Table 16.16-1, ISO 19902@iso19902_2020, and Chapter 6 in _Fatigue Handbook_ @fh.
In summary, (a) the threat of corrosion fatigue is one of longer term, and it is unlikely to eventuate during installation, since the duration of installation is too short compared to the rate of corrosion. Once the pile is in the ground, electro-chemical oxidation is significantly reduced from continuing at the aforementioned corrosion rates --- due to limited dissolved oxygen available within the submerged soil. Piles are also CP protected once in the ground through metal to metal contact between substructure and pile(s) for which S-N curves in seawater with CP protection would be applicable; (b) a lot of data in standards is based on research and experimental results, and so using factors and coefficients, derived for one medium, for a completely different medium can have unintended consequences --- depending upon the severity of the problem; (c) attempt to insulate welded joints subsea from seawater using TSA is not a good idea, because TSA is a thin-film porous surface coating whose quality and climate control demands are very high to be effective in cost, functionality, and be schedule-friendly.
I was of course pleased that the story had a better ending, as the feedback suggests, which is that the originally-conceived method to improve fatigue performance was not implemented.
But before I conclude, let me say this following: I was conflicted for months on whether or not to write this up for the fear of sounding disrespectful, despite best efforts. I deeply respect the candid sharing, and I am indeed grateful for the causal feedback from which we as a community can learn and benefit from. This note should be read in that spirit --- of learning (and helping similarly challenged teams) to resist such temptations in future, and to help realise that there are least one or two solutions for managing fatigue,#footnote[Even if the asset is in the later stages of being fabricated.] but that TSA is not one of them.
The code to generate @tj is as follows.
#let tj_curve = read("/src/tj_curve.py")
#{linebreak();raw(tj_curve, lang: "python")}
$ - * - $ |
|
https://github.com/liketechnik/aoc2023 | https://raw.githubusercontent.com/liketechnik/aoc2023/main/README.md | markdown | Puzzles of [Advent of Code 2023](https://adventofcode.com/2023) solved using [typst](https://typst.app).
|
|
https://github.com/spherinder/ethz-infk-thesis | https://raw.githubusercontent.com/spherinder/ethz-infk-thesis/master/src/chapters/01-introduction.typ | typst | #import "../dependencies.typ": *
= Introduction
Motivate the problem. A paper is cited here @solt2024cascade
== How to Use Abbreviations
This is how to call a abbreviation such as @cpu for the first time.
After that it will look different: @cpu.
It is also call it using a different syntax: #gls("cpu").
And for plurals: #glspl("cpu").
== How to Use Glossary Entries
Glossary entries can be called the same way: @freedom or #gls("freedom").
It is also possible to call plurals: #glspl("freedom").
|
|
https://github.com/DrakeAxelrod/cvss.typ | https://raw.githubusercontent.com/DrakeAxelrod/cvss.typ/main/CHANGELOG.md | markdown | MIT License | # Changelog
## v0.1.0
### Added or Changed
- Added this changelog :)
- mvp of the typst cvss package
### Removed
- Nothing
|
https://github.com/j-mueller/typst-vegalite | https://raw.githubusercontent.com/j-mueller/typst-vegalite/main/typst-package/README.md | markdown | MIT License | # nulite
A typst plugin to generate charts using [vegalite](https://vega.github.io/vega-lite/)
## Usage
```typst
#import "@preview/nulite:0.1.0" as nulite
#nulite.render(
width: 100%,
height: 100%,
zoom: 1,
json("spec.json")
)
```

The module exports a single function, `render` with four arguments
* `width`: Width of the chart in percent of the container's width
* `height`: Height of the chart in percent of the container's height
* `zoom`: Zoom factor applied to the SVG. This mainly affects the sizing of text in relation to the graphical elements.
* `spec`: [Vegalite specification](https://vega.github.io/vega-lite/docs/spec.html)
## Compatibility
This plugin uses vegalite v5.21 and vega v5.30.
The following features of vegalite are **not supported**:
* Setting `width` and `height` in the spec. These values should be provided as arguments to `render`. If `width` or `height` are included in the spec then they will be ignored.
* Loading data with the `url` property. Attempting to do this will result in an error while trying to compile the `typst` document. All data should be provided as part of the spec itself (inline).
* Interactive charts and tooltips.
## Acknowledgements
Thanks to [lublak](https://github.com/lublak) for making the excellent [echarm](https://typst.app/universe/package/echarm) and [ctxjs](https://typst.app/universe/package/ctxjs/) packages |
https://github.com/jonathan-iksjssen/jx-style | https://raw.githubusercontent.com/jonathan-iksjssen/jx-style/main/0.2.0/jx-style.typ | typst | #import "irgot.typ": coll
#import "catppuccin.typ": *
#import "jx-date.typ": *
#let irgo(cs, val) = coll.at(cs, default: "default").at(val)
#let img(body) = [#[#body]<img>]
#let q-bg(body) = [#[#body]<t-bg>]
#let q-bgla(body) = [#[#body]<t-bgla>]
#let q-la(body) = [#[#body]<t-la>]
#let q-laac(body) = [#[#body]<t-laac>]
#let q-ac(body) = [#[#body]<t-ac>]
#let q-acda(body) = [#[#body]<t-acda>]
#let q-da(body) = [#[#body]<t-da>]
#let q-datx(body) = [#[#body]<t-datx>]
#let q-tx(body) = [#[#body]<t-tx>]
#let hl-bg(body) = [#[#body]<hl-bg>]
#let hl-bgla(body) = [#[#body]<hl-bgla>]
#let hl-la(body) = [#[#body]<hl-la>]
#let hl-laac(body) = [#[#body]<hl-laac>]
#let hl-ac(body) = [#[#body]<hl-ac>]
#let hl-acda(body) = [#[#body]<hl-acda>]
#let hl-da(body) = [#[#body]<hl-da>]
#let hl-datx(body) = [#[#body]<hl-datx>]
#let hl-tx(body) = [#[#body]<hl-tx>]
#let qhl-bg(body) = [#[#body]<qhl-bg>]
#let qhl-bgla(body) = [#[#body]<qhl-bgla>]
#let qhl-la(body) = [#[#body]<qhl-la>]
#let qhl-laac(body) = [#[#body]<qhl-laac>]
#let qhl-ac(body) = [#[#body]<qhl-ac>]
#let qhl-acda(body) = [#[#body]<qhl-acda>]
#let qhl-da(body) = [#[#body]<qhl-da>]
#let qhl-datx(body) = [#[#body]<qhl-datx>]
#let qhl-tx(body) = [#[#body]<qhl-tx>]
#let colsel(colsc: "default", value: "ac", body) = {
let colselections = (
bg: irgo(colsc, bg),
bgla: irgo(colsc, bg).mix(irgo(colsc, la)),
la: irgo(colsc, la),
laac: irgo(colsc, la).mix(irgo(colsc, ac)),
ac: irgo(colsc, ac),
acda: irgo(colsc, ac).mix(irgo(colsc, da)),
da: irgo(colsc, da),
datx: irgo(colsc, da).mix(irgo(colsc, tx)),
tx: irgo(colsc, tx),
)
set text(fill: colselections.at(value))
body
}
#let triangle = polygon.regular.with(vertices: 3)
#let pentagon = polygon.regular.with(vertices: 5)
#let hexagon = polygon.regular.with(vertices: 6)
#let heptagon = polygon.regular.with(vertices: 7)
#let octagon = polygon.regular.with(vertices: 8)
#let freaky = "𝓯𝓻𝓮𝓪𝓴𝔂";
#let cock = text(font: "Noto Sans EgyptHiero", weight: 900)[𓂸];
#let lenny = text("( ͡° ͜ʖ ͡°)");
#show "« ": "«" + sym.space.nobreak;
#show " »": sym.space.nobreak + "»";
#show "‹ ": "‹" + sym.space.nobreak;
#show " ›": sym.space.nobreak + "›";
#let signature(n: 1) = text(font: "JX-Symbols", size: 5em * n)[J]
#let big(n: 2, body) = [ #text(size: 1em * calc.pow(1.2, n))[#body] ]
#let sml(n: 2, body) = [ #text(size: 1em / calc.pow(1.2, n))[#body] ]
#let al-left(body) = [ #align(left)[#body] ]
#let al-centre(body) = [ #align(center)[#body] ]
#let al-right(body) = [ #align(right)[#body] ]
#let centre = center
#let cpf(label) = cite(label, form: "prose")
#let hr = block(line(length: 100%))
#let twinfantasy = box(image("twinfantasy.jpg", height: 1.5em, width: 1.5em))
#let solidStroke(th: 1pt, c) = (paint: c, thickness: th, dash: "solid")
#let dottedStroke(th: 1pt, c) = (paint: c, thickness: th, dash: "dotted")
#let dashedStroke(th: 1pt, c) = (paint: c, thickness: th, dash: "dashed")
#let hl(back, body) = [
#box(
inset: (x: 0pt),
outset: (y: 0.45em),
stroke: (y: solidStroke(back)),
fill: none,
)[
#box(
inset: (x: 0.33em),
outset: (y: 0.3em),
fill: back,
)[#text()[#strong[#body]]]
]
]
#let squarehl(back, body) = [
#box(
inset: (x: 0.15em),
outset: (y: 0.45em),
stroke: (solidStroke(back)),
fill: none,
)[
#box(
inset: (x: 0.33em),
outset: (y: 0.35em, x: 0.05em),
fill: back,
)[#text()[#strong[#body]]]
]
]
#let callout(
title: "",
body: "",
width: 200% / 3,
alignment: center,
) = [
#align(alignment)[#block(width: width)[
#stack(
dir: ttb,
spacing: 0in,
if (title != "") {
[#[#title]<cct-tx>]
},
if (body != "") {
[#[#body]<ccb-bgla>]
},
)
]]
]
#let docu(
docutype: "blankhead", // DETERMINES WHAT KIND OF DOCUMENT IT WILL BE. CHECK THE VARIABLE validDocTypes A BIT BELOW.
author: "", // AUTHOR. CAN EITHER BE A STRING OR AN ARRAY. NOT USED FOR PAPERS.
// // ALL FIELDS BEGINNING WITH rp- ARE ONLY USED IN PAPERS (i.e. docutypes "paper" and "businessPlan")
rp-title: "", // PAPER TITLE.
rp-authors: (), // PAPER AUTHORS. IS AN ARRAY.
rp-school: "", // PAPER SCHOOL.
rp-submittedTo: "", // PAPER SUBMITTED TO THIS PERSON.
rp-keywords: (), // PAPER KEYWORDS. FOR FUTURE USE. STILL GONNA USE THIS STYLEFILE IN COLLEGE.
rp-subtitle: [], // EXTRA PAPER SUBTITLES SHOULD THE FORMAT DEMAND IT.
rp-supplement: [],
rp-supplement2: [],
rp-header: [], // PAPER HEADER.
rp-subject: [], // PAPER SUBJECT.
// // FIELDS EXCLUSIVE TO "schooldoc" OR "notes" DOCUTYPES
section: "", // SECTION. HIDDEN BY DEFAULT UNLESS FLAG "showsection" is set
subject: "", // SUBJECT THE DOCUMENT IS FOR. ONLY SHOWS UP IN DOCUTYPES "notes" AND "schooldoc".
cod: "", // JXC-10 ASSIGNMENT OR DOCUMENT CODE.
// // FIELDS EXCLUSIVE TO "writing" and "writingVerbose" DOCUTYPES
rating: "", // RATING OF DOCUMENT OR ARTICLE.
tags: (), // TAGS OF ARTICLE.
title: "", // TITLE OF DOCUMENT.
subtitle: "", // SUBTITLE OF DOCUMENT.
description: "", // DOCUMENT DESCRIPTION.
// // DOCUMENT SETTINGS
colsc: "default", // COLOUR SCHEME OF THE DOCUMENT. SEE irgot.typ
bgtint: none, // TINT ON BACKGROUND COLOUR. SEE DECLARATION OF VARIABLE bg IN SECTION « COLOUR DEFS »
size: "print", // PAGE SIZE PRESET. SEE SECTION « PAGE ».
date: datetime.today().display("[day padding:none] [month repr:short]. [year repr:full]"), // DATE TO DISPLAY IN THE DOCUMENNT. DEFAULTS TO THE CURRENT DAY.
doc-columns: 1, // NUMBER OF COLUMNS FOR THE DOCUMENT CONTENT.
outcols: 1, // NUMBER OF COLUMNS FOR THE TABLE OF CONTENTS.
imagewidth: 2/3, // WIDTH OF IMAGES.
// // HEADINGS
headingstyle: "block", // HEADING STYLE. ONE OF ("book", "block", "lines", "simple", "old").
headingnum: "1.1.1", // HEADING NUMBERING STYLE. SEE TYPST'S NUMBERING FUNCTION.
headingprefix: "", // TEXT TO PREPEND ALL HEADINGS WITH.
headingsup: "Section", // NAME FOR EACH HEADING.
refsup: "§", // SUPPLEMENT FOR REFERENCES. ONLY APPLIES WHEN FLAG "refsups" IS SET
// // TEXT AND FONT
font: "Iosevka SS14", // FONT FOR THE DOCUMENT.
font2: "", // SECONDARY FONT FOR HEADINGS. NOT YET IMPLEMENTED
fw: "regular", // FONT WEIGHT FOR THE DOCUMENT.
fz: 12pt, // FONT SIZE FOR THE DOCUMENT
rawsize: 0.9, // SIZE MULTIPLIER FOR raw() TEXT.
mathscale: 1, // SCALE OF MATH TEXT.
linespacing: 1, // SPACING BETWEEN EACH LINE.
flags: (), // FLAGS. SEE flags-documentation.md FOR DETAILS.
debug: false,
body,
) = {
// TYPE CHECKING --- TYPE CHECKING --- TYPE CHECKING --- TYPE CHECKING --- TYPE CHECKING --- TYPE CHECKING --- TYPE CHECKING ---
let doctype = docutype
let code = raw(cod)
let validDoctypes = (
"blankhead", // 0
"schooldoc", // 1
"notes", // 2
"paper", // 3
"article", // 4
"articleVerbose", // 5
"writing", // 6
"writingVerbose", // 7
"diaryEntry", // 8
"businessPlan", // 9
)
if (type(docutype) == int) {
doctype = validDoctypes.at(docutype)
}
if (type(docutype) not in (str, int)) {
panic("Field `docutype` must be a string or an integer!")
}
if (type(docutype) not in (str, int) and doctype not in validDoctypes) {
panic("Invalid doctype!")
}
if (type(author) != str and type(author) != array) {
panic("Field `author` must be a string or an array!")
}
if (docutype == "notes") {
title = subject + ": Notes"
headingstyle = "book"
flags.push("ampersand")
flags.push("separate-outline")
flags.push("separate-bib")
flags.push("hl-outlined-h1")
}
// COLOUR DEFS --- COLOUR DEFS --- COLOUR DEFS --- COLOUR DEFS --- COLOUR DEFS --- COLOUR DEFS --- COLOUR DEFS --- COLOUR DEFS ---
let bg = if (bgtint == "pine") {
color.mix((coll.at(colsc, default: "default").at("bg"), 33%), (rgb("#EFEBE9"), 67%))
} else if (bgtint == "grey") {
coll.at(colsc, default: "default").at("bg").desaturate(100%)
} else {
coll.at(colsc, default: "default").at("bg")
} // BG; 50
let la = coll.at(colsc, default: "default").at("la") // lightAccent; 200
let ac = coll.at(colsc, default: "default").at("ac") // Accent; 600
let da = coll.at(colsc, default: "default").at("da") // darkAccent; 800
let tx = coll.at(colsc, default: "default").at("tx") // Text; 950
let bgla = color.mix(bg, la)
let laac = color.mix(la, ac)
let acda = color.mix(ac, da)
let datx = color.mix(da, tx)
let fill-bg = arguments(fill: bg)
let fill-bgla = arguments(fill: bgla)
let fill-la = arguments(fill: la)
let fill-laac = arguments(fill: laac)
let fill-ac = arguments(fill: ac)
let fill-acda = arguments(fill: acda)
let fill-da = arguments(fill: da)
let fill-datx = arguments(fill: datx)
let fill-tx = arguments(fill: tx)
// TEXT --- TEXT --- TEXT --- TEXT --- TEXT --- TEXT --- TEXT --- TEXT --- TEXT --- TEXT --- TEXT --- TEXT ---
set text(
font: font,
size: fz,
weight: fw,
fill: tx,
hyphenate: false,
lang: "en",
region: "ph",
number-width: "tabular",
number-type: if (flags.contains("oldnum")) {
"old-style"
} else {
auto
},
slashed-zero: if (flags.contains("zero")) {
true
} else {
false
},
features: if (font.contains("Inter")) {
("case", "tnum", "zero", "cv01", "cv02", "cv05", "cv08", "cv12", "cv13", "cpsp")
} else if (font.contains("Andika")) {
("ss01",)
} else {
()
},
tracking: if (font.contains("Iosevka Aile") or font.contains("Iosevka Etoile")) {
-0.5pt
} else {
0pt
},
spacing: if (font.contains("Iosevka Aile") or font.contains("Iosevka Etoile")) {
300% / 5
} else {
100%
},
)
show raw: set text(font: "Iosevka SS14", size: 1.25em)
show raw.where(block: false): b => box(
fill: la.transparentize(80%),
radius: 0.25em,
inset: (x: 0.25em),
outset: (y: 0.3em),
stroke: solidStroke(laac.transparentize(50%)),
)[#text(size: 1em * rawsize)[#b]]
show raw.where(block: true): it => {
set text(size: 1em * rawsize)
show raw.line: it => {
let color = if calc.odd(it.number) {
color.mix(bg, bgla)
} else {
bg
}
let body = if it.body == [] {
sym.space
} else {
it.body
}
let num = it.number
box(
fill: color,
width: 100%,
outset: par.leading / 2,
grid(
columns: (2em, 1fr),
align: (horizon + right, left),
inset: (y: 0em, x: 0.5em),
sml(n: 1.25, q-laac(str(num))), body,
),
)
}
block(breakable: true)[#it #place(top + right)[#q-ac[[#it.lang]]]]
}
show raw.where(block: true): hi => al-centre(
block(
stroke: dottedStroke(th: 1pt, ac),
outset: (par.leading / 2) + 0.5pt,
radius: 0.25em,
spacing: 2em,
width: if (flags.contains("reduced-codeblocks")) {
200% / 3
} else {
95%
},
hi,
),
)
set par(justify: true, leading: linespacing * 0.9em)
show par: set block(spacing: 2em)
set math.equation(numbering: "(1.1.1)")
show math.equation: m => if (font.contains("Fira")) {
text(font: "Fira Math")[#m]
} else if (font.contains("Noto Sans") or font.contains("Noto Mono")) {
text(font: "Noto Sans Math")[#m]
} else {
text(font: "TeX <NAME> Math")[#m]
}
show math.equation.where(block: false): set text(size: 1em)
show math.equation.where(block: true): me => [#set text(size: 1.5em * mathscale); #align(center)[#me]]
show link: set text(..fill-ac)
// OUTLINES --- OUTLINES --- OUTLINES --- OUTLINES --- OUTLINES --- OUTLINES --- OUTLINES --- OUTLINES ---
let headingPrefixDisplay = if (headingprefix == "") {
none
} else {
headingprefix + sym.space
}
set outline(
depth: 3,
indent: 2em,
title: if (doctype in ("businessPlan", "paper")) {
none
} else {
"Table of Contents"
},
fill: if (flags.contains("narrow-outline-fills")) {
repeat[.#sym.space#sym.zwnj]
} else {
repeat[#sym.space#sym.zwnj.#sym.space#sym.zwnj]
},
)
show outline.entry.where(level: 1): ol => if (flags.contains("hl-outlined-h1")) {
box(outset: par.leading / 2, fill: bgla, strong(ol))
} else {
strong[#headingPrefixDisplay#ol]
}
show outline.entry.where(level: 2): ol => q-da(headingPrefixDisplay + ol)
show outline.entry.where(level: 3): ol => q-ac(headingPrefixDisplay + ol)
show outline: a => if (doctype in ("businessPlan", "paper")) {
show heading: he => {
h(1fr) + hl-tx[#he.body] + h(1fr)
v(-0.5em)
}
[#page(columns: outcols)[ #align(horizon + center)[#block(width: 200% / 3, a)]~] ]
} else {
show heading: he => text(1em / 1.167)[#al-centre[#[#he.body]<cct-datx>]]
if (flags.contains("separate-outline")) {
align(horizon + center, columns(outcols)[#a])
pagebreak(weak: true)
} else {
a
}
}
// BLOCKQUOTES --- BLOCKQUOTES --- BLOCKQUOTES --- BLOCKQUOTES --- BLOCKQUOTES --- BLOCKQUOTES --- BLOCKQUOTES --- BLOCKQUOTES ---
set quote(block: true)
show quote: q => [
#pad(1em)[
#block(breakable: false, fill: color.mix(bg, bgla), inset: (x: 2em, y: 2.5em))[
#place(
top + left,
dx: -1.5em,
dy: -2em,
)[#text(fill: laac, size: 2em, weight: 1000, style: "italic")[«]]
#place(
bottom + right,
dx: 1.5em,
dy: 2em,
)[#text(fill: laac, size: 2em, weight: 1000, style: "italic")[»]]
#[#emph[#q.body]] #linebreak()
#h(1fr) — #q.attribution
]
]
]
// LISTS AND ENUMS --- LISTS AND ENUMS --- LISTS AND ENUMS --- LISTS AND ENUMS --- LISTS AND ENUMS --- LISTS AND ENUMS --- LISTS AND ENUMS ---
set enum(
numbering: (..nums) => [#strong[#numbering("1.1.1.", ..nums)]],
full: if (flags.contains("fullenums")) {
true
} else {
false
},
tight: false,
)
set list(
tight: false,
marker: ([#sym.circle.filled.tiny], [#sym.circle.stroked.small], [#sym.triangle.filled.small.r], [#sym.triangle.stroked.small.r]),
)
set terms(tight: false)
show terms.item: k => block(inset: (y: 0.167em))[- #[#k.term]<hl-la> #emph(k.description)]
// PAGE --- PAGE --- PAGE --- PAGE --- PAGE --- PAGE --- PAGE --- PAGE --- PAGE --- PAGE --- PAGE ---
set document(
title: if (title == "") { } else {
if (cod != "") {
code
sym.space
"-"
sym.space
}
title
},
author: if (type(author) == str) {
author
} else if type(author) == array {
(..author,).join("; ")
},
date: datetime.today(),
keywords: rp-keywords,
)
set page(
fill: bg,
//DEFAULT PAGE SIZE: 8.5in x 11in, 0.5in margin on all sides
width: if (size == "longbond") { 8.5in
} else if (size == "longbond-l") { 13in
} else if (size == "print-l") { 11in
} else if (size == "phone") { 7in
} else if (size == "notebook") { 5.5in
} else if (size == "tablet") { 10in
} else if (size == "pc") { 12in
} else if (size == "a4") { 210mm
} else if (size == "longlong") { 14in
} else if (size == "book-a") { 5.75in
} else if (size == "book-b") { 7.5in
} else if (size == "square") { 8in
} else if (size == "auto") { 6in
} else { 8.5in },
height: if (size == "longbond") { 13in
} else if (size == "longbond-l") { 8.5in
} else if (size == "print-l") { 8.5in
} else if (size == "phone") { 14in
} else if (size == "notebook") { 7.5in
} else if (size == "tablet") { 6in
} else if (size == "pc") { 7.5in
} else if (size == "a4" ) { 297mm
} else if (size == "longlong") { 8in
} else if (size == "book-a") { 9in
} else if (size == "book-b") { 10.25in
} else if (size == "square") { 8in
} else if (size == "auto") { auto
} else { 11in },
margin: (
y: 0.75in,
rest: if(flags.contains("shineformat")){1in}else{0.5in},
bottom: if (flags.contains("nofoot")) { 0.75in } else { 1in },
top: if (rp-header == []) { 0.75in } else { 1in },
),
header: [
#if(rp-header != []){[ #rp-header #h(1fr) #rp-subject #v(-1em)]};
#line(length: 100%, stroke: dashedStroke(tx.transparentize(50%)))
],
footer: [
#line(length: 100%, stroke: dashedStroke(tx.transparentize(50%)));
#v(-1em)
#if (flags.contains("nofoot")) {} else [
#if(flags.contains("blankfoot")) {} else [
#if (cod != "") { code } else {}
#if (rp-title != "" and not flags.contains("centrefoot")) { emph[#rp-title] } else if (title != "" and not flags.contains("centrefoot")) { emph[#title] }
] #h(1fr) #strong[#counter(page).display()]#if(flags.contains("centrefoot")){h(1fr)}
]
],
columns: doc-columns,
)
// #region HEADINGS
// HEADINGS --- HEADINGS --- HEADINGS --- HEADINGS --- HEADINGS --- HEADINGS --- HEADINGS --- HEADINGS ---
let headingPrefixDisplay = if (headingprefix == "") {
none
} else {
headingprefix + sym.space
}
set heading(numbering: (..nums) => if (doctype == "businessPlan") {
let format = ("I.", "A.", "1.", "I.", "A.", "1.").at(nums.pos().len() - 1)
numbering(format, nums.pos().last())
} else {
numbering(headingnum, ..nums)
})
set heading(supplement: headingsup)
// -- HEADING 1 -- HEADING 1 -- HEADING 1 -- HEADING 1 --
show heading.where(level: 1): hy => if (headingstyle == "block") {
[
// -- H1 BLOCK STYLE
#set text(size: 1.25em, fill: bg, weight: "bold")
#block(
width: 100%,
fill: none,
stroke: (y: solidStroke(th: 2pt, tx)),
inset: (y: 3pt),
)[
#grid(
columns: (auto, 1fr),
inset: (x: 0.5em, y: 0.33em),
grid.cell(fill: tx, align: left)[#headingPrefixDisplay#counter(heading).display()],
grid.cell(fill: datx)[#hy.body],
)
]
]
} else if (headingstyle == "simple") {
[
// -- H1 SIMPLE STYLE
#set text(size: 1.25em, fill: tx, weight: "bold")
#block(
width: 100%,
fill: none,
stroke: (bottom: solidStroke(th: 2pt, tx)),
inset: (y: 3pt),
)[
#grid(
columns: (auto, 1fr),
inset: (x: 0.5em, y: 0.33em),
grid.cell(align: left)[#headingPrefixDisplay#counter(heading).display()],
grid.cell()[#hy.body],
)
]
]
} else if (headingstyle == "old") {
[
// -- H1 OLD STYLE
#set text(size: 1.25em, fill: bg, weight: "bold")
#block(width: 100%, fill: tx, inset: 0.33em)[ #align(center)[#hy] ]
]
} else if (headingstyle == "lines") {
[
#set text(size: 1.25em, fill: bg, weight: "bold")
#block(
width: 100%,
fill: none,
stroke: (y: solidStroke(th: 2pt, tx)),
inset: (y: 3pt),
)[
#block(..fill-tx, inset: (y: 0.33em), width: 100%)[
#align(center)[#hy]
]
]
]
} else if (headingstyle == "book") {
[
#pagebreak(weak: true)
#set block(breakable: false)
#block(
width: 100%,
height: auto,
inset: (top: 0em),
)[
#set par(leading: 0.5em)
#align(top)[
#block(
stroke: (y: solidStroke(th: 2pt, ac)),
width: 100%,
inset: (y: 4pt),
height: auto,
)[#block(
stroke: (y: solidStroke(th: 2pt, datx)),
width: 100%,
inset: (
y: 0.66em,
left: if (flags.contains("no-h1-indent")) {
0em
} else {
0.25em
},
),
height: auto,
)[
#grid(columns: (auto, auto), inset: (x: 0.5em), align: (horizon + center, horizon + left),
grid.cell(inset: (right: 1em, left: 0.75em), stroke: (right: dottedStroke(th: 2pt, ac)))[
#stack(
dir: ttb,
spacing: 0.125in * linespacing,
text(size: 1em, weight: "bold")[#hy.supplement],
text(size: 2em, weight: "bold")[#headingPrefixDisplay#counter(heading).display()],
)
],
grid.cell(inset: (left: 1em))[
#set par(justify: false)
#text(size: 1.75em, fill: tx, weight: "extrabold")[#hy.body]
]
)
// #text(size: 2em, weight: "bold")[#headingsup #counter(heading).display()]
// #v(-3.25em)
// #text(size: 1.25em, fill: ac, weight: "regular", style: "italic")[#hy.body]
]
]]
]
]
} else {
set text(1.25em)
[#hy]
}
show heading.where(level: 1): hy => if (flags.contains("centre-h1")) {
align(center, hy)
} else {
hy
}
// -- HEADING 2 -- HEADING 2 -- HEADING 2 -- HEADING 2 --
show heading.where(level: 2): hy => if (headingstyle in ("block", "book")) {
[
// -- H2 BLOCK STYLE
#set text(size: 1.167em, fill: bg, weight: "bold")
#block(
width: 100%,
fill: none,
stroke: (y: solidStroke(th: 2pt, acda)),
inset: (y: 3pt),
)[
#grid(
columns: (auto, 1fr),
inset: (x: 0.5em, y: 0.33em),
grid.cell(fill: acda, align: left)[#headingPrefixDisplay#counter(heading).display()],
grid.cell(fill: ac)[#hy.body],
)
]
]
} else if (headingstyle == "simple") {
[
// -- H2 SIMPLE STYLE
#set text(size: 1.167em, fill: da, weight: "bold")
#block(
width: 100%,
fill: none,
stroke: (bottom: solidStroke(th: 2pt, ac)),
inset: (y: 3pt),
)[
#grid(
columns: (auto, 1fr),
inset: (x: 0.5em, y: 0.33em),
grid.cell(align: left)[#headingPrefixDisplay#counter(heading).display()],
grid.cell()[#hy.body],
)
]
]
} else if (headingstyle == "old") {
[
// -- H2 OLD STYLE
#set text(size: 1.167em, fill: bg, weight: "bold")
#block(width: 100%, fill: ac, inset: 0.33em)[ #align(left)[#hy] ]
]
} else if (headingstyle == "lines") {
[
// -- H2 DEFAULT STYLE
#set text(size: 1.167em, fill: bg, weight: "bold")
#block(
width: 100%,
fill: none,
stroke: (y: solidStroke(th: 2pt, acda)),
inset: (y: 3pt),
)[
#block(..fill-ac, inset: 0.33em, width: 100%)[
#align(left)[#hy]
]
]
]
} else {
set text(1.167em)
[#hy]
}
// -- HEADING 3 -- HEADING 3 -- HEADING 3 -- HEADING 3 --
show heading.where(level: 3): hy => if (headingstyle in ("block", "book")) {
[
// -- H3 BLOCK STYLE
#set text(size: 1.083em, fill: tx, weight: "bold")
#block(
width: 100%,
fill: none,
stroke: (y: solidStroke(th: 2pt, laac)),
inset: (y: 3pt),
)[
#grid(
columns: (auto, 1fr),
inset: (x: 0.5em, y: 0.33em),
grid.cell(fill: color.mix(laac, la), align: left)[#headingPrefixDisplay#counter(heading).display()],
grid.cell(fill: la)[#hy.body],
)
]
]
} else if (headingstyle == "simple") {
[
// -- H3 SIMPLE STYLE
#set text(size: 1.083em, fill: da, weight: "bold")
#block(
width: 100%,
fill: none,
stroke: (bottom: solidStroke(th: 2pt, la)),
inset: (y: 3pt),
)[
#grid(
columns: (auto, 1fr),
inset: (x: 0.5em, y: 0.33em),
grid.cell(align: left)[#headingPrefixDisplay#counter(heading).display()],
grid.cell()[#hy.body],
)
]
]
} else if (headingstyle == "old") {
[
// -- H3 OLD STYLE
#set text(size: 1.083em, fill: tx, weight: "bold")
#block(width: 100%, fill: la, inset: 0.33em)[ #align(left)[#hy] ]
]
} else if (headingstyle == "lines") {
[
// -- H3 DEFAULT STYLE
#set text(size: 1.083em, fill: tx, weight: "bold")
#block(
width: 100%,
fill: none,
stroke: (y: solidStroke(th: 2pt, laac)),
inset: (y: 3pt),
)[
#block(..fill-la, inset: 0.33em, width: 100%)[
#align(left)[#hy]
]
]
]
} else {
set text(1.083em)
[#hy]
}
// -- HEADING 4 -- HEADING 4 -- HEADING 4 -- HEADING 4 --
show heading.where(level: 4): hy => if (headingstyle in ("block", "book")) {
parbreak()
box[
// -- H4 BLOCK STYLE
#set text(size: 1em, fill: bg, weight: "bold")
#box(
inset: (right: 0.15em),
outset: (y: 0.4em),
stroke: (left: none, rest: solidStroke(da)),
fill: none,
)[
#stack(
dir: ltr,
spacing: 0in,
box(
inset: (x: 0.5em),
outset: (y: 0.25em),
fill: datx,
)[#[#[#headingPrefixDisplay#counter(heading).display()]]],
box(inset: (x: 0.5em), outset: (y: 0.25em), fill: da)[#[#[#hy.body]]],
)
]
]
h(0.5em)
} else if (headingstyle == "simple") {
[
// -- H4 SIMPLE STYLE
#set text(size: 1em, fill: tx, weight: "bold")
#box(
inset: (y: 0.33em),
stroke: (bottom: solidStroke(tx)),
)[#headingPrefixDisplay#counter(heading).display() #h(0.5em) #hy.body]
]
} else if (headingstyle == "old") {
[
// -- H4 OLD STYLE
#set text(size: 1em, fill: bg, weight: "bold")
#box(..fill-da, inset: (x: 0.33em), outset: (y: 0.33em))[
#[#hy]
]
]
} else if (headingstyle == "lines") {
[
// -- H4 LINES STYLE
#set text(size: 1em, fill: bg, weight: "bold")
#box(
inset: (x: 0pt),
outset: (y: 0.4em),
stroke: (y: solidStroke(da)),
fill: none,
)[
#box(inset: (x: 0.5em), outset: (y: 0.25em), fill: da)[#[#[#hy]]]
]
]
} else {
[#hy]
}
// -- HEADING 5 -- HEADING 5 -- HEADING 5 -- HEADING 5 --
show heading.where(level: 5): hy => if (headingstyle in ("block", "book")) {
parbreak()
box[
// -- H5 BLOCK STYLE
#set text(size: 1em, fill: bg, weight: "bold")
#box(
inset: (right: 0.15em),
outset: (y: 0.4em),
stroke: (left: none, rest: solidStroke(acda)),
fill: none,
)[
#stack(
dir: ltr,
spacing: 0in,
box(
inset: (x: 0.5em),
outset: (y: 0.25em),
fill: acda,
)[#[#[#headingPrefixDisplay#counter(heading).display()]]],
box(inset: (x: 0.5em), outset: (y: 0.25em), fill: ac)[#[#[#hy.body]]],
)
]
]
h(0.5em)
} else if (headingstyle == "simple") {
[
// -- H5 SIMPLE STYLE
#set text(size: 1em, fill: da, weight: "bold")
#box(
inset: (y: 0.33em),
stroke: (bottom: solidStroke(da)),
)[#headingPrefixDisplay#counter(heading).display() #h(0.5em) #hy.body]
]
} else if (headingstyle == "old") {
[
// -- H5 OLD STYLE
#set text(size: 1em, fill: bg, weight: "bold")
#box(..fill-ac, inset: (x: 0.33em), outset: (y: 0.33em))[
#[#hy]
]
]
} else if (headingstyle == "lines") {
[
// -- H5 LINES STYLE
#set text(size: 1em, fill: bg, weight: "bold")
#box(
inset: (x: 0pt),
outset: (y: 0.4em),
stroke: (y: solidStroke(ac)),
fill: none,
)[
#box(inset: (x: 0.5em), outset: (y: 0.25em), fill: ac)[#[#[#hy]]]
]
]
} else {
[#hy]
}
// -- HEADING 6 -- HEADING 6 -- HEADING 6 -- HEADING 6 --
show heading.where(level: 6): hy => if (headingstyle in ("block", "book")) {
parbreak()
box[
// -- H6 BLOCK STYLE
#set text(size: 1em, fill: tx, weight: "bold")
#box(
inset: (right: 0.15em),
outset: (y: 0.4em),
stroke: (left: none, rest: solidStroke(laac)),
fill: none,
)[
#stack(
dir: ltr,
spacing: 0in,
box(
inset: (x: 0.5em),
outset: (y: 0.25em),
fill: color.mix(laac, la),
)[#[#[#headingPrefixDisplay#counter(heading).display()]]],
box(inset: (x: 0.5em), outset: (y: 0.25em), fill: la)[#[#[#hy.body]]],
)
]
]
h(0.5em)
} else if (headingstyle == "simple") {
[
// -- H6 SIMPLE STYLE
#set text(size: 1em, fill: ac, weight: "bold")
#box(
inset: (y: 0.33em),
stroke: (bottom: solidStroke(acda)),
)[#headingPrefixDisplay#counter(heading).display() #h(0.5em) #hy.body]
]
} else if (headingstyle == "old") {
[
// -- H6 OLD STYLE
#set text(size: 1em, fill: da, weight: "bold")
#box(..fill-la, inset: (x: 0.33em), outset: (y: 0.33em))[
#[#hy]
]
]
} else if (headingstyle == "lines") {
[
// -- H6 LINES STYLE
#set text(size: 1em, fill: da, weight: "bold")
#box(
inset: (x: 0pt),
outset: (y: 0.4em),
stroke: (y: solidStroke(laac)),
fill: none,
)[
#box(inset: (x: 0.5em), outset: (y: 0.25em), fill: la)[#[#[#hy]]]
]
]
} else {
[#hy]
}
show heading: set block(spacing: 1em)
show heading.where(level: 1): hy => if (font2 != "") {
set text(font: font2)
hy
} else {
hy
}
// #endregion
// BIBLIOGRAPHY AND CITATIONS --- BIBLIOGRAPHY AND CITATIONS --- BIBLIOGRAPHY AND CITATIONS --- BIBLIOGRAPHYcite AND CITATIONS ---
set ref(supplement: if (flags.contains("refsups")) {
refsup
})
set cite(style: if ((doctype in ("businessPlan", "paper")) or flags.contains("use-apa")) {
"apa"
} else {
"ieee"
})
show cite: set text(..fill-ac)
show cite: a => {
if (flags.contains("use-apa") or not flags.contains("super-refs")) {
a
} else {
super(a)
}
}
set super(typographic: false, size: 0.7em)
set sub(typographic: false, size: 0.7em)
set bibliography(
style: if ((doctype in ("businessPlan", "paper")) or flags.contains("use-apa")) {
"apa"
} else {
"ieee"
},
title: "References",
full: true,
)
show bibliography: a => {
if (flags.contains("separate-bib")) {
pagebreak(weak: true)
}
show heading: h => if (headingstyle != "book") {
text(1em / 1.167)[#al-centre[#[#h.body]<cct-datx>]]
} else {
[
#pagebreak(weak: true)
#set block(breakable: false)
#block(
width: 100%,
height: auto,
inset: (top: 0em),
)[
#set par(leading: 0.5em)
#align(top)[
#block(
stroke: (y: solidStroke(th: 2pt, ac)),
width: 100%,
inset: (y: 4pt),
height: auto,
)[#block(
stroke: (y: solidStroke(th: 2pt, datx)),
width: 100%,
inset: (
y: 0.66em,
left: if (flags.contains("no-h1-indent")) {
0em
} else {
0.25em
},
),
height: auto,
)[
#grid(columns: (auto, auto), inset: (x: 0.5em), align: (horizon + center, horizon + left),
grid.cell(inset: (right: 1em), stroke: (right: dottedStroke(th: 2pt, ac)))[
#stack(
dir: ttb,
spacing: 0.125in * linespacing,
text(size: 2em, weight: "bold")[#sym.section],
)
],
grid.cell(inset: (left: 1em))[
#set par(justify: false)
#text(size: 1.75em, fill: tx, weight: "extrabold")[#h.body]
]
)
// #text(size: 2em, weight: "bold")[#headingsup #counter(heading).display()]
// #v(-3.25em)
// #text(size: 1.25em, fill: ac, weight: "regular", style: "italic")[#hy.body]
]
]]
]
]
}
a
}
let amper = if (flags.contains("ampersand")) {
" & "
} else {
" and "
}
let thornUpper = if (flags.contains("thorn")) {
"Þ"
} else {
"TH"
}
let thornMixed = if (flags.contains("thorn")) {
"Þ"
} else {
"Th"
}
let thornLower = if (flags.contains("thorn")) {
"þ"
} else {
"th"
}
show "th": thornLower
show "Th": thornMixed
show "TH": thornUpper
show " and ": amper
// IMAGES --- IMAGES --- IMAGES --- IMAGES --- IMAGES --- IMAGES --- IMAGES ---
set image(fit: "contain", width: 100%)
show <img>: h => align(center)[#rect(stroke: dottedStroke(th: 2pt, ac), inset: 0in, outset: 0in, fill: none, width: (imagewidth * 100%))[#h]]
// TABLES AND FIGURES --- TABLES AND FIGURES --- TABLES AND FIGURES --- TABLES AND FIGURES --- TABLES AND FIGURES --- TABLES AND FIGURES ---
show figure: set block(spacing: 1em)
show figure.caption: emph
set figure(numbering: "1.1.1", gap: 1em)
set table(
fill: (_, y) => if (y == 0) {
tx
} else if (calc.rem(y, 2) == 0) {
bgla.mix(bg)
} else {
bg
},
stroke: none,
align: if (flags.contains("table-cen")) {
horizon + center
} else {
horizon + left
},
inset: 0.5em,
)
set grid(
inset: 0.33em,
align: if (flags.contains("table-cen")) {
horizon + center
} else {
horizon + left
},
)
show table.cell.where(y: 0): k => strong(text(..fill-bg)[#[#k]])
set grid.hline(stroke: solidStroke(tx))
set table.hline(stroke: solidStroke(tx))
set grid.vline(stroke: solidStroke(tx))
set table.vline(stroke: solidStroke(tx))
set rect(stroke: solidStroke(tx))
set circle(stroke: solidStroke(tx))
set ellipse(stroke: solidStroke(tx))
set square(stroke: solidStroke(tx))
set polygon(stroke: solidStroke(tx))
set path(stroke: solidStroke(tx))
set line(stroke: solidStroke(tx))
// CUSTOM HIGHLIGHTS --- CUSTOM HIGHLIGHTS --- CUSTOM HIGHLIGHTS --- CUSTOM HIGHLIGHTS --- CUSTOM HIGHLIGHTS --- CUSTOM HIGHLIGHTS --- CUSTOM HIGHLIGHTS --- CUSTOM HIGHLIGHTS ---
let customhl(back, fore, body) = [
#box(
inset: (x: 0pt),
outset: (y: 0.45em),
stroke: (y: solidStroke(back)),
fill: none,
)[
#box(
inset: (x: 0.33em),
outset: (y: 0.3em),
fill: back,
)[#text(fill: fore)[#strong[#body]]]
]
]
let squarehl(back, fore, body) = [
#box(
inset: (x: 0.15em),
outset: (y: 0.45em),
stroke: (solidStroke(back)),
fill: none,
)[
#box(
inset: (x: 0.33em),
outset: (y: 0.35em, x: 0.05em),
fill: back,
)[#text(fill: fore)[#strong[#body]]]
]
]
show <hl-tx>: body => customhl(tx, bg, body)
show <hl-datx>: body => customhl(datx, bg, body)
show <hl-da>: body => customhl(da, bg, body)
show <hl-da2>: body => customhl(da, la, body)
show <hl-acda>: body => customhl(acda, bg, body)
show <hl-ac>: body => customhl(ac, bg, body)
show <hl-laac>: body => customhl(laac, tx, body)
show <hl-la>: body => customhl(la, tx, body)
show <hl-la2>: body => customhl(la, da, body)
show <hl-bgla>: body => customhl(bgla, tx, body)
show <hl-bg>: body => customhl(bg, tx, body)
show <qhl-tx>: body => squarehl(tx, bg, body)
show <qhl-datx>: body => squarehl(datx, bg, body)
show <qhl-da>: body => squarehl(da, bg, body)
show <qhl-da2>: body => squarehl(da, la, body)
show <qhl-acda>: body => squarehl(acda, bg, body)
show <qhl-ac>: body => squarehl(ac, bg, body)
show <qhl-laac>: body => squarehl(laac, tx, body)
show <qhl-la>: body => squarehl(la, tx, body)
show <qhl-la2>: body => squarehl(la, da, body)
show <qhl-bgla>: body => squarehl(bgla, tx, body)
show <qhl-bg>: body => squarehl(bg, tx, body)
// CALLOUTS --- CALLOUTS --- CALLOUTS --- CALLOUTS --- CALLOUTS --- CALLOUTS --- CALLOUTS --- CALLOUTS ---
let call(back, fore, body) = [
#align(center)[
#block(inset: (y: 2pt), stroke: (y: solidStroke(back)))[
#block(inset: 0.5em, fill: back)[
#text(fill: fore)[#body]
]
]
]
]
show <call-tx>: body => call(tx, bg, body)
show <call-datx>: body => call(datx, bg, body)
show <call-da>: body => call(da, bg, body)
show <call-da2>: body => call(da, la, body)
show <call-acda>: body => call(acda, bg, body)
show <call-ac>: body => call(ac, bg, body)
show <call-laac>: body => call(laac, tx, body)
show <call-la>: body => call(la, tx, body)
show <call-la2>: body => call(la, da, body)
show <call-bgla>: body => call(bgla, tx, body)
show <call-bg>: body => call(bg, tx, body)
// COMPLEX CALLOUTS --- COMPLEX CALLOUTS --- COMPLEX CALLOUTS --- COMPLEX CALLOUTS --- COMPLEX CALLOUTS --- COMPLEX CALLOUTS --- COMPLEX CALLOUTS --- COMPLEX CALLOUTS ---
let compCallTitle(back, fore, wid: 100%, body) = [
#block(inset: (y: 2pt), fill: none, stroke: (y: solidStroke(back)))[
#block(width: wid, inset: 0.67em, fill: back)[
#set text(fill: fore, size: 1.167em, weight: "bold")
#body
]
]
]
let compCallBody(back, fore, wid: 100%, body) = [
#block(inset: (2pt), fill: none, stroke: (solidStroke(back)))[
#block(width: wid, inset: 0.67em, fill: back)[
#set text(fill: fore)
#body
]
]
]
show <cct-tx>: body => compCallTitle(tx, bg, body)
show <cct-datx>: body => compCallTitle(datx, bg, body)
show <cct-da>: body => compCallTitle(da, bg, body)
show <cct-da2>: body => compCallTitle(da, la, body)
show <cct-acda>: body => compCallTitle(acda, bg, body)
show <cct-ac>: body => compCallTitle(ac, bg, body)
show <cct-laac>: body => compCallTitle(laac, tx, body)
show <cct-la>: body => compCallTitle(la, tx, body)
show <cct-la2>: body => compCallTitle(la, da, body)
show <cct-bgla>: body => compCallTitle(bgla, tx, body)
show <cct-bg>: body => compCallTitle(bg, tx, body)
show <ccb-tx>: body => compCallBody(tx, bg, body)
show <ccb-datx>: body => compCallBody(datx, bg, body)
show <ccb-da>: body => compCallBody(da, bg, body)
show <ccb-da2>: body => compCallBody(da, la, body)
show <ccb-acda>: body => compCallBody(acda, bg, body)
show <ccb-ac>: body => compCallBody(ac, bg, body)
show <ccb-laac>: body => compCallBody(laac, tx, body)
show <ccb-la>: body => compCallBody(la, tx, body)
show <ccb-la2>: body => compCallBody(la, da, body)
show <ccb-bgla>: body => compCallBody(bgla, tx, body)
show <ccb-bg>: body => compCallBody(bg, tx, body)
// TEXT FILLS --- TEXT FILLS --- TEXT FILLS --- TEXT FILLS --- TEXT FILLS --- TEXT FILLS --- TEXT FILLS --- TEXT FILLS ---
show <t-tx>: t => text(fill: tx)[#t]
show <t-datx>: t => text(fill: datx)[#t]
show <t-da>: t => text(fill: da)[#t]
show <t-acda>: t => text(fill: acda)[#t]
show <t-ac>: t => text(fill: ac)[#t]
show <t-laac>: t => text(fill: laac)[#t]
show <t-la>: t => text(fill: la)[#t]
show <t-bgla>: t => text(fill: bgla)[#t]
show <t-bg>: t => text(fill: bg)[#t]
// OTHER HIGHLIGHTS --- OTHER HIGHLIGHTS --- OTHER HIGHLIGHTS --- OTHER HIGHLIGHTS ---
show <b1>: t => text(size: 1em * calc.pow(1.3, 2))[#t]
show <b2>: t => text(size: 1em * calc.pow(1.2, 2))[#t]
show <b3>: t => text(size: 1em * calc.pow(1.1, 2))[#t]
show <s1>: t => text(size: 1em / 1.083)[#t]
show <s2>: t => text(size: 1em / 1.167)[#t]
show <s3>: t => text(size: 1em / 1.25)[#t]
// BUSINESS PLAN FORMAT --- BUSINESS PLAN FORMAT --- BUSINESS PLAN FORMAT --- BUSINESS PLAN FORMAT --- BUSINESS PLAN FORMAT --- BUSINESS PLAN FORMAT ---
let bpcoverpage() = page(
margin: 0.5in,
header: none,
footer: none,
)[
#align(center + top)[
#block(spacing: 3em)[#text(size: 2em, weight: 900)[#strong[#rp-title]]]
#block(spacing: 3em)[#text(size: 1.5em)[#strong[#rp-subtitle]]]
#block(spacing: 3em, width: 200% / 3)[#text(size: 1.5em)[#rp-supplement]]
]
#align(center + horizon)[ #rp-supplement2 ]
#align(center + bottom)[
_Submitted by:_ #linebreak()
#if (rp-authors != "") {
[
#for aut in rp-authors [
#strong[#aut.lastname], #[#aut.firstname] \
]
]
}
#linebreak()
_Submitted to:_ #linebreak()
#strong[#rp-submittedTo] #linebreak()
#date
]
]
if (doctype == "businessPlan") {
bpcoverpage()
}
// RESEARCH PAPER `rp` FORMAT --- RESEARCH PAPER `rp` FORMAT --- RESEARCH PAPER `rp` FORMAT --- RESEARCH PAPER `rp` FORMAT ---
let rpcoverpage() = page(
margin: 0.5in,
header: none,
footer: none,
columns: 1,
)[
#place(center + top)[#align(center + top)[
#strong[#rp-school] \
#emph[#rp-subject] \
#section
]]
#place(center + horizon)[#align(center + horizon)[
#if (rp-title != "") {
block(spacing: 3em)[#text(size: 3em, weight: 900)[#par(justify: false)[#strong[#rp-title]]]]
}
#if (rp-subtitle != "") {
block(spacing: 3em)[#text(size: 2em)[#rp-subtitle]]
}
#if (rp-supplement != "") {
block(spacing: 3em, width: 200% / 3)[#text(size: 1.5em)[#rp-supplement]]
}
#if (rp-supplement2 != "") {
[#block(spacing: 3em, width: 200% / 3)[#text(size: 1.5em)[#rp-supplement2]]]
}
]]
#place(center + bottom)[#align(center + bottom)[
_Submitted by:_ #linebreak()
#if (rp-authors != "") {
[
#for aut in rp-authors {
let h = aut.split(", ")
strong(h.at(0))
", "
h.at(1)
linebreak()
}
]
}
#linebreak()
_Submitted to:_ #linebreak()
#strong[#rp-submittedTo] #linebreak()
#date
]]
]
if (doctype == "paper") {
// FORMATTING FOR RESEARCH PAPER
set cite(style: "apa")
set bibliography(style: "apa", full: true)
set outline(title: none)
rpcoverpage()
}
let daterepr = [
#customhl(daycolours.at(wdn), tx, sadaveVerbose)
]
let authordisplay = if (type(author) == str) {
author
} else if (type(author) == array) {
author.join("; ")
}
let sectiondisplay = if (flags.contains("showsection")) {
emph(" — " + section)
} else {
none
}
let codedisplay = if (code != "") {
set text(size: fz / rawsize)
code
} else {
none
}
let dividerdisplay = if (flags.contains("nodivider")) { } else {
[#v(-1em)
#line(length: 100%, stroke: solidStroke(tx))]
}
let schooldocTitleDisplay = if (title != "") {
[#[#emph[#title]]<hl-ac>]
} else {
none
}
let subjectdisplay = if (subject != "") {
[#[#subject]<hl-da>]
}
// SCHOOLDOC OR NOTES FORMAT --- SCHOOLDOC OR NOTES FORMAT --- SCHOOLDOC OR NOTES FORMAT --- SCHOOLDOC OR NOTES FORMAT ---
let sdheader() = if (not flags.contains("centrehead")) {
[
#stack(
dir: ttb,
spacing: linespacing * 1em,
{
strong(authordisplay) + sectiondisplay + h(1fr) + codedisplay
},
{
box(stack(dir: ltr, subjectdisplay, schooldocTitleDisplay)) + h(1fr) + daterepr
},
block(inset: (top: linespacing * 1.5em), dividerdisplay),
)
]
} else {
align(
center,
stack(
dir: ttb,
spacing: linespacing * 1em,
{
strong(authordisplay) + sectiondisplay
},
{
box(stack(dir: ltr, subjectdisplay, schooldocTitleDisplay))
},
{
codedisplay + "·" + daterepr
},
block(inset: (top: linespacing * 1.5em), dividerdisplay),
),
)
}
let notesheader() = {
align(
center,
stack(
dir: ttb,
spacing: linespacing * 1em,
{
strong(authordisplay) + sectiondisplay
},
{
big(n: 1, box(stack(dir: ltr, subjectdisplay, hl-ac("Notes"))))
},
{
codedisplay + "·" + daterepr
},
block(inset: (top: linespacing * 1.5em), dividerdisplay),
),
)
}
if (doctype == "schooldoc") {
sdheader()
}
if (doctype == "notes") {
notesheader()
outline()
}
// ARTICLE FORMAT --- ARTICLE FORMAT --- ARTICLE FORMAT --- ARTICLE FORMAT --- ARTICLE FORMAT --- ARTICLE FORMAT ---
let articleheader(verbose: false) = align(if (flags.contains("centrehead")) {
center
} else {
left
})[
#[#text(weight: 900)[#title]]<b1> #linebreak()
#if (subtitle != "") {
[#strong[#[#subtitle]<b3> ] #linebreak()]
}
#if (description != "") {
[#emph[#description] #linebreak()]
}
#if (verbose == true) {
[
*Tags:* #for i in tags{
set underline(stroke: (dash: "dashed"))
underline(i) + ","
}
]
}
#if (flags.contains("nodivider")) { } else {
[#v(-1em)
#line(length: 100%, stroke: solidStroke(tx))]
}
]
if (doctype == "article") {
articleheader()
}
if (doctype == "articleVerbose") {
articleheader(verbose: true)
}
// WRITING FORMAT --- WRITING FORMAT --- WRITING FORMAT --- WRITING FORMAT --- WRITING FORMAT --- WRITING FORMAT ---
let writingheader(verbose: false) = align(if (flags.contains("centrehead")) {
center
} else {
left
})[
#[#text(weight: 900)[#title]]<b1> #linebreak()
#strong[Description: ] #emph[#description] #linebreak()
#if (verbose == true) {
[
*Rating:* #rating #linebreak()
*Tags:* #for i in tags{
set underline(stroke: (dash: "dashed"))
underline(i) + ", "
}
]
}
#if (not flags.contains("nodivider")) { } else {
[#v(-1em)
#line(length: 100%, stroke: solidStroke(tx))]
}
]
if (doctype == "writing") {
writingheader()
}
if (doctype == "writingVerbose") {
writingheader(verbose: true)
}
// DIARY ENTRY FORMAT --- DIARY ENTRY FORMAT --- DIARY ENTRY FORMAT --- DIARY ENTRY FORMAT --- DIARY ENTRY FORMAT ---
let diaryheader() = [
#align(if (flags.contains("centrehead")) {
center
} else {
left
})[ #daterepr ]<b1>
]
if (doctype == "diaryEntry") {
flags.push("centrefoot")
diaryheader()
}
// DEBUG --- DEBUG --- DEBUG --- DEBUG --- DEBUG --- DEBUG --- DEBUG --- DEBUG ---
if (debug) {
{
heading(outlined: false, numbering: none)[DEBUG MODE]
heading(outlined: false, numbering: none, level: 2)[Parameters]
align(center)[
#table(
columns: (auto, auto, auto),
stroke: (y: dottedStroke(th: 1pt, laac)),
"Parameter", "Value", "Type",
`docutype`, repr(docutype), repr(type(docutype)),
`author`, repr(author), repr(type(author)),
`rp-title`, repr(rp-title), repr(type(rp-title)),
`rp-authors`, repr(rp-authors), repr(type(rp-authors)),
`rp-school`, repr(rp-school), repr(type(rp-school)),
`rp-submittedTo`, repr(rp-submittedTo), repr(type(rp-submittedTo)),
`rp-keywords`, repr(rp-keywords), repr(type(rp-keywords)),
`rp-subtitle`, repr(rp-subtitle), repr(type(rp-subtitle)),
`rp-supplement`, repr(rp-supplement), repr(type(rp-supplement)),
`rp-supplement2`, repr(rp-supplement2), repr(type(rp-supplement2)),
`rp-header`, repr(rp-header), repr(type(rp-header)),
`rp-subject`, repr(rp-subject), repr(type(rp-subject)),
`section`, repr(section), repr(type(section)),
`subject`, repr(subject), repr(type(subject)),
`cod`, repr(cod), repr(type(cod)),
`rating`, repr(rating), repr(type(rating)),
`tags`, repr(tags), repr(type(tags)),
`title`, repr(title), repr(type(title)),
`subtitle`, repr(subtitle), repr(type(subtitle)),
`description`, repr(description), repr(type(description)),
`colsc`, repr(colsc), repr(type(colsc)),
`bgtint`, repr(bgtint), repr(type(bgtint)),
`size`, repr(size), repr(type(size)),
`date`, repr(date), repr(type(date)),
`doc-columns`, repr(doc-columns), repr(type(doc-columns)),
`outcols`, repr(outcols), repr(type(outcols)),
`imagewidth`, repr(imagewidth), repr(type(imagewidth)),
`headingstyle`, repr(headingstyle), repr(type(headingstyle)),
`headingnum`, repr(headingnum), repr(type(headingnum)),
`headingprefix`, repr(headingprefix), repr(type(headingprefix)),
`headingsup`, repr(headingsup), repr(type(headingsup)),
`refsup`, repr(refsup), repr(type(refsup)),
`font`, repr(font), repr(type(font)),
`font2`, repr(font2), repr(type(font2)),
`fw`, repr(fw), repr(type(fw)),
`fz`, repr(fz), repr(type(fz)),
`rawsize`, repr(rawsize), repr(type(rawsize)),
`mathscale`, repr(mathscale), repr(type(mathscale)),
`linespacing`, repr(linespacing), repr(type(linespacing)),
`flags`, repr(flags), repr(type(flags)),
`debug`, repr(debug), repr(type(debug)),
)
]
let sqdebug(a) = [#square(width: 2in, ..a, stroke: 2pt + tx)]
align(
center,
block(
grid(
grid(
columns: 3,
row-gutter: 1em,
sqdebug(fill-bg), sqdebug(fill-bgla), sqdebug(fill-la),
repr(bg), repr(bgla), repr(la),
sqdebug(fill-laac), sqdebug(fill-ac), sqdebug(fill-acda),
repr(laac), repr(ac), repr(acda),
sqdebug(fill-da), sqdebug(fill-datx), sqdebug(fill-tx),
repr(da), repr(datx), repr(tx),
),
),
),
)
grid(
columns: (1fr,) * 3,
gutter: 0.5in,
align: left,
text(fill: bg)[#lorem(20)],
text(fill: bgla)[#lorem(20)],
text(fill: la)[#lorem(20)],
text(fill: laac)[#lorem(20)],
text(fill: ac)[#lorem(20)],
text(fill: acda)[#lorem(20)],
text(fill: da)[#lorem(20)],
text(fill: datx)[#lorem(20)],
text(fill: tx)[#lorem(20)],
)
[
= Heading 1
#lorem(50)
== Heading 2
#lorem(50)
=== Heading 3
#lorem(50)
==== Heading 4
#lorem(50)
===== Heading 5
#lorem(50)
====== Heading 6
#lorem(50)
- Unordered List
- Indent :3333
- MOAR Indent
- PINGAS
+ Ordered List
+ Indent :3333
+ #[MOAR Indent]<hl-tx>
+ PINGAS
The quadratic equation is $x = (-b +- sqrt(b^2 -4\a\c))/(2a)$. Euler's identity
is $e^(pi\i) + 1 = 0$, and the idea that $e = m\c^2+p\c$ does your mom and your
senator. `PINGAS`
$ f(a,b,c,d,x) = a\x^3 + b\x^2 + c\x + d $
```cs
namespace joniksj;
public class EntryPoint() {
public static void Main() {
console.log("snooPINGAS usual, I see.")
}
}
```
#figure(
table(
columns: (1fr, 1fr, 1fr),
[#[Apple]<hl-tx>],
[#[Apple]<hl-datx>],
[#[Apple]<hl-da>],
[#[Apple]<hl-da2>],
[#[Apple]<hl-acda>],
[#[Apple]<hl-ac>],
[#[Apple]<hl-laac>],
[#[Apple]<hl-la>],
[#[Apple]<hl-la2>],
[#[Apple]<hl-bgla>],
[#[Apple]<hl-bg>],
table.cell()[FAGGOT],
),
caption: [PINGAS],
)
#[Apple]<hl-tx> PINGAS
#[Apple]<hl-datx> PINGAS
#[Apple]<hl-da> PINGAS
#[Apple]<hl-da2> PINGAS
#[Apple]<hl-acda> PINGAS
#[Apple]<hl-ac> PINGAS
#[Apple]<hl-laac> PINGAS
#[Apple]<hl-la> PINGAS
#[Apple]<hl-la2> PINGAS
#[Apple]<hl-bgla> PINGAS
#[Apple]<hl-bg> PINGAS
#quote(attribution: "Your Mom")[
#lorem(100)
]
/ Penis: Penis
/ Penis: Penis
/ Penis: Penis
/ Penis: Penis
#image("example.jpeg")
]
[\ 0123456789]
counter(heading).update(0)
heading(outlined: false, numbering: "1")[END OF DEBUG CONTENT]
rpcoverpage()
}
} else {
body
}
} |
|
https://github.com/jomaway/typst-bytefield | https://raw.githubusercontent.com/jomaway/typst-bytefield/main/lib/api.typ | typst | MIT License | #import "gen.typ": *
#import "types.typ": *
/// Create a new bytefield.
///
/// *Example:* See @chap:use-cases
///
///
/// - bpr (int): Number of bits which are shown per row.
/// - msb (left, right): position of the msb.
/// - pre (auto, int , relative , fraction , array): This is specifies the columns for annotations on the *left* side of the bytefield
/// - post (auto, int , relative , fraction , array): This is specifies the columns for annotations on the *right* side of the bytefield
///
/// - ..fields (bf-field): arbitrary number of data fields, annotations and headers which build the bytefield.
/// -> bytefield
#let bytefield(
bpr: 32,
msb: right,
rows: auto,
pre: auto,
post: auto,
..fields
) = {
let args = (
bpr: bpr,
msb: msb,
rows: rows,
side: (left-cols: pre, right-cols: post)
)
let meta = generate-meta(fields.pos(), args)
let fields = finalize-fields(fields.pos(), meta)
let cells = generate-cells(meta, fields)
let table = generate-table(meta, cells)
return table
}
/// Base for `bit`, `bits`, `byte`, `bytes`, `flag` field functions
///
/// #emoji.warning This is just a base function which is used by the other functions and should *not* be called directly.
///
/// - size (int): The size of the field in bits.
/// - fill (color): The background color for the field.
/// - body (content): The label which is displayed inside the field.
#let _field(size, fill: none, body) = {
if size != auto { assert.eq(type(size), int, message: strfmt("expected size to be an integer or auto, found {}", type(size))) }
if fill != none { assert(type(fill) in (color, gradient, pattern), message: strfmt("expected fill to be an color or gradient, found {}.", type(fill)))}
data-field(none, size, none, none, body, format: (fill: fill))
}
/// Add a field of the size of *one bit* to the bytefield
///
/// Basically just a wrapper for @@_field()
///
/// - ..args (arguments): All arguments which are accepted by `_field`
///
#let bit(..args) = _field(1, ..args)
/// Add a field of a given size of bits to the bytefield
///
/// Basically just a wrapper for @@_field()
///
/// - len (int): Size of the field in bits
/// - ..args (arguments): All arguments which are accepted by `_field`
///
#let bits(len, ..args) = _field(len, ..args)
/// Add a field of the size of one byte to the bytefield
///
/// Basically just a wrapper for @@_field()
///
/// - ..args (arguments): All arguments which are accepted by `_field`
///
#let byte(..args) = _field(8, ..args)
/// Add a field of the size of multiple bytes to the bytefield
///
/// Basically just a wrapper for @@_field()
///
/// - len (int): Size of the field in bytes
/// - ..args (arguments): All arguments which are accepted by `_field`
///
#let bytes(len, ..args) = _field(len * 8, ..args)
/// Add a flag to the bytefield.
///
/// Basically just a wrapper for @@_field()
///
/// - text (content): The label of the flag which is rotated by `270deg`
/// - ..args (arguments): All arguments which are accepted by `_field`
///
#let flag(text,..args) = _field(1,align(center,rotate(270deg,text)),..args)
/// Create a annotation
///
/// The note is always shown in the same row as the next data field which is specified.
///
/// - side (left, right): Where the annotation should be displayed
/// - row (int, auto): Define a row where the note should be displayed.
/// - rowspan (int): Defines if the cell is spanned over multiple rows.
/// - level (int): Defines the nesting level of the note.
/// - inset (length): Inset of the the annotation cell.
/// - bracket (bool): Defines if a bracket will be shown for this note.
/// - content (content): The content of the note.
#let note(
side,
row: auto,
rowspan:1,
level:0,
inset: 5pt,
bracket: false,
content,
) = {
assert(side in (left,right), message: strfmt("expected side to be left or right, found {}", side));
assert.eq(type(bracket), bool, message: strfmt("expected bracket to be of type bool, found {}", type(bracket)));
assert.eq(type(rowspan), int, message: strfmt("expected rowspan to be a integer, found {}.", type(rowspan)));
assert.eq(type(level), int, message: strfmt("expected level to be a integer, found {}.", type(level)));
assert(type(inset) in (length, dictionary), message: strfmt("expected inset to be a length or dictionary, found {}.", type(inset)));
let _align = none
let _first = none
let _second = none
if (side == left) {
_align = right
_first = content
_second = layout(size => {$ lr("{",size:size.height) $})
} else {
_align = left
_first = layout(size => {$ lr("}",size:size.height) $})
_second = content
}
let body = if (bracket == false) { content } else {
grid(
columns:2,
gutter: inset,
_first,
_second
)
}
let format = (
inset: if (bracket == false) { inset } else { (x:2pt, y:1pt) },
align:_align+horizon,
)
return note-field(none, side, level:level, body, format: format, row: row, rowspan: rowspan)
}
/// Shows a note with a bracket and spans over multiple rows.
///
/// Basically just a shortcut for the `note` field with the argument `bracket:true` by default.
///
#let group(side, rowspan, level:0, bracket:true, content) = {
note(side, level:level, rowspan:rowspan, bracket:bracket, content)
}
/// Shows a special note with a start_addr (top aligned) and end_addr (bottom aligned) on the left of the associated row.
///
/// #emoji.warning *experimental:* This will probably change in a future version.
///
/// - start-addr (string, content): The start address will be top aligned
/// - end-addr (string, content): The end address will be bottom aligned
#let section(start-addr, end-addr, span: 1) = {
note(
left,
rowspan: span,
inset: (x:5pt, y:2pt),
box(height:100%, [
#set text(0.8em, font: "Noto Mono", weight: 100)
#align(top + end)[#start-addr]
#align(bottom + end)[#end-addr]
]))
}
/// Config the header on top of the bytefield
///
/// By default no header is shown.
///
/// - range (array): Specify the range of number which are displayed on the header. Format: `(start, end)`
/// - autofill (string): Specify on of the following options and let bytefield calculate the numbers for you.
/// - `"bytes"` shows each multiple of 8 and the last number of the row.
/// - `"all"` shows all numbers.
/// - `"bounds"` shows a number for every start and end bit of a field.
/// - `"offsets"` shows a number for every start bit of a field.
/// - numbers (auto, none): if none is specified no numbers will be shown on the header. This is useful to show only labels.
/// - marker (bool, array): defines if marker lines are shown under a label.
/// - angle (angle): The rotation angle of the label.
/// - fill (color): The background of the header.
/// - stroke (color): The border stroke of the header.
/// - text-size(length): The text-size for the header labels and numbers.
/// - ..args (int, content): The numbers and labels which should be shown on the header.
/// The number will only be shown if it is inside the range.
/// If a `content` value follows a `int` value it will be interpreted as label for this number.
/// For more information see the _manual_.
#let bitheader(
range: (auto,auto),
autofill: auto,
numbers: auto,
marker: true,
fill: auto,
stroke: auto,
text-size: auto,
angle: -60deg,
..args
) = {
// assertions
if (autofill != auto) { assert.eq(type(autofill), str, message: strfmt("expected autofill to be a string, found {}", type(autofill)))}
let _numbers = ()
let labels = (:)
let last = 0
let step = 1
for arg in args.pos() {
if type(arg) == int {
if (arg >= 0) {
_numbers.push(arg)
}
last = calc.abs(arg)
} else if type(arg) == str {
autofill = arg
} else if type(arg) == content {
labels.insert(str(last),arg)
last += 1
}
if numbers != none { numbers = _numbers }
}
let format = (
angle: angle,
text-size: text-size,
marker: marker,
fill: fill,
stroke: stroke,
)
return header-field(
start: range.at(0, default: auto), // todo. fix this
end: range.at(1, default: auto), // todo. fix this
autofill: autofill,
numbers: numbers,
labels: labels,
..format
)
}
|
https://github.com/felsenhower/kbs-typst | https://raw.githubusercontent.com/felsenhower/kbs-typst/master/examples/12.typ | typst | MIT License | #set text(font: "Comic Sans MS")
= Einführung
Mein erster Text mit Typst!
#lorem(20)
|
https://github.com/HEIGVD-Experience/docs | https://raw.githubusercontent.com/HEIGVD-Experience/docs/main/S4/CLD/docs/TE/TE1.typ | typst | #import "/_settings/typst/template-note.typ": conf
#show: doc => conf(
title: [
Résumé CLD - TE1
],
lesson: "CLD",
chapter: "Cloud Introduction, Cloud concepts, IaaS, Scaling App and labs",
definition: "",
col: 1,
doc,
)
= AWS
== EC2
*Statut d'instance*
- Pending : démarrage de l'instance
- Running : instance en cours d'exécution, coût sur la RAM, CPU, espace mémoire et IP
- Stopping : arrêt de l'instance
- Stopped : instance arrêtée, coût sur l'espace mémoire et IP
- Terminated : instance va être supprimée définitivement
== Security Group
Les security groups sont des pare-feu virtuels qui contrôlent le trafic entrant et sortant d'une instance. Ceux-ci peuvent être attribués à une ou plusieurs instances.
Ils permettent de contrôler avec des *inbounds* et *outbounds* rules le trafic entrant et sortant d'une instance. Pour cela, nous pouvons définir quel *port* ou *protocole* doit être autorisé ou non.
== NAT
Le NAT permet de faire une translation d'adresse IP privée vers une adresse IP publique. Il permet de faire communiquer des instances privées avec l'extérieur.
== Gestion des coûts
- Prendre des instances moins performantes et adaptées à nos besoins
- Limiter le temps d'utilisation des instances
- Utiliser un mode de facturation par paiement en avance
- Désallouer les adresses IPv4 quand elles ne sont pas utilisées
== CLI
Le CLI d'AWS utilise des commandes pour interagir avec les services AWS. Il utilise le protocole HTTP/S pour dialoguer avec les API d'AWS.
== Load Balancer
Le Load Balancer permet de répartir la charge entre plusieurs instances. De plus, peu importe le nombre d'instances, on doit exposer au client qu'un seul point d'entrée.
= Cloud introduction
== Définir une instance
- Ou créer l'instance (region / availability zone)
- Quel OS choisir : machine image
- Quelle quantité de CPU et RAM : type d'instance
- Quelle quantité de stockage : volume de stockage
- Quelles règles de sécurité : security group (AWS)
- Comment se connecter à l'instance : clé publique/privée (SSH port 22)
== Etats d'une instance
#image("/_src/img/docs/image copy 93.png")
= Cloud concepts
== Modèle de service cloud
#image("/_src/img/docs/image copy 94.png")
== Définition du cloud (NIST)
- L'informatique en nuage est un modèle permettant
- un accès réseau omniprésent, pratique et à la demande
- à un pool partagé de ressources informatiques configurables (par exemple, réseaux, serveurs, stockage, applications et services)
- qui peuvent être rapidement provisionnées et libérées avec un minimum d'effort de gestion ou d'interaction avec le fournisseur de services
=== Caraactéristiques du cloud
==== Service à la demande en libre-service
Provisionnement automatique *sans* interaction humaine : Le client du cloud est capable d'obtenir des ressources cloud presque instantanément (en quelques minutes) à tout moment. Le fournisseur a complètement automatisé le processus et il n'y a aucune interaction humaine.
==== Accès réseau large
Accès via des protocoles standardisés depuis une variété de clients : Les ingénieurs du client cloud et les utilisateurs peuvent accéder aux ressources cloud en utilisant Internet et des protocoles standardisés.
==== Mutualisation des ressources
Servir plusieurs clients dans un modèle multi-locataire, attribution dynamique des ressources à partir d'un pool, indépendance de l'emplacement : Le fournisseur de cloud fournit des ressources cloud à plusieurs clients cloud (= locataires). Le fournisseur de cloud utilise un logiciel spécial qui fournit des espaces séparés et isolés pour chaque locataire. Le fournisseur de cloud dispose de grands clusters de serveurs et de disques (pools) qui servent des milliers de clients. Pour le client, il n'a pas d'importance de savoir où exactement sa machine virtuelle fonctionne ou où ses données sont stockées.
==== Élasticité rapide (rapid elasticity)
Provisionnement/déprovisionnement rapide pour s'étendre/réduire, capacité apparemment illimitée : Lorsque le nombre d'utilisateurs augmente soudainement et donc la charge sur les ressources, les ingénieurs clients du cloud peuvent rapidement obtenir (provisionner) des ressources supplémentaires. De même, lorsque la charge diminue à nouveau, ils peuvent libérer (déprovisionner) des ressources et cesser de les payer. Le fournisseur de cloud dispose de tant de ressources que le client ne se voit jamais refuser une demande de nouvelle ressource.
===== Scalable vs Elastique
Un système *scalable* permet de supporter une *montée* en charge en ajoutant des ressources. Cependant il est *difficile de profiter d'une diminution* de la charge.
- Trop de friction pour reconfigurer les serveurs pour une autre tâche
- Le système est scalable, mais pas élastique
#image("/_src/img/docs/image copy 95.png")
Un système *élastique* permet de supporter une *montée* en charge en ajoutant des ressources, mais aussi de profiter d'une *diminution* de la charge en retirant des ressources. Cela permet de faire beaucoup d'économies en stoppant les machines non-utilisées.
#image("/_src/img/docs/image copy 96.png")
==== Service mesuré
L'utilisation est surveillée et contrôlée, offrant une transparence dans la facturation : Le fournisseur de cloud mesure précisément quand une machine virtuelle est provisionnée pour un client et quand elle est déprovisionnée, combien de données un client stocke dans une base de données, etc. (surveillance). À la fin du mois, le fournisseur de cloud envoie une facture détaillée au client, répertoriant chaque ressource cloud et son coût.
=== Modèles de service
- Infrastructure as a Service (IaaS)
- Platform as a Service (PaaS)
- Software as a Service (SaaS)
=== Modèles de déploiement
==== Public cloud
- Un fournisseur de cloud héberge et fournit un cloud et permet à quiconque possède une carte de crédit de l'utiliser.
- L'infrastructure est partagée par tout le monde. Par exemple, sur le même serveur fonctionnent des machines virtuelles appartenant à différents clients.
==== Private cloud
L'infrastructure cloud est utilisée par une seule entreprise cliente.
- L'entreprise héberge et exploite elle-même le cloud, sans délégation à une autre entreprise.
- Ou l'entreprise demande à un fournisseur de cloud de créer un cloud exclusivement pour elle.
Utilisé par des entreprises avec des données extrêmement sensibles.
Les "clients" du cloud sont maintenant les départements et les employés de l'entreprise. Ils bénéficient toujours de :
- Service en libre-service à la demande
- Mise en commun des ressources entre les départements de l'entreprise
- Élasticité rapide (partielle)
Exemples :
- Banques privées
- Défense nationale
==== Community cloud
Un nombre très limité de clients ayant des intérêts similaires (par exemple, hôpitaux, constructeurs automobiles, universités) se réunissent et créent un cloud uniquement pour eux-mêmes.
Utilisé lorsque les données sont sensibles, mais pas extrêmement, ou pour des besoins de calcul spéciaux.
Exemples :
- Cloud de santé
- Cloud de simulation de crash de voitures
- Cloud de formation en intelligence artificielle
==== Hybrid cloud
Une entreprise utilise simultanément un ou plusieurs clouds publics, son propre cloud privé et éventuellement un cloud communautaire.
Exemples : C'est le cas courant pour les grandes et moyennes entreprises.
== Barrières à l'adoption du cloud
- Risques de sécurité / confiance envers le fournisseur de cloud
- Déplacements de données relativement coûteux
- Verrouillage du fournisseur
- Accord de niveau de service (SLA)
- Aspect légal
- Aspect politique
= IaaS
== Regions
Une région est une zone géographique. Cela permet de placer des instances dans des zones géographiques différentes pour éviter les pannes.
*Facteur de séléction d'une région*
- Proximité géographique des clients
- Gouvernance des données, respect des lois
- Quels services sont disponibles dans la région
- Les couts peuvent varier d'une région à l'autre
Quand on parle d'*availability zone*, on parle de *datacenter*.
=== Définition AWS
- Les Zones de Disponibilité sont constituées de centres de données distincts (généralement au nombre de 3).
- Les Zones de Disponibilité sont connectées entre elles par un réseau privé à haute vitesse.
- Il est garanti que deux Zones de Disponibilité sont séparées par plusieurs kilomètres afin que les catastrophes telles que les incendies et les inondations soient contenues dans l'une et n'affectent pas l'autre.
- Il est garanti que deux Zones de Disponibilité sont situées à moins de 100 km l'une de l'autre afin que la latence du réseau soit faible.
== Virtualisation
La virtualisation permet de créer des machines virtuelles sur un serveur physique. Cela permet de faire tourner plusieurs systèmes d'exploitation sur un seul serveur.
=== Propriétés
*Compatibilité binaire*
- Le code (système d'exploitation et applications) s'exécutant dans une machine virtuelle "pense" qu'il fonctionne sur une machine normale. Le système d'exploitation pense qu'il contrôle complètement la machine.
- Aucune modification du système d'exploitation ou des applications.
*Interposition*
- Toutes les actions d'une machine virtuelle doivent passer par l'hyperviseur.
*Isolation*
- Un programme s'exécutant dans une machine virtuelle ne peut pas accéder aux données d'une autre machine virtuelle.
- Isolation logicielle
- Isolation des pannes
- Une machine virtuelle avec une charge de traitement élevée ne peut pas affecter les performances d'une autre machine virtuelle.
- Isolation des performances
*Encapsulation*
- L'état complet d'une machine virtuelle peut être capturé dans un fichier : image de machine virtuelle.
- Le fichier peut être manipulé comme n'importe quel autre fichier : transféré, dupliqué, supprimé, ...
=== Hypervisor type 1
L'hyperviseur de type 1 est installé directement sur le matériel. Il permet de gérer les machines virtuelles et de les faire tourner sur le matériel. Il est plus performant que l'hyperviseur de type 2 car n'a pas de couches intermédiaires. C'est ce type de machines qui sont proposés par les fournisseurs de cloud.
= Scaling App
== Scaling type
=== Vertical scaling
Le vertical scaling consiste à ajouter des ressources à des machines existantes.
- Facile à faire en cloud computing
- Peut devenir vite cher
- Limité par l'architecture de la machine
=== Horizontal scaling
Le horizontal scaling consiste à ajouter des machines pour supporter la charge.
- Permet d'utiliser des machines moins chères
- Permet une scalabilité quasi infinie
== HTTP Proxy
Un proxy HTTP est un serveur qui sert d'intermédiaire entre les clients HTTP et les serveurs HTTP. Il a pour but d'être transparent pour le client et le serveur. Cela s'appelle un proxy quand il est deployé côté client et un reverse proxy quand il est deployé côté serveur.
*Important*: un load balancer est un reverse proxy.
#image("/_src/img/docs/image copy 98.png")
== Load Balancer
#image("/_src/img/docs/image copy 97.png")
*Attention!* pour que LB puisse être appliqué à une application il faut absolument que celle-ci soit *stateless*.
=== TCP vs HTTP
Un load balancer TCP sera plus rapide qu'un load balancer HTTP car celui-ci utilise seulement la couche TCP alors que le load balancer HTTP devra attendre une requête avec de pouvoir faire sa décision de redirection. Un load balancer TCP sera donc plus rapide en termes de latence et de performances.
Un load balancer TCP sera moins précis dans ses choix de redirections comparé à un load balancer HTTP.
=== Forward policies
- Round Robin : Aller d'un serveur à un autre pour chaque requêtes et ceci dans un ordre précis et boucler comme cela.
- IP Hash : Hashé l'IP du client pour choisir un serveur.
- Least Connection : Aller sur les serveurs avec le moins de connexions.
== Health Check
- Les serveurs peuvent rencontrer des problèmes et renvoyer des erreurs ou devenir totalement non réactifs (panne matérielle, bug logiciel, disque plein, etc.).
- Lorsque le répartiteur de charge envoie une requête utilisateur à un serveur non réactif, l'utilisateur percevra le site web comme non réactif.
- Pour éviter cette situation, le répartiteur de charge vérifie en continu que les serveurs sont "en bonne santé", c'est-à-dire qu'ils fonctionnent correctement.
- Le répartiteur de charge envoie régulièrement une requête HTTP de test au point de terminaison de l'application, appelée vérification de santé.
- Lorsque l'application répond par 200 OK, le répartiteur de charge considère le serveur comme sain.
- Lorsque l'application répond par une erreur ou ne répond pas du tout, le serveur est considéré comme non sain.
- Le répartiteur de charge exclut immédiatement les serveurs non sains du routage des requêtes.
=== Default health check
Les causes suivantes peuvent mettre un serveur hors service, donc mettre en defaut un health check :
- Port et protocole malconfigurés
- Service down ou surchargé
- Problème de routage |
|
https://github.com/adelhult/typst-hs-test-packages | https://raw.githubusercontent.com/adelhult/typst-hs-test-packages/main/test/counter-examples/nbsp.typ | typst | MIT License | // This function uses npbs:s in the next statement, but it seems like
// other spaces accepted by Typst (like hair space 8202) isn't accepted by
// typst-hs either
#let a = "a" |
https://github.com/fyuniv/simplebook | https://raw.githubusercontent.com/fyuniv/simplebook/main/0.1.0/lib.typ | typst | MIT License | #let simplebook(
title: "",
subtitle: "",
author: "",
affiliation: "",
year: none,
version: none,
date: datetime.today().display(),
logo: none,
theme_colors: (
primary_color: "E94845",
secondary_color: "FF5045",
),
title_font: "",
main_font: "Noto Sans",
lhead: "",
chead: "",
rhead: "",
lfoot: "",
cfoot: "",
rfoot: "",
body,
) = {
set document(author: author, title: title)
// Save heading and body font families in variables.
let body-font = main_font
let title-font = {if title_font != "" {title_font} else {main_font}}
// Set colors
let primary-color = rgb(theme_colors.primary_color) // alpha = 100%
// change alpha of primary color
let secondary-color = rgb(theme_colors.secondary_color)
// Set body font family.
set text(font: body-font, lang: "en", 12pt)
show heading: set text(font: title-font, fill: primary-color)
// Set link style
show link: it => underline(text(fill: primary-color, it))
// show outline: set heading(supplement: none, outlined: false)
set outline(depth: 2)
show outline.entry.where(
level: 1
): it => {
v(12pt, weak: true)
strong(it.element.supplement + it)
}
show outline.entry.where(
level: 2,
): it => {
strong(it.element.supplement + it)
}
// show outline: set page(numbering: "i")
set heading(numbering: " 1.1: ")
show heading.where(level: 1): set heading(
supplement: [Topic],
bookmarked: true,
)
show heading.where(level: 1): it => {
if it.body == outline.title or it.numbering == none { return it.body } else {
it.supplement + counter(heading).display(it.numbering) + it.body
}
}
show heading.where(level: 2): set heading(
supplement: [Section],
bookmarked: true,
)
show heading.where(level: 2): it => {
it.supplement
counter(heading).display(it.numbering)
it.body
}
show heading.where(level: 1): chap => context {
metadata("pagebreakbelow")
pagebreak(weak: true, to: "odd")
align(center)[
#chap
#metadata("h1above")
#v(0.5em)
]
}
// Main body.
set page(
header: context {
set text(font: title-font, fill: primary-color)
let isnewpage = query(
metadata.where(value: "pagebreakbelow").before(here())).find(
m => {m.location().page() == here().page() - 1}
)
if isnewpage != none {
return none
}
// Find the heading of chapters and sections in the current location.
let chapter_before = query(
selector(heading.where(level: 1)).before(here()),
)
let chapter_after = query(
selector(heading.where(level: 1)).after(here()),
)
let currentheading = query(metadata.where(value: "h1above")).find(h => h.location().page() == here().page())
let pagenum_mainmatter = query(metadata.where(value: "mainmatter")).first().location().page()
if (chapter_before.len() != 0 and chapter_before.last().location().page() >= pagenum_mainmatter and currentheading == none){
grid(
columns: (1fr, 1fr, 1fr),
align: (left, center, right),
rows: (1em, auto),
row-gutter: 0.65em,
if lhead == "" {
[#chapter_before.last().supplement#h(0.25em)#counter(heading).get().first():#h(0.25em)#smallcaps(chapter_before.last().body)
]
} else {lhead},
chead,
if rhead == "" {
smallcaps(title)
} else {rhead},
grid.hline(y:1, stroke: primary-color)
)
}
},
footer: context {
let findlastpagebreak = query(
metadata.where(value: "pagebreakbelow").before(here())).find(
m => {m.location().page() == here().page() - 1}
)
let pagenum_mainmatter = query(metadata.where(value: "mainmatter")).first().location().page()
let isnewpage = false
if findlastpagebreak != none and calc.odd(findlastpagebreak.location().page()) {
isnewpage = true
}
if isnewpage {
none
} else {
if here().page() < 3 {
none
} else if here().page() < pagenum_mainmatter {
align(center,counter(page).display("i"))
} else {
grid(
columns: (1fr, 1fr, 1fr),
align: (left, center, right),
lfoot,
if cfoot == "" {counter(page).display("1 / 1", both: true)} else {cfoot}
,
rfoot
)
}
}
}
)
set par(justify: true)
// Title page.
// Logo at top right if given
page(numbering: none)[
#if logo != none {
set image(width: 6cm)
place(top + right, logo)
}
#v(2fr)
#align(center, text(font: title-font, fill: primary-color, 3em, weight: 700, title))
#v(2em, weak: true)
#align(center, text(font: title-font, fill: secondary-color, 2em, weight: 700, subtitle))
#if date != none {
v(2em, weak: true)
align(center, text(1.1em, date))
}
#v(2fr)
// Author information.
#align(center)[
#if author != none {text(author, fill: primary-color, 14pt, weight: "bold")}
#if affiliation != none {text(font: title-font, fill: secondary-color)[#affiliation]}
#if version != none {
v(0.65em)
text(size: 0.7em)[Version: #version]
}
#if year != none {
v(0.65em)
text(size: 0.7em)[Year: #year\ ]
}
]
]
body
}
#let blankpage = page(numbering: none, header: none)[]
#let mainmatter = {
pagebreak(weak: true, to: "odd")
metadata("mainmatter")
counter(heading).update(0)
counter(page).update(1)
}
#let preface(preface_title: "Preface", body) = {
counter(page).update(1)
heading(numbering: none, outlined: false)[#preface_title]
body
}
|
https://github.com/SnowManKeepsOnForgeting/NoteofEquationsofMathematicalPhysics | https://raw.githubusercontent.com/SnowManKeepsOnForgeting/NoteofEquationsofMathematicalPhysics/main/Chapter_3/Chapter_3.typ | typst | #import "@preview/physica:0.9.3": *
#import "@preview/i-figured:0.2.4"
#set heading(numbering: "1.1")
#show math.equation: i-figured.show-equation.with(level: 2)
#show heading: i-figured.reset-counters.with(level: 2)
#set text(font: "CMU Serif")
#let dcases(..args) = math.cases(..args.pos().map(math.display))
#counter(heading).update(2)
#let uavg = $overline(u)$
= Method of Traveling Waves
This chapter will discuss the method of solving a three dimension wave equation with initial condition.To achieve this we will follow the following steps:
1. Solve the one dimensional wave equation.
2. Solve the special case of the three dimensional wave equation.(Radially symmetric case)
3. Solve the general case of the three dimensional wave equation.
$
dcases(
pdv(u,t,2) = a^2 (pdv(u,x,2) + pdv(u,y,2) + pdv(u,z,2))\
eval(u)_(t=0) = phi(x,y,z)\
eval(pdv(u,t))_(t=0) = psi(x,y,z)
)
$
== Initial Problem of One Dimensional Wave Equation
Given a one dimensional wave equation with initial conditions:
$
dcases(
pdv(u,t,2) = a^2 pdv(u,x,2)\
eval(u)_(t=0) = phi(x)\
eval(pdv(u,t))_(t=0) = psi(x)
)
$
First we try to simplify it.This equation is a hyperbolic partial differential equation.Its characteristic equation is:
$
(dd(x))^2 - a^2 (dd(t))^2 = 0
$
We have two characteristic lines:
$
x+a t = C, x-a t = C
$
We do such transformation:
$
dcases(
xi = x + a t\
eta = x - a t
)
$
By differentiating we get:
$
pdv(u,x,2) = pdv(u,xi,2) + 2 pdv(u,xi,eta) + pdv(u,eta,2)\
pdv(u,t,2) =a^2 (pdv(u,xi,2) - 2 pdv(u,xi,eta) + pdv(u,eta,2))
$
Substitute these into the wave equation we get canonical form
$
pdv(u,xi,eta) = 0
$<316>
We integrate @eqt:316 with respect to $eta$:
$
pdv(u,xi) = f(xi)
$
Then we integrate it with respect to $xi$:
$
u(x,t) = integral f(xi) dd(xi) + f_2(eta) = f_1 (x+ a t) + f_2 (x - a t)
$<318>
Let us consider the initial conditions:
$
dcases(
eval(u)_(t=0) = phi(x)\
eval(pdv(u,t))_(t=0) = psi(x)
)
$<319>
We substitute @eqt:318 into @eqt:319:
$
dcases(
f_1 (x) + f_2 (x) = phi(x)\
a f_1^' (x) - a f_2^' (x) = psi(x)
)
$
We integrate the second equation with respect to $x$(*Here we do definite integral instead of indefinite integral because we do this way to get rid of the constant of integration*):
$
f_1 (x) - f_2 (x) = 1/a integral_0^x psi(xi) dd(xi) + C
$
Thus we can solve these two equations:
$
dcases(
f_1 (x) = 1/2 phi(x) + 1/(2a) integral_0^x psi(xi) dd(xi) + C/2\
f_2 (x) = 1/2 phi(x) - 1/(2a) integral_0^x psi(xi) dd(xi) - C/2
)
$
Then we get the final solution also called D'Alembert's formula:
$
u(x,t) = 1/2 [phi(x + a t) + phi(x - a t)] + 1/(2a) integral_(x-a t)^(x+a t) psi(xi) dd(xi)
$
== Special Case of Three Dimensional Wave Equation
If the three dimensional wave equation is radially symmetric.Then we can use the spherical coordinate system:
$
pdv(u,t,2) = a^2(1/r^2 pdv(,r)(r^2 pdv(u,r)) + 1/(r^2 sin(theta)) pdv(,theta)(sin(theta) pdv(u,theta)) + 1/(r^2 sin^2(theta)) pdv(u,theta,2))\
$
Because the equation is radially symmetric,$u$ is independent of $theta$ and $phi$ in other words $pdv(u,theta) = pdv(u,phi) = 0$.Thus the equation becomes:
$
pdv(u,t,2) = a^2(1/r^2 pdv(,r)(r^2 pdv(u,r)))
$<322>
@eqt:322 is called the radical symmetric wave equation.We can expand it:
$
pdv(u,t,2) = a^2 (pdv(u,r,2) + 2/r pdv(u,r))
$<323>
We multiply $r$ to both sides of @eqt:322:
$
pdv((r u),t,2)=r pdv(u,t,2) = a^2 (r pdv(u,r,2) + 2 pdv(u,r)) = a^2 (pdv((r u),r,2))
$
This is a one dimensional wave equation with initial conditions with respect to $r u$.General Solution of it is:
$
r u = f_1 (r + a t) + f_2 (r - a t)
$
Also as:
$
u(r,t) = (f_1 (r + a t) + f_2 (r - a t))/r
$
By substituting the initial conditions we get the final solution.
== General Case of Three Dimensional Wave Equation
$
dcases(
pdv(u,t,2) = a^2 (pdv(u,x,2) + pdv(u,y,2) + pdv(u,z,2))\
eval(u)_(t=0) = phi(x,y,z)\
eval(pdv(u,t))_(t=0) = psi(x,y,z)
)
$<331>
Let us consider the general case of the three dimensional wave equation.Because $u$ is not radically symmetric,$u$ is a function of $x,y,z$ and $t$.But if a given point $M(x,y,z)$,we consider the average of the values of $u$ in the sphere with radius $r$ and center $M$.This value is independent of $x,y,z$ since the point $M$ is given in other words this value is a function of $r$ and $t$.We denote this value as $uavg(r,t)$.Thus we have:
$
uavg(r,t) = 1/(4 pi r^2)integral.double_(S_r^M) u(xi,eta,zeta,t) dd(S)
$<332>where $xi=x+r sin(theta)cos(phi),eta = y + r sin(theta)sin(phi), zeta = z + r cos(theta)$.
It is easy to see that
$
lim_(r->0) uavg(r,t) = u(x,y,z,t)
$
Because $u$ is continuous.Thus we have:
$
uavg(0,t) = u(x,y,z,t)
$
We integrate @eqt:331 over the sphere with radius $r$ and center $M$:
$
1/(4 pi r^2)integral.double_(S_r^M) pdv(u,t,2) dd(S) = a^2/(4 pi r^2)integral.double_(S_r^M) laplace u dd(S)
$
Also
$
pdv(,t,2)(1/(4 pi r^2)integral.double_(S_r^M) u dd(S)) = a^2 laplace integral.double_(S_r^M) u dd(S)
$
We substitute @eqt:332 into the above equation:
$
pdv(uavg,t,2) = a^2 laplace uavg
$<337>
Thus let us conduct the following transformation.We have:
$
(xi - x)^2 + (eta - y)^2 + (zeta - z)^2 = r^2
$
$
pdv(uavg,x) = pdv(uavg,r) pdv(r,x) = pdv(uavg,r) (x-xi)/r\
pdv(uavg,x,2) = pdv(uavg,r,2)((x -xi)/r)^2 + pdv(uavg,r)(r^2 - (x-xi)^2)/r^3
$
Similarly we obtain:
$
pdv(uavg,y,2) = pdv(uavg,r,2)((y -eta)/r)^2 + pdv(uavg,r)(r^2 - (y-eta)^2)/r^3
$
$
pdv(uavg,z,2) = pdv(uavg,r,2)((z -zeta)/r)^2 + pdv(uavg,r)(r^2 - (z-zeta)^2)/r^3
$
Thus we have:
$
laplace uavg = pdv(uavg,x,2) + pdv(uavg,y,2) + pdv(uavg,z,2) = pdv(uavg,r,2) + 2/r pdv(uavg,r)
$
We substitute this into @eqt:337:
$
pdv(uavg,t,2) = a^2 (pdv(uavg,r,2) + 2/r pdv(uavg,r))
$
This is a radical symmetric wave equation.Thus we get the general solution:
$
r uavg(r,t) = f(r+a t)+g(r-a t)
$<3314>let $r = 0$ we have:
$
f(a t) = - g(-a t)\
f^' (a t) = g^' (-a t)
$<3315>
We take the partial derivative of @eqt:3314 with respect to $r$:
$
uavg + r pdv(uavg,r) = f^' (r+a t) + g^' (r-a t)
$
Let $r = 0$ We have:
$
uavg(0,t) = f^' (a t) + g^' (-a t) = 2 f^' (a t)
$
To obtain $f^' (a t)$ ,we take the partial derivative of @eqt:3314 with respect to $t$:
$
pdv(,t)(r uavg) = a f^' (r+a t) - a g^' (r-a t)
$
We have:
$
a pdv(,r)(r,uavg) + pdv(,t)(r uavg) = 2 a f^' (r+a t)
$ |
|
https://github.com/VisualFP/docs | https://raw.githubusercontent.com/VisualFP/docs/main/SA/design_concept/content/poc/options_deployment_decision.typ | typst | #import "../../../acronyms.typ": *
= Deployment Decision
VisualFP targets students, so it will primarily be used in classrooms. Such
environments often do not allow for easy deployment and maintenance of
application servers.
Thus, the decision has been made to develop VisualFP as a desktop
application. |
|
https://github.com/Drodt/clever-quotes | https://raw.githubusercontent.com/Drodt/clever-quotes/main/src/util.typ | typst | /// Creates a quotation style.
///
/// - outer-open (string): Opening outer quotation mark.
/// - outer-close (string): Closing outer quotation mark.
/// - inner-open (string): Opening inner quotation mark.
/// - inner-close (string): Closing inner quotation mark.
/// - middle-outer (string, none): Outer quotation mark inserted on the beginning of each opening paragraph in the quote. Currently unused.
/// - middle-inner (string, none): Inner quotation mark inserted on the beginning of each opening paragraph in the quote. Currently unused.
/// - kern: (length, none): Space between quotation marks. Currently unused.
#let create-quote-style(
outer-open,
outer-close,
inner-open,
inner-close,
middle-outer: none,
middle-inner: none,
kern: none,
) = (
outer-open: outer-open,
outer-close: outer-close,
inner-open: inner-open,
inner-close: inner-close,
middle-outer: middle-outer,
middle-inner: middle-inner,
kern: kern,
) |
|
https://github.com/Dioprz/Notes | https://raw.githubusercontent.com/Dioprz/Notes/main/README.md | markdown | Estas son algunas de mis notas tomadas durante los cursos en el pregrado de Ciencias de la Computación, así como de libros o artículos que he estudiado de forma autónoma.
Los temas abordados son:
- Functional Programming:
- Scala (in progress)
- Haskell (pending)
- Category Theory (pending)
- Machine Learning (pending)
- Mathematical Logic (pending)
El lenguaje de marcado que uso para tomarlas se llama *Typst*, un [lenguaje nuevo](https://typst.app/docs/) que poco a poco adquiere la potencia de *LaTeX*, pero con una sintaxis tan cómoda y legible (o más) que la de Markdown. Debido a que GitHub no tiene renderización nativa para este formato, dejo como opción para leer las notas tanto el código como el pdf compilado.
En caso de encontrar algún error notable en las notas, apreciaría mucho si crea un nuevo asunto para hacérmelo saber.
|
|
https://github.com/UntimelyCreation/typst-neat-cv | https://raw.githubusercontent.com/UntimelyCreation/typst-neat-cv/main/src/template.typ | typst | MIT License | /* Imports */
#import "metadata.typ": *
/* Utility functions */
#let autoImport(file) = {
if cvLanguage == "" {
include {"content/en/" + file + ".typ"}
}
else {
include {"content/" + cvLanguage + "/" + file + ".typ"}
}
}
#let languageSwitch(dict) = {
for (k, v) in dict {
if k == cvLanguage {
return v
break
}
}
panic("i18n: language value not matching any key in the array")
}
/* Styling */
#let headerFont = ("Source Sans Pro", "Symbols Nerd Font")
#let textFont = ("Source Sans Pro", "Symbols Nerd Font")
#let textColors = (
lightGray: rgb("#ededef"),
mediumGray: rgb("#78787e"),
darkGray: rgb("#3c3c42"),
)
#let accentColors = (
burgundy: rgb("#800020"),
)
#let chosenAccentColor = {
if type(accentColor) == color {
accentColor
} else {
accentColors.at(accentColor)
}
}
#let divider() = align(center,
line(length: 95%, stroke: (paint: textColors.mediumGray, dash: "dashed"))
)
#let headerFirstNameStyle(str) = {text(
font: headerFont,
size: 28pt,
weight: "light",
str
)}
#let headerLastNameStyle(str) = {text(
font: headerFont,
size: 28pt,
weight: "bold",
str
)}
#let headerInfoStyle(str) = {text(
font: headerFont,
size: 9pt,
str
)}
#let headerQuoteStyle(str) = {text(
size: 12pt,
weight: "medium",
style: "italic",
fill: chosenAccentColor,
str
)}
#let sectionTitleStyle(str, color:black) = {text(
size: 16pt,
weight: "bold",
fill: color,
str
)}
#let entryA1Style(str) = {text(
size: 12pt,
weight: "bold",
str
)}
#let entryA2Style(str) = {align(right, text(
weight: "medium",
fill: chosenAccentColor,
style: "oblique",
str
))}
#let entryB1Style(str) = {text(
size: 11pt,
fill: chosenAccentColor,
weight: "medium",
smallcaps(str)
)}
#let entryB2Style(str) = {align(right, text(
size: 11pt,
weight: "medium",
fill: textColors.mediumGray,
style: "oblique",
str
))}
#let skillTypeStyle(str) = {text(
size: 12pt,
weight: "bold",
str
)}
#let languageNameStyle(str) = {text(
size: 12pt,
weight: "bold",
str
)}
#let languageInfoStyle(str) = {text(
str
)}
#let descriptionStyle(str) = {text(
fill: textColors.darkGray,
str
)}
#let tagStyle(str) = {align(center, text(
size: 11pt,
weight: "regular",
str
))}
#let tagListStyle(tags) = {for tag in tags {
box(
inset: (x: 0.3em),
outset: (y: 0.3em),
fill: textColors.lightGray,
radius: 3pt,
tagStyle(tag),
)
h(5pt)
}}
#let letterHeaderNameStyle(str) = {text(
fill: chosenAccentColor,
weight: "bold",
str
)}
#let letterHeaderAddressStyle(str) = {text(
fill: textColors.mediumGray,
size: 0.9em,
smallcaps(str)
)}
#let letterDateStyle(str) = {text(
size: 0.9em,
style: "italic",
str
)}
#let letterSubjectStyle(str) = {text(
fill: chosenAccentColor,
weight: "bold",
underline(str)
)}
/* Sections */
#let cvHeader(
align: left,
hasPhoto: false
) = {
let makeHeaderInfo() = {
let personalInfoIcons = (
phone: "",
email: "",
homepage: "",
github: "",
gitlab: "",
location: "",
extraInfo: "",
)
let n = 1
for (k, v) in personalInfo {
// A dirty trick to add linebreaks with "linebreak" as key in personalInfo
if k == "linebreak" {
n = 0
linebreak()
continue
}
if v != "" {box({
// Adds icons
personalInfoIcons.at(k) + h(5pt)
// Adds hyperlinks
if k == "email" {
link("mailto:" + v)[#v]
} else if k == "linkedin" {
link("https://www.linkedin.com/in/" + v)[#v]
} else if k == "github" {
link("https://github.com/" + v)[#v]
} else if k == "gitlab" {
link("https://gitlab.com/" + v)[#v]
} else if k == "homepage" {
link("https://" + v)[#v]
} else {
v
}
})}
// Adds hBar
if n != personalInfo.len() {
h(12pt)
}
n = n + 1
}
}
let makeHeaderNameSection() = table(
columns: 1fr,
inset: 0pt,
stroke: none,
row-gutter: 4mm,
[#headerFirstNameStyle(firstName) #h(5pt) #headerLastNameStyle(lastName)],
[#headerQuoteStyle(languageSwitch(headerQuoteInternational))],
[#headerInfoStyle(makeHeaderInfo())],
)
let makeHeaderPhotoSection() = {
if profilePhoto != "" {
image(profilePhoto, height: 3.6cm)
} else {
v(3.6cm)
}
}
let makeHeader(leftComp, rightComp, columns, align) = table(
columns: columns,
inset: 0pt,
stroke: none,
column-gutter: 15pt,
align: align + horizon,
{leftComp},
{rightComp}
)
if hasPhoto {
makeHeader(makeHeaderNameSection(), makeHeaderPhotoSection(), (auto, 20%), align)
} else {
makeHeader(makeHeaderNameSection(), makeHeaderPhotoSection(), (auto, 0%), align)
}
}
#let cvSection(title) = {
sectionTitleStyle(title, color: chosenAccentColor)
h(4pt)
box(width: 1fr, line(stroke: 0.9pt, length: 100%))
}
#let cvEntry(
title: "Title",
organisation: "Organisation",
date: "Date",
location: "Location",
description: "Description",
logo: "",
tags: ()
) = {
let ifOrganisationFirst(condition, field1, field2) = {
return if condition {field1} else {field2}
}
let ifLogo(path, ifTrue, ifFalse) = {
return if varDisplayLogo {
if path == "" { ifFalse } else { ifTrue }
} else { ifFalse }
}
let setLogoLength(path) = {
return if path == "" { 0% } else { 4% }
}
let setLogoContent(path) = {
return if logo == "" [] else {image(path, width: 100%)}
}
table(
columns: (ifLogo(logo, 4%, 0%), 1fr),
inset: 0pt,
stroke: none,
align: horizon,
column-gutter: ifLogo(logo, 4pt, 0pt),
setLogoContent(logo),
table(
columns: (1fr, auto),
inset: 0pt,
stroke: none,
row-gutter: 8pt,
align: auto,
{entryA1Style(ifOrganisationFirst(varEntryOrganisationFirst, organisation, title))},
{entryA2Style(date)},
{entryB1Style(ifOrganisationFirst(varEntryOrganisationFirst, title, organisation))},
{entryB2Style(location)},
)
)
descriptionStyle(description)
tagListStyle(tags)
}
#let cvSkill(
type: "Type",
tags: (),
) = {
skillTypeStyle(type)
v(-1mm)
tagListStyle(tags)
}
#let cvLanguage(
name: "Name",
info: "Info",
) = {
table(
columns: (25%, 1fr),
inset: 0pt,
column-gutter: 10pt,
stroke: none,
align: horizon,
languageNameStyle(name),
languageInfoStyle(info),
)
}
#let cvInterestTags(
tags: (),
) = {
tagListStyle(tags)
}
#let cvInterestDescription(
description: "Description",
) = {
descriptionStyle(description)
}
#let letterHeader(
myAddress: "Your Address Here",
recipientName: "<NAME>",
recipientAddress: "Recipient Address Here",
date: "Today's Date",
subject: "Subject: Hey!"
) = {
letterHeaderNameStyle(firstName + " " + lastName)
v(1pt)
letterHeaderAddressStyle(myAddress)
v(1pt)
align(right, letterHeaderNameStyle(recipientName))
v(1pt)
align(right, letterHeaderAddressStyle(recipientAddress))
v(1pt)
letterDateStyle(date)
v(1pt)
letterSubjectStyle(subject)
linebreak(); linebreak()
}
#let letterSignature(path) = {
linebreak()
place(right, dx:-5%, dy:0%, image(path, width: 25%))
}
/* Layout */
#let layout(doc) = {
set text(
font: textFont,
weight: "regular",
size: 11pt,
)
set par(
leading: 0.75em,
)
set align(left)
set page(
paper: "a4",
margin: (
left: 1.2cm,
right: 1.2cm,
top: .6cm,
bottom: 1.2cm,
),
)
doc
}
|
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-test-launcher/entry.typ | typst | Creative Commons Attribution Share Alike 4.0 International | #import "/packages.typ": notebookinator
#import notebookinator: *
#import themes.radial.components: *
#create-body-entry(
title: "Build: Moving Triballs",
type: "build",
date: datetime(year: 2023, month: 9, day: 6),
author: "<NAME>",
witness: "<NAME>",
)[
// Original text from John:
//The c-channel for the towers was cut, and most of the boxing was added. The mount points made of U-Channel were cut and assembled. The boxing in the drive train’s support towers was added.
#grid(
columns: (1fr, 2fr),
gutter: 20pt,
[
Today we worked on the base structure of the catapult.
1. We cut 2 lengths of C-channel down to 8 holes long. To serve as the side towers
of the catapult.
2. We screwed the bearings and motor cap to the towers.
3. We added the standoffs to the inside of the catapult as boxing.
4. We cut 1 hole long mounts out of U-channel that would connect the catapult
towers to the drivetrain.
5. We mounted the towers to the drivetrain.
Next meeting we'll work on the bracing on the side in order to stop the towers
from bending.
],
image("./towers.jpg"),
)
]
#create-body-entry(
title: "Build: Moving Triballs",
type: "build",
date: datetime(year: 2023, month: 9, day: 7),
author: "<NAME>",
witness: "Violet Ridge",
)[
// Original John text:
//The towers were completed and it was found that part of the bracing for the towers intersected with parts of the drive train. This was remedied by only using half of the bracing, which did not affect structural stability severely.
#grid(
columns: (1fr, 2fr),
gutter: 20pt,
[
Today we worked on the triangle bracing on the sides of the towers.
1. We assembled 4 lengths of standoffs and spacers, each one comprised of a 1"
standoff, a 1.5" standoff, and a 1/2" spacer.
2. We attached shaft collars to the end of the standoffs.
3. We screwed pillow bearings to the drivetrain and the top of the towers.
#admonition(
type: "warning",
)[
We discovered that one of the standoffs on each side interfered with the gears
in the drivetrain. We solved this by removing one standoff bracing from each
side, bringing us down to 2.
]
4. We screwed the shaft collars into the pillow bearings, completing the bracing.
],
image("./bracing-clearance.jpg"),
)
]
#create-body-entry(
title: "Build: Moving Triballs",
type: "build",
date: datetime(year: 2023, month: 9, day: 8),
author: "<NAME>",
witness: "<NAME>",
)[
// Original text from John:
// The throwing arm was completed with the exception of the side bracing. The spacing for the throwing arm’s axle was also completed.
#grid(
columns: (1fr, 1fr),
gutter: 20pt,
[
This meeting we worked on the throwing arm of the catapult. This is the part of
the catapult that will actually move up and down and is what holds the triballs.
1. We cut two pieces of half cut down to 19 holes.
2. We drilled out the holes two from the end so that the high strength axle could
fit through them.
4. We cut two pieces of half cut down to 8 holes to act as boxing for the base of
the arm.
5. We screwed the 8 hole pieces of half cut together with the 19 hole pieces to
complete the boxing.
6. We screwed the High strength 36 tooth gears to the boxing on the half cut.
7. We ran the axle through the middle of the gears and the towers on the catapult.
We also placed spacers on the axle to make sure everything maintained the
correct spacing.
8. We cut a piece of C-channel down to 13 holes.
9. We screwed the C-channel into the half cut, securing them together.
#admonition(
type: "warning",
)[
While figuring out the spacing for the axle we realized that the CAD was
incorrect. We ended up having to figure out the spacing by hand.
]
Next meeting we will finish the arm of the catapult and hopefully begin testing.
],
image("./incomplete-arm.jpg"),
)
]
#create-body-entry(
title: "Build: Moving Triballs",
type: "build",
date: datetime(year: 2023, month: 9, day: 9),
author: "<NAME>",
witness: "<NAME>",
)[
#grid(
columns: (1fr, 2fr),
gutter: 20pt,
[
//The throwing arm was completed, and the driven gear’s spacing was completed.
This meeting we completed the arm of the catapult.
1. We cut a piece of half cut down to 13 holes.
2. We screwed the piece of half cut to the end of the catapult arm.
3. We attached 90#sym.degree gussets to the end of the catapult to provide more
bracing
#admonition(
type: "note",
)[
This is a deviation from the CAD, we originally used two pieces of strip here.
The 90#sym.degree gussets provide much more rigidity and are a much better
choice here.
]
4. We screwed standoffs to the end of the catapult.
5. We screwed standoffs to the top bar on the towers to act as a point for the
rubber bands to be mounted.
],
image("./complete-arm.jpg"),
)
]
#create-body-entry(
title: "Test: Moving Triballs",
type: "test",
date: datetime(year: 2023, month: 9, day: 15),
author: "<NAME>",
witness: "<NAME>",
)[
= Testing Procedure
== General Testing
#image("./general-testing-cycle.svg", width: 55%)
== Trajectory Testing
#image("./trajectory-testing.svg", width: 50%)
= Results
#grid(
columns: (1fr, 1fr),
gutter: 20pt,
[
It was found upon initial testing that the driven axle bent when the catapult
was pulled back. This meant that the bottom 12 tooth gears would disengage and
begin to slip.
To remedy this, zip ties were used to brace the axle. This almost worked, but it
put too much stress on the bottom axle, heavily increasing friction and it still
didn't prevent all of the skipping. We decided to switch to a high strength axle
instead.
Different stops were tested, and an optimum trajectory was achieved. The slip
gears were modified to reflect these changes.
#admonition(
type: "note",
)[
For testing purposes we used 3D printed 12 tooth gears. This allowed us to make
slip gears relatively risk free.
]
Our final slip gear had 5 teeth.
],
figure(image("./stop-and-bands-down.jpg"), caption: "Rubber bands and stops"),
)
// TODO: image of 3D printed gears.
]
#create-body-entry(
title: "Build: Moving Triballs",
type: "build",
date: datetime(year: 2023, month: 9, day: 16),
author: "<NAME>",
witness: "Violet Ridge",
)[
#grid(
columns: (1fr, 2fr),
gutter: 20pt,
[
Due to our findings from last meeting we replaced the bottom axle on the
catapult (the one with the 12 tooth gears on it) with a high strength axle. This
required us to drill out the holes in our supporting towers so that a high
strength axle could fit. We also needed to change the type of spacers we were
using to high strength ones.
//The 3d printed slip-gear was replicated using a high strength 12 tooth gear.
After the testing from last week we knew the final number of teeth required for
the slip gear. We cut down steel 12 tooth gears so that they had 5 teeth instead
and replaced the 3D printed ones.
],
figure(image("./new-axle.jpg"), caption: "The new axle and gear"),
)
]
#create-body-entry(
title: "Build: Moving Triballs",
type: "build",
date: datetime(year: 2023, month: 9, day: 22),
author: "<NAME>",
witness: "<NAME>",
)[
#grid(
columns: (1fr, 2fr),
gutter: 20pt,
[
During testing we noticed that the motor on the catapult was not strong enough
to hold the catapult arm in the down position. In order to fix this we decided
to add a ratchet which will stop the catapult from being able to spin backwards.
A ratchet was added to the catapult using plexiglass and a 24 tooth gear. The
lexan was anchored to the side of the catapult with a flap protruding outwards.
This flap meshed with the teeth of the 24 tooth gear in such a way that the gear
could only move in one direction.
The ratchet was then upgraded to use a larger gear (36 tooth) and a longer piece
of lexan. The larger gear was designed to increase how precise the ratchet was
to allow the catapult to be loaded at a lower angle. The longer lexan was
designed to reduce the chance of the ratchet being over compressed and rotated
to a point where it did not hold the catapult in place.
],
image("./lexan-ratchet.svg", height: 75%),
)
#admonition(
type: "warning",
)[
This solution ended up not working due to the ratchet consistently failing. The
force of the rubber bands pulling on the catapult arm would pull bend the
ratchet backward, disengaging it and rendering it useless.
]
// TODO: take picture of old ratchet (or add drawing)
]
#create-body-entry(
title: "Build: Moving Triballs",
type: "build",
date: datetime(year: 2023, month: 9, day: 29),
author: "<NAME>",
witness: "Violet Ridge",
)[
#grid(
columns: (1fr, 1fr),
gutter: 20pt,
[
This meeting we constructed the new ratchet.
1. We cut a 4 hole long piece of steel L-channel
2. We anchored it to the top of the catapult tower with a screw joint to allow it
to rotate freely.
3. We attached a bearing to the L-channel to decrease the play of the screw joint.
#admonition(
type: "note",
)[
Another bearing was not needed on the anchoring piece of L-channel and would
interfere with its anchoring screws.
]
Overall this ratchet is much stronger than our previous design and can hold the
the catapult arm in place.
],
image("./new-ratchet.jpg"),
)
//#admonition(type: "build")[
//The catapult is finally complete! The ratchet and limit switch
//]
]
|
https://github.com/SWATEngineering/Docs | https://raw.githubusercontent.com/SWATEngineering/Docs/main/src/3_PB/LetteraDiPresentazionePB/content.typ | typst | MIT License | #import "functions.typ": glossary, team
/*************************************/
/* INSERIRE SOTTO IL CONTENUTO */
/*************************************/
= Introduzione
<NAME> Vardanega e Cardin,
#v(25pt)
con la presente il gruppo #team esprime la propria intenzione di candidarsi alla revisione di avanzamento _Product Baseline (PB)_ per il capitolato
#align(
center,
strong("InnovaCity")
)
proposto dall'azienda _Sync Lab_.
= Documentazione
All'interno del seguente #underline(link("https://swatengineering.github.io/","link")), sotto la sezione _PB_, è possibile trovare tutta la documentazione richiesta, in particolare:
- _AnalisiDeiRequisiti_2.0.pdf_;
- _Glossario_2.0.pdf_;
- _ManualeUtente_1.0.pdf_;
- _NormeDiProgetto_2.0.pdf_;
- _PianoDiProgetto_2.0.pdf_;
- _PianoDiQualifica_2.0.pdf_;
- _SpecificaTecnica_1.0.pdf_.
oltre a tutti i _Verbali Esterni_ ed _Interni_ divisi nelle relative categorie.
= Minimum Viable Product
Il prodotto software realizzato dal team è stato validato come Minimum Viable Product (MVP) da parte della Proponente Sync Lab in data *02/04/2024*, come descritto all'interno del verbale esterno di riferimento.
= Preventivo
#team ha completato il progetto con un costo totale di *10,787.5€*.
L'importo risulta leggermente più basso rispetto a quanto preventivato in occasione della prima revisione RTB (11,070€); ciò è dovuto al fatto che, rispetto alle 570 ore produttive preventivate inizialmente, il team ha effettivamente utilizzato 555 ore per svolgere le attività previste dal progetto fino alla seconda revisione PB.
Di seguito vengono dettagliate le ore produttive totali impiegate da ciascun componente del team:
#figure(
table(
columns:(auto,auto),
align: (x, y) => (center,center).at(x),
fill:(_,row) =>if row==0 {luma(150)} else if calc.odd(row) { luma(220)} else {white},
[*Membro*],[*Ore totali*],
[<NAME>],[92],
[<NAME>],[93],
[<NAME>],[93],
[<NAME>],[93],
[<NAME>],[92],
[<NAME>],[92],
[*Totali*],[*555*],
[*Rimanenti*],[*15*]
),
)
= Impegni ulteriori
Diversamente da quanto preventivato in occasione della prima revisione RTB, #team ha deciso di terminare il progetto una volta svolta la _Product Baseline_ e di non proseguire con la _Customer Acceptance (CA)_.
#v(50pt)
#pagebreak()
Cordiali saluti,
#team.
|
https://github.com/typst/packages | https://raw.githubusercontent.com/typst/packages/main/packages/preview/unichar/0.1.0/ucd/block-12400.typ | typst | Apache License 2.0 | #let data = (
("CUNEIFORM NUMERIC SIGN TWO ASH", "Nl", 0),
("CUNEIFORM NUMERIC SIGN THREE ASH", "Nl", 0),
("CUNEIFORM NUMERIC SIGN FOUR ASH", "Nl", 0),
("CUNEIFORM NUMERIC SIGN FIVE ASH", "Nl", 0),
("CUNEIFORM NUMERIC SIGN SIX ASH", "Nl", 0),
("CUNEIFORM NUMERIC SIGN SEVEN ASH", "Nl", 0),
("CUNEIFORM NUMERIC SIGN EIGHT ASH", "Nl", 0),
("CUNEIFORM NUMERIC SIGN NINE ASH", "Nl", 0),
("CUNEIFORM NUMERIC SIGN THREE DISH", "Nl", 0),
("CUNEIFORM NUMERIC SIGN FOUR DISH", "Nl", 0),
("CUNEIFORM NUMERIC SIGN FIVE DISH", "Nl", 0),
("CUNEIFORM NUMERIC SIGN SIX DISH", "Nl", 0),
("CUNEIFORM NUMERIC SIGN SEVEN DISH", "Nl", 0),
("CUNEIFORM NUMERIC SIGN EIGHT DISH", "Nl", 0),
("CUNEIFORM NUMERIC SIGN NINE DISH", "Nl", 0),
("CUNEIFORM NUMERIC SIGN FOUR U", "Nl", 0),
("CUNEIFORM NUMERIC SIGN FIVE U", "Nl", 0),
("CUNEIFORM NUMERIC SIGN SIX U", "Nl", 0),
("CUNEIFORM NUMERIC SIGN SEVEN U", "Nl", 0),
("CUNEIFORM NUMERIC SIGN EIGHT U", "Nl", 0),
("CUNEIFORM NUMERIC SIGN NINE U", "Nl", 0),
("CUNEIFORM NUMERIC SIGN ONE GESH2", "Nl", 0),
("CUNEIFORM NUMERIC SIGN TWO GESH2", "Nl", 0),
("CUNEIFORM NUMERIC SIGN THREE GESH2", "Nl", 0),
("CUNEIFORM NUMERIC SIGN FOUR GESH2", "Nl", 0),
("CUNEIFORM NUMERIC SIGN FIVE GESH2", "Nl", 0),
("CUNEIFORM NUMERIC SIGN SIX GESH2", "Nl", 0),
("CUNEIFORM NUMERIC SIGN SEVEN GESH2", "Nl", 0),
("CUNEIFORM NUMERIC SIGN EIGHT GESH2", "Nl", 0),
("CUNEIFORM NUMERIC SIGN NINE GESH2", "Nl", 0),
("CUNEIFORM NUMERIC SIGN ONE GESHU", "Nl", 0),
("CUNEIFORM NUMERIC SIGN TWO GESHU", "Nl", 0),
("CUNEIFORM NUMERIC SIGN THREE GESHU", "Nl", 0),
("CUNEIFORM NUMERIC SIGN FOUR GESHU", "Nl", 0),
("CUNEIFORM NUMERIC SIGN FIVE GESHU", "Nl", 0),
("CUNEIFORM NUMERIC SIGN TWO SHAR2", "Nl", 0),
("CUNEIFORM NUMERIC SIGN THREE SHAR2", "Nl", 0),
("CUNEIFORM NUMERIC SIGN THREE SHAR2 VARIANT FORM", "Nl", 0),
("CUNEIFORM NUMERIC SIGN FOUR SHAR2", "Nl", 0),
("CUNEIFORM NUMERIC SIGN FIVE SHAR2", "Nl", 0),
("CUNEIFORM NUMERIC SIGN SIX SHAR2", "Nl", 0),
("CUNEIFORM NUMERIC SIGN SEVEN SHAR2", "Nl", 0),
("CUNEIFORM NUMERIC SIGN EIGHT SHAR2", "Nl", 0),
("CUNEIFORM NUMERIC SIGN NINE SHAR2", "Nl", 0),
("CUNEIFORM NUMERIC SIGN ONE SHARU", "Nl", 0),
("CUNEIFORM NUMERIC SIGN TWO SHARU", "Nl", 0),
("CUNEIFORM NUMERIC SIGN THREE SHARU", "Nl", 0),
("CUNEIFORM NUMERIC SIGN THREE SHARU VARIANT FORM", "Nl", 0),
("CUNEIFORM NUMERIC SIGN FOUR SHARU", "Nl", 0),
("CUNEIFORM NUMERIC SIGN FIVE SHARU", "Nl", 0),
("CUNEIFORM NUMERIC SIGN SHAR2 TIMES GAL PLUS DISH", "Nl", 0),
("CUNEIFORM NUMERIC SIGN SHAR2 TIMES GAL PLUS MIN", "Nl", 0),
("CUNEIFORM NUMERIC SIGN ONE BURU", "Nl", 0),
("CUNEIFORM NUMERIC SIGN TWO BURU", "Nl", 0),
("CUNEIFORM NUMERIC SIGN THREE BURU", "Nl", 0),
("CUNEIFORM NUMERIC SIGN THREE BURU VARIANT FORM", "Nl", 0),
("CUNEIFORM NUMERIC SIGN FOUR BURU", "Nl", 0),
("CUNEIFORM NUMERIC SIGN FIVE BURU", "Nl", 0),
("CUNEIFORM NUMERIC SIGN THREE VARIANT FORM ESH16", "Nl", 0),
("CUNEIFORM NUMERIC SIGN THREE VARIANT FORM ESH21", "Nl", 0),
("CUNEIFORM NUMERIC SIGN FOUR VARIANT FORM LIMMU", "Nl", 0),
("CUNEIFORM NUMERIC SIGN FOUR VARIANT FORM LIMMU4", "Nl", 0),
("CUNEIFORM NUMERIC SIGN FOUR VARIANT FORM LIMMU A", "Nl", 0),
("CUNEIFORM NUMERIC SIGN FOUR VARIANT FORM LIMMU B", "Nl", 0),
("CUNEIFORM NUMERIC SIGN SIX VARIANT FORM ASH9", "Nl", 0),
("CUNEIFORM NUMERIC SIGN SEVEN VARIANT FORM IMIN3", "Nl", 0),
("CUNEIFORM NUMERIC SIGN SEVEN VARIANT FORM IMIN A", "Nl", 0),
("CUNEIFORM NUMERIC SIGN SEVEN VARIANT FORM IMIN B", "Nl", 0),
("CUNEIFORM NUMERIC SIGN EIGHT VARIANT FORM USSU", "Nl", 0),
("CUNEIFORM NUMERIC SIGN EIGHT VARIANT FORM USSU3", "Nl", 0),
("CUNEIFORM NUMERIC SIGN NINE VARIANT FORM ILIMMU", "Nl", 0),
("CUNEIFORM NUMERIC SIGN NINE VARIANT FORM ILIMMU3", "Nl", 0),
("CUNEIFORM NUMERIC SIGN NINE VARIANT FORM ILIMMU4", "Nl", 0),
("CUNEIFORM NUMERIC SIGN NINE VARIANT FORM ILIMMU A", "Nl", 0),
("CUNEIFORM NUMERIC SIGN TWO ASH TENU", "Nl", 0),
("CUNEIFORM NUMERIC SIGN THREE ASH TENU", "Nl", 0),
("CUNEIFORM NUMERIC SIGN FOUR ASH TENU", "Nl", 0),
("CUNEIFORM NUMERIC SIGN FIVE ASH TENU", "Nl", 0),
("CUNEIFORM NUMERIC SIGN SIX ASH TENU", "Nl", 0),
("CUNEIFORM NUMERIC SIGN ONE BAN2", "Nl", 0),
("CUNEIFORM NUMERIC SIGN TWO BAN2", "Nl", 0),
("CUNEIFORM NUMERIC SIGN THREE BAN2", "Nl", 0),
("CUNEIFORM NUMERIC SIGN FOUR BAN2", "Nl", 0),
("CUNEIFORM NUMERIC SIGN FOUR BAN2 VARIANT FORM", "Nl", 0),
("CUNEIFORM NUMERIC SIGN FIVE BAN2", "Nl", 0),
("CUNEIFORM NUMERIC SIGN FIVE BAN2 VARIANT FORM", "Nl", 0),
("CUNEIFORM NUMERIC SIGN NIGIDAMIN", "Nl", 0),
("CUNEIFORM NUMERIC SIGN NIGIDAESH", "Nl", 0),
("CUNEIFORM NUMERIC SIGN ONE ESHE3", "Nl", 0),
("CUNEIFORM NUMERIC SIGN TWO ESHE3", "Nl", 0),
("CUNEIFORM NUMERIC SIGN ONE THIRD DISH", "Nl", 0),
("CUNEIFORM NUMERIC SIGN TWO THIRDS DISH", "Nl", 0),
("CUNEIFORM NUMERIC SIGN FIVE SIXTHS DISH", "Nl", 0),
("CUNEIFORM NUMERIC SIGN ONE THIRD VARIANT FORM A", "Nl", 0),
("CUNEIFORM NUMERIC SIGN TWO THIRDS VARIANT FORM A", "Nl", 0),
("CUNEIFORM NUMERIC SIGN ONE EIGHTH ASH", "Nl", 0),
("CUNEIFORM NUMERIC SIGN ONE QUARTER ASH", "Nl", 0),
("CUNEIFORM NUMERIC SIGN OLD ASSYRIAN ONE SIXTH", "Nl", 0),
("CUNEIFORM NUMERIC SIGN OLD ASSYRIAN ONE QUARTER", "Nl", 0),
("CUNEIFORM NUMERIC SIGN ONE QUARTER GUR", "Nl", 0),
("CUNEIFORM NUMERIC SIGN ONE HALF GUR", "Nl", 0),
("CUNEIFORM NUMERIC SIGN ELAMITE ONE THIRD", "Nl", 0),
("CUNEIFORM NUMERIC SIGN ELAMITE TWO THIRDS", "Nl", 0),
("CUNEIFORM NUMERIC SIGN ELAMITE FORTY", "Nl", 0),
("CUNEIFORM NUMERIC SIGN ELAMITE FIFTY", "Nl", 0),
("CUNEIFORM NUMERIC SIGN FOUR U VARIANT FORM", "Nl", 0),
("CUNEIFORM NUMERIC SIGN FIVE U VARIANT FORM", "Nl", 0),
("CUNEIFORM NUMERIC SIGN SIX U VARIANT FORM", "Nl", 0),
("CUNEIFORM NUMERIC SIGN SEVEN U VARIANT FORM", "Nl", 0),
("CUNEIFORM NUMERIC SIGN EIGHT U VARIANT FORM", "Nl", 0),
("CUNEIFORM NUMERIC SIGN NINE U VARIANT FORM", "Nl", 0),
(),
("CUNEIFORM PUNCTUATION SIGN OLD ASSYRIAN WORD DIVIDER", "Po", 0),
("CUNEIFORM PUNCTUATION SIGN VERTICAL COLON", "Po", 0),
("CUNEIFORM PUNCTUATION SIGN DIAGONAL COLON", "Po", 0),
("CUNEIFORM PUNCTUATION SIGN DIAGONAL TRICOLON", "Po", 0),
("CUNEIFORM PUNCTUATION SIGN DIAGONAL QUADCOLON", "Po", 0),
)
|
https://github.com/horaoen/typstempl | https://raw.githubusercontent.com/horaoen/typstempl/master/cosheet.typ | typst | #let cosheet(
doc
) = {
set heading(numbering: "1.1")
set page(
paper: "a4",
numbering: "1",
number-align: right,
)
set par(
justify: true,
)
set text(
font: "Source Han Serif SC",
lang: "zh",
size: 12pt
)
// Display inline code in a small box
// that retains the correct baseline.
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,
)
show raw: it => {
set text(font: "FiraCode Nerd Font")
it
}
doc
}
|
|
https://github.com/soul667/typst | https://raw.githubusercontent.com/soul667/typst/main/PPT/MATLAB/touying/utils/utils.typ | typst | // OOP: call it or display it
#let call-or-display(self, it) = {
if type(it) == function {
return it(self)
} else {
return it
}
}
// OOP: empty page
#let empty-page(self) = {
self.page-args += (
header: none,
footer: none,
margin: 0em,
)
self.padding = (x: 0em, y: 0em)
self
}
// OOP: wrap methods
#let wrap-method(fn) = (self: none, ..args) => fn(..args)
// OOP: assuming all functions in dictionary have a named `self` parameter,
// `methods` function is used to get all methods in dictionary object
#let methods(self) = {
assert(type(self) == dictionary, message: "self must be a dictionary")
assert("methods" in self and type(self.methods) == dictionary, message: "self.methods must be a dictionary")
let methods = (:)
for key in self.methods.keys() {
if type(self.methods.at(key)) == function {
methods.insert(key, (..args) => self.methods.at(key)(self: self, ..args))
}
}
return methods
}
// touying wrapper mark
#let touying-wrapper(name, fn, ..args) = {
metadata((
kind: "touying-wrapper",
name: name,
fn: fn,
args: args,
))
}
#let slides(self) = {
let m = methods(self)
let res = (:)
for key in m.keys() {
res.insert(key, touying-wrapper.with(key, m.at(key)))
}
return res
}
// Utils: unify section
#let unify-section(section) = {
if section == none {
return none
} else if type(section) == dictionary {
return section + (short-title: section.at("short-title", default: auto))
} else if type(section) == array {
return (title: section.at(0), short-title: section.at(1, default: auto))
} else {
return (title: section, short-title: auto)
}
}
#let section-short-title(section) = {
if type(section) == dictionary {
if section.short-title == auto {
return section.title
} else {
return section.short-title
}
} else {
return section
}
}
// Utils: trim
#let trim(arr) = {
let i = 0
while arr.len() != i and arr.at(i) in ([], [ ], parbreak(), linebreak()) {
i += 1
}
arr.slice(i)
}
// Type: is sequence
#let is-sequence(it) = {
type(it) == content and it.has("children")
}
#let reconstruct(body-name: "body", named: false, it, body) = {
let fields = it.fields()
let _ = fields.remove("label", default: none)
let _ = fields.remove(body-name, default: none)
if named {
return (it.func())(..fields, body)
} else {
return (it.func())(..fields.values(), body)
}
}
#let heading-depth(it) = {
if it.has("depth") {
it.depth
} else {
it.level
}
}
// Code: HEIGHT/WIDTH FITTING and cover-with-rect
// Attribution: This file is based on the code from https://github.com/andreasKroepelin/polylux/pull/91
// Author: ntjess
#let _size-to-pt(size, styles, container-dimension) = {
let to-convert = size
if type(size) == "ratio" {
to-convert = container-dimension * size
}
measure(v(to-convert), styles).height
}
#let _limit-content-width(width: none, body, container-size, styles) = {
let mutable-width = width
if width == none {
mutable-width = calc.min(container-size.width, measure(body, styles).width)
} else {
mutable-width = _size-to-pt(width, styles, container-size.width)
}
box(width: mutable-width, body)
}
#let fit-to-height(
width: none, prescale-width: none, grow: true, shrink: true, height, body
) = {
// Place two labels with the requested vertical separation to be able to
// measure their vertical distance in pt.
// Using this approach instead of using `measure` allows us to accept fractions
// like `1fr` as well.
// The label must be attached to content, so we use a show rule that doesn't
// display anything as the anchor.
let before-label = label("touying-fit-height-before")
let after-label = label("touying-fit-height-after")
[
#show before-label: none
#show after-label: none
#v(1em)
hidden#before-label
#v(height)
hidden#after-label
]
locate(loc => {
let before = query(selector(before-label).before(loc), loc)
let before-pos = before.last().location().position()
let after = query(selector(after-label).before(loc), loc)
let after-pos = after.last().location().position()
let available-height = after-pos.y - before-pos.y
style(styles => {
layout(container-size => {
// Helper function to more easily grab absolute units
let get-pts(body, w-or-h) = {
let dim = if w-or-h == "w" {container-size.width} else {container-size.height}
_size-to-pt(body, styles, dim)
}
// Provide a sensible initial width, which will define initial scale parameters.
// Note this is different from the post-scale width, which is a limiting factor
// on the allowable scaling ratio
let boxed-content = _limit-content-width(
width: prescale-width, body, container-size, styles
)
// post-scaling width
let mutable-width = width
if width == none {
mutable-width = container-size.width
}
mutable-width = get-pts(mutable-width, "w")
let size = measure(boxed-content, styles)
if size.height == 0pt or size.width == 0pt {
return body
}
let h-ratio = available-height / size.height
let w-ratio = mutable-width / size.width
let ratio = calc.min(h-ratio, w-ratio) * 100%
if (
(shrink and (ratio < 100%))
or (grow and (ratio > 100%))
) {
let new-width = size.width * ratio
v(-available-height)
// If not boxed, the content can overflow to the next page even though it will
// fit. This is because scale doesn't update the layout information.
// Boxing in a container without clipping will inform typst that content
// will indeed fit in the remaining space
box(
width: new-width,
height: available-height,
scale(x: ratio, y: ratio, origin: top + left, boxed-content)
)
} else {
body
}
})
})
})
}
#let fit-to-width(grow: true, shrink: true, width, content) = {
style(styles => {
layout(layout-size => {
let content-size = measure(content, styles)
let content-width = content-size.width
let width = _size-to-pt(width, styles, layout-size.width)
if (
content-width != 0pt and
((shrink and (width < content-width))
or (grow and (width > content-width)))
) {
let ratio = width / content-width * 100%
// The first box keeps content from prematurely wrapping
let scaled = scale(
box(content, width: content-width), origin: top + left, x: ratio, y: ratio
)
// The second box lets typst know the post-scaled dimensions, since `scale`
// doesn't update layout information
box(scaled, width: width, height: content-size.height * ratio)
} else {
content
}
})
})
}
// semitransparency cover
#let cover-with-rect(..cover-args, fill: auto, inline: true, body) = {
if fill == auto {
panic(
"`auto` fill value is not supported until typst provides utilities to"
+ " retrieve the current page background"
)
}
if type(fill) == "string" {
fill = rgb(fill)
}
let to-display = layout(layout-size => {
style(styles => {
let body-size = measure(body, styles)
let bounding-width = calc.min(body-size.width, layout-size.width)
let wrapped-body-size = measure(box(body, width: bounding-width), styles)
let named = cover-args.named()
if "width" not in named {
named.insert("width", wrapped-body-size.width)
}
if "height" not in named {
named.insert("height", wrapped-body-size.height)
}
if "outset" not in named {
// This outset covers the tops of tall letters and the bottoms of letters with
// descenders. Alternatively, we could use
// `set text(top-edge: "bounds", bottom-edge: "bounds")` to get the same effect,
// but this changes text alignment and also misaligns bullets in enums/lists.
// In contrast, `outset` preserves spacing and alignment at the cost of adding
// a slight, visible border when the covered object is right next to the edge
// of a color change.
named.insert("outset", (top: 0.15em, bottom: 0.25em))
}
stack(
spacing: -wrapped-body-size.height,
body,
rect(fill: fill, ..named, ..cover-args.pos())
)
})
})
if inline {
box(to-display)
} else {
to-display
}
}
#let update-alpha(constructor: rgb, color, alpha) = constructor(..color.components(alpha: true).slice(0, -1), alpha)
// Code: check visible subslides and dynamic control
// Attribution: This file is based on the code from https://github.com/andreasKroepelin/polylux/blob/main/logic.typ
// Author: <NAME>
#let _parse-subslide-indices(s) = {
let parts = s.split(",").map(p => p.trim())
let parse-part(part) = {
let match-until = part.match(regex("^-([[:digit:]]+)$"))
let match-beginning = part.match(regex("^([[:digit:]]+)-$"))
let match-range = part.match(regex("^([[:digit:]]+)-([[:digit:]]+)$"))
let match-single = part.match(regex("^([[:digit:]]+)$"))
if match-until != none {
let parsed = int(match-until.captures.first())
// assert(parsed > 0, "parsed idx is non-positive")
( until: parsed )
} else if match-beginning != none {
let parsed = int(match-beginning.captures.first())
// assert(parsed > 0, "parsed idx is non-positive")
( beginning: parsed )
} else if match-range != none {
let parsed-first = int(match-range.captures.first())
let parsed-last = int(match-range.captures.last())
// assert(parsed-first > 0, "parsed idx is non-positive")
// assert(parsed-last > 0, "parsed idx is non-positive")
( beginning: parsed-first, until: parsed-last )
} else if match-single != none {
let parsed = int(match-single.captures.first())
// assert(parsed > 0, "parsed idx is non-positive")
parsed
} else {
panic("failed to parse visible slide idx:" + part)
}
}
parts.map(parse-part)
}
#let check-visible(idx, visible-subslides) = {
if type(visible-subslides) == "integer" {
idx == visible-subslides
} else if type(visible-subslides) == "array" {
visible-subslides.any(s => check-visible(idx, s))
} else if type(visible-subslides) == "string" {
let parts = _parse-subslide-indices(visible-subslides)
check-visible(idx, parts)
} else if type(visible-subslides) == content and visible-subslides.has("text") {
let parts = _parse-subslide-indices(visible-subslides.text)
check-visible(idx, parts)
} else if type(visible-subslides) == "dictionary" {
let lower-okay = if "beginning" in visible-subslides {
visible-subslides.beginning <= idx
} else {
true
}
let upper-okay = if "until" in visible-subslides {
visible-subslides.until >= idx
} else {
true
}
lower-okay and upper-okay
} else {
panic("you may only provide a single integer, an array of integers, or a string")
}
}
#let uncover(self: none, visible-subslides, uncover-cont) = {
let cover = self.methods.cover.with(self: self)
if check-visible(self.subslide, visible-subslides) {
uncover-cont
} else {
cover(uncover-cont)
}
}
#let only(self: none, visible-subslides, only-cont) = {
if check-visible(self.subslide, visible-subslides) { only-cont }
}
#let alternatives-match(self: none, subslides-contents, position: bottom + left) = {
let subslides-contents = if type(subslides-contents) == "dictionary" {
subslides-contents.pairs()
} else {
subslides-contents
}
let subslides = subslides-contents.map(it => it.first())
let contents = subslides-contents.map(it => it.last())
style(styles => {
let sizes = contents.map(c => measure(c, styles))
let max-width = calc.max(..sizes.map(sz => sz.width))
let max-height = calc.max(..sizes.map(sz => sz.height))
for (subslides, content) in subslides-contents {
only(self: self, subslides, box(
width: max-width,
height: max-height,
align(position, content)
))
}
})
}
#let alternatives(
self: none,
start: 1,
repeat-last: true,
..args
) = {
let contents = args.pos()
let kwargs = args.named()
let subslides = range(start, start + contents.len())
if repeat-last {
subslides.last() = (beginning: subslides.last())
}
alternatives-match(self: self, subslides.zip(contents), ..kwargs)
}
#let alternatives-fn(
self: none,
start: 1,
end: none,
count: none,
..kwargs,
fn
) = {
let end = if end == none {
if count == none {
panic("You must specify either end or count.")
} else {
start + count
}
} else {
end
}
let subslides = range(start, end)
let contents = subslides.map(fn)
alternatives-match(self: self, subslides.zip(contents), ..kwargs.named())
}
#let alternatives-cases(self: none, cases, fn, ..kwargs) = {
let idcs = range(cases.len())
let contents = idcs.map(fn)
alternatives-match(self: self, cases.zip(contents), ..kwargs.named())
}
// SIDE BY SIDE
#let side-by-side(columns: auto, gutter: 1em, ..bodies) = {
let bodies = bodies.pos()
if bodies.len() == 1 {
return bodies.first()
}
let columns = if columns == auto { (1fr,) * bodies.len() } else { columns }
grid(columns: columns, gutter: gutter, ..bodies)
} |
|
https://github.com/typst/packages | https://raw.githubusercontent.com/typst/packages/main/packages/preview/delegis/0.1.0/README.md | markdown | Apache License 2.0 | # delegis

A package and template for drafting legislative content in a German-style structuring, such as for bylaws, etc.
While the template is designed to be used in German documents, all strings are customizable. You can have a look at the `delegis.typ` to see all available parameters.
## General Usage
While this `README.md` gives you a brief overview of the package's usage, we recommend that you use the template (in the `template` folder) as a starting point instead.
### Importing the Package
```typst
#import "@preview/delegis:0.1.0": *
```
### Initializing the template
```typst
#show: it => delegis(
// Metadata
title: "Vereinsordnung zu ABCDEF", // title of the law/bylaw/...
abbreviation: "ABCDEFVO", // abbreviation of the law/bylaw/...
resolution: "3. Beschluss des Vorstands vom 24.01.2024", // resolution number and date
in-effect: "24.01.2024", // date when it comes into effect
draft: false, // whether this is a draft
// Template
logo: image("wuespace.jpg", alt: "WüSpace e. V."), // logo of the organization, shown on the first page
// Content
it
)
```
### Sections
Sections are auto-detected as long as they follow the pattern `§ 1 ...` or `§ 1a ...` in its own paragraph:
```typst
§ 1 Geltungsbereich
(1)
Diese Ordnung gilt für alle Mitglieder des Vereins.
(2)
Sie regelt die Mitgliedschaft im Verein.
§ 2 Mitgliedschaft
(1)
Die Mitgliedschaft im Verein ist freiwillig.
(2)
Sie kann jederzeit gekündigt werden.
§ 2a Ehrenmitgliedschaft
(1)
Die Ehrenmitgliedschaft wird durch den Vorstand verliehen.
```
### Overarching Sections
If you want to add more structure to your sections, you can use normal Typst headings. Note that only the level 6 headings are reserved for the section numbers:
```typst
= Allgemeine Bestimmungen
§ 1 ABC
§ 2 DEF
= Besondere Bestimmungen
§ 3 GHI
§ 4 JKL
```
### Sentence Numbering
If a paragraph contains multiple sentences, you can number them by adding a `#s~` at the beginning of the sentences:
```typst
§ 3 Mitgliedsbeiträge
#s~Die Mitgliedsbeiträge sind monatlich zu entrichten.
#s~Sie sind bis zum 5. des Folgemonats zu zahlen.
```
This automatically adds corresponding sentence numbers in superscript.
### Referencing other Sections
Referencing works manually by specifying the section number. While automations would be feasible, we have found that in practice, they're not as useful as they might seem for legislative documents.
In some cases, referencing sections using `§ X` could be mis-interpreted as a new section. To avoid this, use the non-breaking space character `~` between the `§` and the number:
```typst
§ 5 Inkrafttreten
Diese Ordnung tritt am 24.01.2024 in Kraft. §~4 bleibt unberührt.
```
|
https://github.com/richardso21/resume | https://raw.githubusercontent.com/richardso21/resume/master/RSOresume.typ | typst | // Thank you skyzh (<NAME>) - https://github.com/skyzh/typst-cv-template
#show heading: it => {
v(-5pt)
smallcaps(it)
}
#show link: underline;
#set page(
margin: (x: 1cm, y: 1cm),
paper: "us-letter",
)
#set par(justify: true)
#let icon(source) = {
box(baseline: 10%)[
#align(bottom)[
#text(font: "MesloLGS NF", size: 13pt)[
#h(.1em)
#source
#h(.1em)
]
]
]
}
#let separator() = {
v(-4pt)
line(length: 100%)
v(-5pt)
}
#let dateOutput(dates) = {
let t = type(dates)
if t != array {
if t == str {
return [#dates]
}
return []
}
let l = dates.len()
if l != 1 and l != 2 {
return []
}
if l == 1 {
return [#dates.at(0)]
} else {
return [#dates.at(0) --- #dates.at(1)]
}
}
#let resumeEntry(title, titleSeparator: [|], role, dates, body) = {
[
*#title* #h(1fr) #dateOutput(dates) \
#text(style: "italic")[#role]\
#body
]
}
// Single Line
#let resumeEntrySL(title, titleSeparator: [|], role, dates, body) = {
[
*#title* #titleSeparator #text(style: "italic")[#role] #h(1fr) #dateOutput(dates) \
#body
]
}
#align(center)[
#text(size: 16pt)[
= <NAME>
]
#v(-5pt)
#set box(height: 11pt)
#icon[] 347-281-3815 |
#icon[] <EMAIL> |
#icon[] #link("https://github.com/richardso21")[github.com/richardso21] |
#icon[] #link("https://linkedin.com/in/richardso21")[in/richardso21] |
#icon[] #link("https://sorichard.com")[sorichard.com]
]
== Education
#separator()
*Georgia Institute of Technology* #h(1fr) 08/2024 -- 05/2025 \
_M.S. Computer Science, Interactive Intelligence
#h(1fr) Atlanta, GA_ \
- Coursework: Machine Learning, Computer Vision, NLP, Data-Centric ML, Databases, Algorithms Honors
#v(-2pt)
*Georgia Institute of Technology* #h(1fr) 08/2021 -- 05/2024 \
_B.S. Computer Science --- GPA: 4.0
#h(1fr) Atlanta, GA_ \
== Work Experience
#separator()
#resumeEntry(
"Amazon Web Services",
"Software Engineering Intern (ML)",
("05/2024", "08/2024"),
)[
- Member of an investigative research team that quantitatively analyzes user and developer experience across AWS.
- Reduced runtime of an internal data pipeline by 85% leveraging a parallelized fork-join model with AWS Lambda functions.
- Automated activity labeling of user session screenshots using Amazon Rekognition, Textract, and Anthropic's Claude LLMs.
]
#resumeEntry(
"Georgia Tech Financial Services Innovation Lab",
"Research Assistant",
("05/2024", "Present"),
)[
- Explored benchmarking strategies to evaluate against state-of-the-art, fine-tuned LLMs in financial/economic contexts.
- Experimented with hierarchical knowledge graphs to aid in query-focused summarization tasks for LLMs with Graph RAG.
// - Devised robust document parsers with BeautifulSoup, RegEx, and spaCy to compile immense datasets for LLM fine-tuning.
]
#resumeEntry(
"Tanium",
"Software Engineering Intern",
("06/2023", "08/2023"),
)[
- Implemented CRUD logging into a backend PostgreSQL database and REST API to elevate user visibility of Tanium Server.
- Rapidly tackled 50+ Jira tickets within a 10-week internship maintaining a Knex.js and React TypeScript codebase.
- Exercised test-driven development and data validation best practices using Jest, Jasmine, and Joi.
]
#resumeEntry(
"Georgia Tech College of Computing",
"Senior Teaching Assistant",
("01/2023", "05/2024"),
)[
- Lectured biweekly to 50+ students on computer architecture foundations, the C language, and memory allocation concepts.
- Developed unit testing suites, docker images for auto-grading, and course software for 1000+ students per semester.
]
#resumeEntry(
"Union Pacific",
"Technology Intern",
("05/2022", "08/2022"),
)[
- Designed explainable ML regression models to estimate rail shipment prices for customers using XGBoost and SHAP.
- Performed rigorous feature engineering to achieve a 31% RMSE decrease versus UP's existing pricing analytics solution.
]
== Projects
// == Projects & Research
#separator()
#let githubIconLink(pageLink) = {
return [#text(style: "normal")[(#link(pageLink)[#icon[]])]]
}
#let githubRepoIcon(repoName, user: "richardso21") = {
let url = "https://github.com/" + user + "/" + repoName
return [#githubIconLink(url)]
}
// #resumeEntrySL(
// "LLM + 10-K",
// [Streamlit, Plotly, Google Gemini #githubRepoIcon("llm-plus-10k")],
// "05/2024")[
// - Constructed a web interface to extract and plot financial metrics extracted from the SEC EDGAR 10-K filings database.
// - Leveraged prompt engineering and Google Gemini 1.5 Flash to query data points consistently across all documents.
// ]
#resumeEntrySL(
"Generative Data Augmentation for Image Classification",
[PyTorch, Stable Diffusion, ControlNet #githubIconLink("https://richardso21.github.io/controlnet-augmentation/2024/04/20/final-project.html")],
"04/2024",
)[
- Experimented with multiple image generative models to enhance image classification accuracy when data is scarce.
- Observed a 10% F1 increase for Resnet-50 on a compact dataset when augmented with ControlNet-generated images.
]
#resumeEntrySL(
"LC3Tools",
[C++, Vue, Electron, LC-3 Assembly #githubRepoIcon("lc3tools", user: "gt-cs2110")],
("09/2023", "05/2024"),
)[
- Lead maintainer of the educational tooling suite to code, assemble, and simulate assembly programs for the
#link("https://en.wikipedia.org/wiki/Little_Computer_3")[LC-3].
// - Added 20+ major quality-of-life improvements through student and instructor feedback as a fork from the original project.
- Contributed 6000+ lines of code as major quality-of-life improvements through student and instructor feedback.
]
#resumeEntrySL(
"Alaskan Wildlife Image Segmentation",
[Python, PyTorch, Pillow #githubRepoIcon("serp2021-bgsub")],
"09/2021",
)[
- Utilized and refined the FgSegNet segmentation model to predict and automatically annotate animal presence in image data.
- 1#super[st] Award Winner of 2021 Terra NYC STEM Fair and
#link("https://web.archive.org/web/20230528094139if_/https://www.cfgnh.org/articles/milton-fisher-fund-awards-104-000-in-scholarships")[Milton Fisher Scholarship for Innovation and Creativity].
]
== Skills
#separator()
#v(-5pt)
#table(
columns: (auto, auto, auto),
align: (x, y) => (right, center, left).at(x),
inset: 3.5pt,
stroke: none,
[*Programming Languages*],
[|],
[Python, TypeScript/JavaScript, C/C++, Go, Java, Lua],
[*Frameworks & Libraries*],
[|],
[React, Vue, Express, Electron, Flask, NumPy, Pandas, SkLearn, PyTorch, HuggingFace],
[*Databases & Misc.*],
[|],
[PostgreSQL, SQLite, RocksDB, MongoDB, Firebase, Git, Docker, AWS, Neovim],
)
#v(-2.5pt)
|
|
https://github.com/vEnhance/1802 | https://raw.githubusercontent.com/vEnhance/1802/main/src/matrix.typ | typst | MIT License | #import "@local/evan:1.0.0":*
= Linear transformations and matrices
This section will be presented a bit differently than you'll see in many other places;
I talk about linear transformations first,
and then talk about matrices as an encoding of linear transformations.
I feel quite strongly this way is better, but if you are in an actual course,
their presentation is likely to be different (and worse).
== [TEXT] Linear transformation
The definition I'm about to give is the 18.700/18.701 definition of linear transform,
but the hill I will die on is that this definition is better than the one 18.02.
#definition(title: [Definition of linear transformation])[
A _linear transform_ $T : RR^n -> RR^m$ is _any_ map obeying
the two axioms $T(c bf(v)) = c T(bf(v))$ and $T(bf(v) + bf(w)) = T(bf(v)) + T(bf(w))$.
]
So it's a chonky boy: for every $bf(v) in RR^n$, there's an output value $T(bf(v)) in RR^m$.
I wouldn't worry too much about the axioms until later; for now, read the examples.
#example(title: [Examples of linear transformations])[
The following are all linear transformations from $RR^2$ to $RR^2$:
- The constant function where $T(bf(v)) = bf(0)$ for every vector $v$
- Projection onto the $x$-axis: $T(vec(x,y)) = vec(x,0)$.
- Rotation by an angle
- Reflection across a line
- Projection onto the line $y = x$.
- Multiplication by any $2 times 2$ matrix, e.g. the formula
$ T(vec(x,y)) = vec(x+2y,3x+4y) $
is a linear transformation too.
]
#tip[
Note that $T(bf(0)) = bf(0)$ in any linear transformation.
]
The important principle to understand is that if you know the values of a transformation $T$
at enough points, you can recover the rest.
Here's an easy example to start:
#ques[
If $T : RR^2 -> RR^2$ is a linear transform and it's given that
$ T( vec(3,4) ) = vec(pi, 9) " and " T( vec(100, 100) ) = vec(0, 12) $
what are the vectors for $T( vec(103,104) )$ and $T( vec(203, 204) )$?
] <pop1>
#soln[
$
T( vec(103,104) ) = vec(pi, 9) + vec(0, 12) = vec(pi, 21) \
T( vec(203,204) ) = vec(pi, 9) + 2 vec(0, 12) = vec(pi, 33). #qedhere
$
]
Here's another example.
#ques[
If $T : RR^2 -> RR^2$ is a linear transform and it's given that
$ T( vec(1,0) ) = vec(1, 3) " and " T( vec(0,1) ) = vec(2, 4) $
what is $T( vec(50, 70) )$?
] <pop2>
#soln[
$ T( vec(50, 70) ) = 50 vec(1,3) + 70 vec(2,4) = vec(190, 430). #qedhere $
]
More generally, the second question shows that if you know
$T( vec(1,0) )$ and $T( vec(0,1) )$
you ought to be able to _calculate_ the output of $T$ at any other vector like $vec(50,70)$.
To expand on this:
#eqn[
$ T( vec(a,b) ) = a T( vec(1,0) ) + b T( vec(0,1) ). $
<t-apply>
]
More generally, from understanding the solution to the above two questions,
you should understand the following important statement that we'll use over and over.
#memo[
Let $T : RR^n -> RR^m$ be a linear transformation.
If you know the outputs $T$ on a basis,
then you can deduce the value of $T$ at any other input.
]
For now "basis" refers to just the $n$ vectors $bf(e)_1$, ..., $bf(e)_n$.
But later on we will generalize this notion to some other settings too.
== [RECIPE] Matrix encoding
A _matrix_ is a way of _encoding_ the _outputs_ of $T$ using as few numbers as possible.
That is:
#definition[
A matrix *encodes all outputs* of a linear transformation $T$
by *writing the outputs* of $T(bf(e)_1)$, ..., $T(bf(e)_n)$ as a list of *column vectors*.
]
For example, if you had $T : RR^2 -> RR^2$ with
$ T( vec(1,0) ) = vec(1, 3) " and " T( vec(0,1) ) = vec(2, 4)
<==> T " encoded as " mat(1,2;3,4). $
To put this into recipe form:
#definition(title: [Definition for encoding a transformation])[
Given a transformation $T : RR^n -> RR^m$, to encode it as a matrix:
1. Compute $T(bf(e)_1)$ through $T(bf(e)_n)$ and write them as column vectors..
2. Glue them together to get an $n times m$ array of numbers.
]
Here's more examples.
#sample[
Let $T : RR^2 -> RR^2$ be projection onto the $x$-axis.
Write $T$ as a $2 times 2$ matrix.
]
#soln[
Note that
$ T(vec(1,0)) = vec(1,0) #h(2em) T(vec(0,1)) = vec(0,0). $
Glue these together and output $T$ as the matrix $ T = mat(1,0;0,0). #qedhere $
]
#remark[
You might note that indeed multiplication by the encoded matrix
$ mat(1,0;0,0) vec(x,y) = vec(x,0). $
matches what you expect: $vec(x,0)$ is indeed the projection of $vec(x,y)$ onto the $x$-axis!
And this works for every linear transformation.
This is so important I'll say it again next section, just mentioning it here first.
]
#sample[
Let $T : RR^2 -> RR^2$ be reflection around the line $y = x$.
Write $T$ as a $2 times 2$ matrix.
]
#soln[
Note that
$ T(vec(1,0)) = vec(0,1) #h(2em) T(vec(0,1)) = vec(1,0). $
Glue these together and output $T$ as the matrix $ T = mat(0,1;1,0). #qedhere $
]
#sample[
Let $T : RR^2 -> RR^2$ be counterclockwise rotation around the origin by $30 degree$.
Write $T$ as a $2 times 2$ matrix.
]
#soln[
See @fig-rotate-30.
By looking at the unit circle, we see that
$ T(bf(e_1)) = vec(cos 30 degree, sin 30 degree) = (sqrt(3)/2, 1/2). $
The vector $bf(e)_2$ is $90 degree$ further along
$ T(bf(e_2)) = vec(cos 120 degree, sin 120 degree) = (-1/2, sqrt(3)/2). $
Glue these together and output $T$ as the matrix
$ T = mat(sqrt(3)/2, -1/2; 1/2, sqrt(3)/2). #qedhere $
]
#figure(
image("figures/matrix-rot.png", width: auto),
caption: [Rotation by $30$ degrees.],
) <fig-rotate-30>
#remark(title: [Remark: This is where the rotation matrix comes from])[
If you redo this question with $30 degree$ replaced by any angle $theta$, you get the answer
$ T = mat(cos(theta), cos(theta+90 degree); sin(theta), sin(theta+90 degree)). $
So this is the matrix that corresponds to rotation.
However, in the literature you will often see this rewritten as
$ T = mat(cos(theta), -sin(theta); sin(theta), cos(theta)) $
to get rid of the $+90 degree$ offsets.
That's fine, but I think it kind of hides where the formula for rotation matrix comes from, personally.
]
Another example is the identity function:
#example(title: [Example: The identity matrix deserves its name])[
Let $I : RR^3 -> RR^3$ denote the 3D identity function, meaning $I(bf(v)) = bf(v)$.
To encode it, we look at its values at $bf(e)_1$, $bf(e)_2$, $bf(e)_3$:
$
I(bf(e)_1) = bf(e)_1 = vec(1,0,0),
#h(1em)
I(bf(e)_2) = bf(e)_2 = vec(0,1,0),
#h(1em)
I(bf(e)_3) = bf(e)_3 = vec(0,0,1).
$
We encode it as a matrix by writing the columns side by side, getting what you expect:
$ I " encoded as " mat(1,0,0;0,1,0;0,0,1). $
This gives a more natural reason why the identity matrix
is the one with $1$'s on the diagonal and $0$'s elsewhere
(compared to the "well try multiplying by it" you learned in high school).
]
== [TEXT] Matrix multiplication <matrix-mult>
In the prerequisites, I said that you were supposed to know the rule for
multiplying matrices, so you should already know for example that
$ mat(5,6;7,8) mat(1,2;3,4) = mat(23, 34; 31, 46). $
The goal of this section is to now explain why matrix multiplication
is defined in this funny way.
We will see two results:
- Multiplication of the matrix for $T$ by a column vector $bf(v)$
corresponds to evaluation $T(bf(v))$.
- Multiplication of the matrices for $S$ and $T$
gives the matrix for the composed function $S compose T$.#footnote[
The $compose$ symbol means the function where you apply $T$ first then $S$ first.
So for example, if $f(x) = x^2$ and $g(x) = x+5$, then
$(f compose g)(x) = f(g(x)) = (x+5)^2$.
We mostly use that circle symbol if we want to refer to $f compose g$ itself without the $x$,
since it would look really bad if you wrote "$f(g$" or something.
]
=== One matrix
Recall from @pop2 that if $T$ was the linear transformation for which
$ T(bf(e)_1) = vec(1,3) " and " T(bf(e)_2) = vec(2,4) $
then $ T( vec(50,70) ) = vec(190, 430). $
We just now also saw that to encode $T$ as a matrix, we have
$ T = mat(1,2;3,4). $
Now, what do you think happens if you compute
$ mat(1,2;3,4) vec(50,70) $
as you were taught in high school?
Surprise: you get
$ mat(1,2;3,4) vec(50,70) = vec(1 dot 50 + 2 dot 70, 3 dot 50 + 4 dot 70) = vec(190, 340)$
which is not just the same answer, but also the same intermediate calculations.
In other words,
#idea[
If one multiplies a matrix $M$ by a column vector $bf(v)$,
this corresponds to applying the linear transformation $T$ encoded by $M$ to $bf(v)$.
]
=== Two matrices
Now, any time we have functions in math, we can _compose_ them.
So let's play the same game with a pair of functions $S$ and $T$,
and think about their composition $S compose T$.
Imagine we got asked the following question:
#ques[
Let $T : RR^2 -> RR^2$ be a linear transform such that
$ T( vec(1,0) ) = vec(1, 3) " and " T( vec(0,1) ) = vec(2, 4). $
Then let $S : RR^2 -> RR^2$ be the linear transform such that
$ S( vec(1,0) ) = vec(5, 7) " and " S( vec(0,1) ) = vec(6, 8). $
Evaluate $S(T(vec(1, 0)))$ and $S(T(vec(0, 1)))$.
] <pop3>
#soln[
$
S(T(vec(1, 0))) = S(vec(1, 3)) = 1 vec(5,7) + 3 vec(6, 8) = vec(23, 31) \
S(T(vec(0, 1))) = S(vec(2, 4)) = 2 vec(5,7) + 4 vec(6, 8) = vec(34, 46). #qedhere
$
]
Now, $S compose T$ is _itself_ a function, so it makes sense to encode $S compose T$ as a matrix
too, using the answer to @pop3:
$
S(T(vec(1, 0))) = vec(23, 31) " and "
S(T(vec(0, 1))) = vec(34, 46)
<==>
S compose T " encoded as " mat(23, 34; 31, 46).
$
The matrix multiplication rule is then rigged to give the same answer
through the same calculation again:
$
mat(5,6;7,8) mat(1,2;3,4) = mat(23, 34; 31, 46).
$
In other words:
#idea[
If one multiplies two matrices $M$ and $N$,
this corresponds to composing the linear transformations that $M$ and $N$ encode.
]
This shows why the 18.700/18.701 definitions are better than the 18.02 ones.
In 18.02, the recipe for matrix multiplication is a _definition_:
"here is this contrived rule about taking products of columns and rows, trust me bro".
But in 18.700/18.701, the matrix multiplication recipe is a _theorem_;
it's what happens if you generalize @pop3 to eight variables
(or $n^2+n^2 = 2n^2$ variables for $n times n$ matrices).
#digression[
As an aside, this should explain why matrix multiplication is associative but not commutative:
- Because #link("https://w.wiki/BAHh")[function composition is associative],
so is matrix multiplication.
- Because function composition is _not_ commutative in general,
matrix multiplication isn't either.
]
== [EXER] Exercises
#exer[
If $A$ is a $3 times 3$ matrix with determinant $2$, what values could $det(10 A)$ take?
]
|
https://github.com/HellOwhatAs/sfbooks2typst | https://raw.githubusercontent.com/HellOwhatAs/sfbooks2typst/raw/main.typ | typst | #import "template.typ": *
#let title = "恐吓小说网";
#let author = "幻影大厦";
#show: project.with(
title: title,
authors: (author,),
abstract: "世上有三种人最惹不起,第一种是无欲无求的人,第二种是不怕死的人,第三种则是“恐吓小说网”的「作者」。 成为“恐吓小说网”的作者后,绪方周围越来越多地出现了怪异事件。",
)
#let parse-input(src) = if src.starts-with("#[") and src.ends-with("]") {
eval(src, mode: "markup")
} else { src }
#let data = json(title + "-" + author + ".json")
#for (catalog_name, catalog) in data {
heading(parse-input(catalog_name), level: 1);
for (cpt_name, cpt_content) in catalog {
heading(parse-input(cpt_name), level: 2);
for p in cpt_content {
par(parse-input(p))
}
}
} |
|
https://github.com/piepert/logik-tutorium-wise2024-2025 | https://raw.githubusercontent.com/piepert/logik-tutorium-wise2024-2025/main/src/templates/exercise.typ | typst | Creative Commons Zero v1.0 Universal | #import "@preview/grape-suite:1.0.0": exercise
#import "/src/packages/goals.typ": set-all-goals
#import exercise: *
#let project(body, ..a) = {
set text(lang: "de")
show: exercise.project.with(
university: [Universtität Rostock],
institute: [Institut für Philosophie],
seminar: [Tutorium: Sprache, Logik, Argumentation],
type: [Aufgabenblatt],
author: [<NAME>],
task-type: [Aufgabe],
hint-type: [Hinweis],
solution-type: [Lösungvorschlag],
extra-task-type: [Knobelei],
hints-title: [Hinweise],
solutions-title: [Lösungvorschläge],
box-example-title: [Beispiel],
box-hint-title: [Hinweis],
box-notice-title: [Achtung],
box-solution-title: [Lösung],
box-task-title: [Aufgabe],
..a
)
set-all-goals()
body
} |
https://github.com/GYPpro/DS-Course-Report | https://raw.githubusercontent.com/GYPpro/DS-Course-Report/main/Rep/0.typ | typst | #import "@preview/tablex:0.0.6": tablex, hlinex, vlinex, colspanx, rowspanx
// Display inline code in a small box
// that retains the correct baseline.
#set text(font:("Times New Roman","Source Han Serif SC"))
#show raw.where(block: false): box.with(
fill: luma(230),
inset: (x: 3pt, y: 0pt),
outset: (y: 3pt),
radius: 2pt,
)
// #set raw(align: center)
#show raw: set text(
font: ("consolas", "Source Han Serif SC")
)
#set page(
// flipped: true,
paper: "a4",
// background: [#image("background.png")]
)
#set text(
font:("Times New Roman","Source Han Serif SC"),
style:"normal",
weight: "regular",
size: 13pt,
)
#let nxtIdx(name) = box[ #counter(name).step()#counter(name).display()]
// Display block code in a larger block
// with more padding.
#show raw.where(block: true): block.with(
fill: luma(230),
inset: 7pt,
radius: 4pt,
)
#set par(
// first-line-indent: 1cm
)
#set math.equation(numbering: "(1)")
// 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: 22pt,
)
#[
#set align(
left+horizon
)
= 目录与绪论
#smallcaps[Overall]
#line(start: (0pt,-11pt),end:(300pt,-11pt))
#set text(
font:("Times New Roman","Source Han Serif SC"),
style:"normal",
weight:"regular",
size: 15pt,
)
本实验报告的基本结构如下(按逻辑顺序):
#tablex(
columns: 3,
[模块],[编号],[内容],
rowspanx(8)[STL风格的\ 泛型的\ 基础数据结构\ 容器实现],[1],[基于双向链表的`linkedList`],
(),[2],[基于增长数组的`vector`],
(),[3],[基于块状数组的`dataBlock`],
(),[4],[实现基于循环增长数组的`deque`],
(),[5],[基于`vector`实现`stack`],
(),[10],[基于R-BTree实现`set`],
(),[11],[基于R-BTree实现`map`],
(),[15],[基于Heap实现`priority_queue`],
rowspanx(3)[基础树/图结构],[6],[树上dfs(基础信息)],
(),[7],[图上bfs(最短路)],
(),[9],[R-BTree的基本实现],
rowspanx(4)[特殊结构\ 及其应用],[12],[字典树`Trie`],
(),[13],[线段树`segTree`],
(),[14],[堆`Heap`],
(),[16],[霍夫曼树`Huffman-tree`],
rowspanx(3)[在算法中应用],[17],[算数表达式求值(栈)],
(),[18],[括号匹配(栈)],
(),[19],[高精度计算],
)
// 老师辛苦了,感谢您一学期的付出!
本实验报告的所有代码文件、commit记录等已经在#smallcaps[Github]上同步了所有相关资料:
`https://github.com/GYPpro/DS-Course-Report`
本pdf提供了完整的目录,强烈建议在#smallcaps[Github]上下载阅读~
使用`typst`渲染
仓库会在7月10日前保持`private`
*这两页只是用来大概描述用的,归档时可以撕去*
// #[
// #set align(bottom)
// #line(start: (0pt,11pt),end:(270pt,11pt))
// #set text(19pt)
// 信息管理与信息系统 郭彦培\
// #set text(15pt)
// 暨南大学
// ]
]
]
#pagebreak()
#set text(
font:("Times New Roman","Source Han Serif SC"),
style:"normal",
weight:"regular",
size: 22pt,
)
#[
#set align(
left+horizon
)
= 容器设计原则
#smallcaps[Interface Reference]
#line(start: (0pt,-11pt),end:(300pt,-11pt))
#set text(
font:("Times New Roman","Source Han Serif SC"),
style:"normal",
weight:"regular",
size: 15pt,
)
```
Many containers have several member functions in common, and share functionalities. The decision of which type of container to use for a specific need does not generally depend only on the functionality offered by the container, but also on the efficiency of some of its members (complexity). This is especially true for sequence containers, which offer different trade-offs in complexity between inserting/removing elements and accessing them.
stack, queue and priority_queue are implemented as container adaptors. Container adaptors are not full container classes, but classes that provide a specific interface relying on an object of one of the container classes (such as deque or list) to handle the elements. The underlying container is encapsulated in such a way that its elements are accessed by the members of the container adaptor independently of the underlying container class used.
```
在模块`STL风格的、泛型的、基础数据结构容器实现`中所有的数据结构,遵循以下规范:
- 提供增删改查的接口;
- 提供完整的泛型系统;
- 提供迭代器用于遍历;
- 按结构性质提供随机访问
为了更契合`OOP`中的`SRP`原则,对于原STL中的容器适配器,本实验报告中并不通过接口实现,而是另起一个类。
] |
|
https://github.com/fsr/rust-lessons | https://raw.githubusercontent.com/fsr/rust-lessons/master/README.md | markdown | # Rust Lessons
## Compiling to pdf
You need the [typst] typesetting system.
To compile a specific lesson:
```shell
make lesson$number
make lesson1
```
To compile all lessons:
```shell
make all -j $(nproc)
```
## Lesson notes
How a specific lesson is planned
### Lesson 1
- 30 minutes installation of the toolchain
- 60 minutes for the basics
If someone does **not** have a working setup after 15 minutes,
instruct them to use the computer in front of them (assuming you are in the computer pools).
End with everyone trying out exercise 1
### Lesson 2
#### Funktionen
Explain what functions look like.
Order independent:
`seven()` is defined after its first use in the file.
Ask: Can anybody see an error?
-> use meaningful variable names
#### statements und expressions
- backtrack to tuple -> empty tuple -> unit type
#### Quiz 3 Fibonacci
-> overflow checks
- End: give many different input parameters without explicitly saying so
-> loop
#### loops
- `loop` `continue`, `break`
- with `if` + `else` we can exit loop
- `while`: condition tied to loop
[typst]: https://github.com/typst/typst |
|
https://github.com/Fabioni/Typst-TUM-Thesis-Template | https://raw.githubusercontent.com/Fabioni/Typst-TUM-Thesis-Template/main/template/main.typ | typst | MIT No Attribution | #import "@preview/tum-exzellenz-thesis:0.1.0": tum-exzellenz-thesis
//#import "@local/tum-exzellenz-thesis:0.1.0": tum-exzellenz-thesis // for development
#import "utils.typ": inwriting, draft, todo
#import "glossary.typ": glossary
#import "@preview/glossarium:0.2.6": make-glossary, print-glossary, gls, glspl
#show: make-glossary
/** Introduction
The philosophy of this template is that the template file itself only contains the template of the first pages of the thesis, that are the same for all thesis.
The formatting for the main part of the thesis is done here in the main.typ file. This looks less clean in the first place but has the advantage that you can easily change the formatting of the thesis, without the need to change the unreachable template file.
**/
/** Drafting
Set inwriting and draft inside utils.
The "draft" variable is used to show DRAFT in the header and the title. This should be true until the final version is handed-in.
The "inwriting" is used to change the appearance of the document for easier writing. Set to true for yourself but false for handing in a draft or so.
**/
// Global Settings //
#set text(lang: "en", size: 12pt)
#set text(ligatures: false)
#show: tum-exzellenz-thesis.with(
degree: "Master",
program: "Informatics",
supervisor: "Prof. Dr. <NAME>",
advisors: ("Dr. <NAME>", "<NAME> M.Sc.",),
author: "<NAME>",
startDate: "15.01.1799",
titleEnglish: "This is the title of the thesis",
titleGerman: "Das ist der Titel der Arbeit",
abstract_en: [
#lorem(60)
],
abstract_de: [#todo[Hier kommt die deutsche Übersetzung des englischen Abstracts hin]],
acknowledgements: [
I would like to express my gratitude to Fabian
],
submissionDate: datetime.today().display("[day].[month].[year]"),
showTitleInHeader: true,
draft: draft,
)
// Settings for Body //
// Set numbering mode
#set page(numbering: "1")
#set math.equation(numbering: "(1)")
#set heading(numbering: "1.1")
// Set fonts
#set text(font: "New Computer Modern")
#show raw: set text(font: "New Computer Modern Mono")
// Set font size
#show heading.where(level: 3): set text(size: 1.05em)
#show heading.where(level: 4): set text(size: 1.0em)
#show figure: set text(size: 0.9em)
// Set spacing
#set par(leading: 0.9em, first-line-indent: 1.8em, justify: true)
#show par: set block(spacing: 1em)
#set table(inset: 6.5pt)
#show table: set par(justify: false)
#show figure: it => [#v(1em) #it #v(1em)]
#show heading.where(level: 1): set block(above: 1.95em, below: 1em)
#show heading.where(level: 2): set block(above: 1.85em, below: 1em)
#show heading.where(level: 3): set block(above: 1.75em, below: 1em)
#show heading.where(level: 4): set block(above: 1.55em, below: 1em)
// Pagebreak after level 1 headings
#show heading.where(level: 1): it => [
#pagebreak(weak: true)
#it
]
// Names for headings
#set heading(supplement: it => {
if (it.has("level")) {
if it.level == 1 [Part]
else if it.level == 2 [Chapter]
else [Section]
} else {
[ERROR, this should not happen]
}
})
// Set citation style
#set cite(style: "alphanumeric")
// Table stroke
#set table(stroke: 0.5pt + black)
// show reference targets in brackets
#show ref: it => {
let el = it.element
if el != none and el.func() == heading {
[#it (#el.body)]
} else [#it]
}
// color links and references
#show ref: set text(fill: color.olive)
#show link: set text(fill: blue)
// style table-of-contents
#show outline.entry.where(
level: 1
): it => {
v(1em, weak: true)
strong(it)
}
// Draft Settings //
#if inwriting {
show cite: set text(fill: blue)
show footnote: set text(fill: purple)
set cite(style: "chicago-author-date")
}
// ------ Content ------
// Table of contents.
#outline(
title: {
text(1.3em, weight: 700, "Contents")
v(10mm)
},
indent: 2em,
depth: 3
)
#pagebreak(weak: false)
// --- Main Chapters ---
#include "Chapter_Introduction.typ"
//#include "Chapter_Background.typ"
//#include "Chapter_RelatedWork.typ"
//#include "Chapter_Methodology.typ"
//#include "Chapter_Experiments.typ"
//#include "Chapter_Discussion.typ"
//#include "Chapter_FutureResearch.typ"
// --- Appendixes ---
// restart page numbering using roman numbers
#set page(numbering: "i")
#counter(page).update(1)
#include("Chapter_Appendix.typ")
// List of Acronyms.
#heading(numbering: none)[List of Acronyms]
#print-glossary(glossary)
// List of figures.
#heading(numbering: none)[List of Figures]
#outline(
title: none,
target: figure.where(kind: image),
)
// List of tables.
#heading(numbering: none)[List of Tables]
#outline(
title: none,
target: figure.where(kind: table)
)
// --- Bibliography ---
#set par(leading: 0.7em, first-line-indent: 0em, justify: true)
#bibliography("items.bib", style: "apa") |
https://github.com/Personal-Data-Acquisition/PDA_paperwork | https://raw.githubusercontent.com/Personal-Data-Acquisition/PDA_paperwork/main/scope_and_vision/src/jake_code_review_notes.typ | typst | = Hale, <NAME>:
#label("hale-stanley-calvin")
prototype car and audio engine.
commented out code/debug statments in the code on line 31,36 could be
cleaned up a bit.
Using rust, so that’s really cool.
It’s using a entity componet system?
Code seperation is nice, and I can see he’s put a lot of work into
breaking code into smaller sized functions.
audio changing based on the locatino for both audio channels.
Possibility of doppler effect? Compression the soundwaves for approch
and lowering the pitch as it moves away?
Q: what is the game engine? Bevy?
= Giamakidis, Yannis
#label("giamakidis-yannis")
Creation of AI for game zomebies.
- enemy movement & chase functionality
- using ai tools in URE5
- always chase AI.
- patrolling AI.
- Nexus AI.
Code and control flow? The way URE5 works is interesting but I won’t lie
I don’t totally understand the strange graphs being used to control it.
Eventgraphs seem interesting but I’m not sure what the code looks like
behind the scenes.
= <NAME>
#label("cheng-kai-s")
Also part of zombie survival group.
His personal goal was being in charge of the UI, so the HUD(heads up
display) along with the menu’s and inventory.
|
|
https://github.com/jamesrswift/musicaux | https://raw.githubusercontent.com/jamesrswift/musicaux/main/src/template.typ | typst |
#let score(
title: [A Ballad in Typst Time],
subtitle: [Op 1 No. 1 Mov. 1--3],
author: [],
body
) = {
set text(size: 20pt)
set align(center)
[
#set text(font: "New Computer Modern", size: 20pt)
#title
#linebreak()
]
[
#set text(font: "New Computer Modern", size: 12pt)
#subtitle
]
[
#set text(font: "New Computer Modern", size: 12pt)
#align(right, text(size: 12pt, author))
]
[
#set align(center)
#v(1em)
#body
]
} |
|
https://github.com/WinstonMDP/math | https://raw.githubusercontent.com/WinstonMDP/math/main/exers/2.typ | typst | #import "../cfg.typ": *
#show: cfg
$ "Prove that" all(a > 1): lim_(QQ in.rev x -> 0) a^x = 1 $
That is,
$all(epsilon > 0) ex(delta > 0) all(x in QQ):
0 < abs(x) < delta -> abs(a^x - 1) < epsilon$.
$all(x in QQ): x > 0 -> a^x > 1$.
$ex(N) all(n > N): a^(1/n) - 1 < epsilon$.
$a^(1/(N + 1)) - 1 < epsilon$.
$ex(N') all(n > N): 1 - a^(-1/n) < epsilon$.
$1 - a^(-1/(N + 1)) < epsilon$.
I'm proving that $all(x in QQ): 0 < abs(x) < 1/(N + 1) -> abs(a^x - 1) < epsilon$.
- $x > 0$.
$a^x > 1$.
$a^x - 1 < a^(1/(N + 1)) - 1 < epsilon$.
- $x < 0$.
$a^x < 1$.
$-x < 1/(N + 1)$.
$-1/(N + 1) < x$.
$1 - a^x < 1 - a^(-1/(N + 1)) < epsilon$.
|
|
https://github.com/typst-jp/typst-jp.github.io | https://raw.githubusercontent.com/typst-jp/typst-jp.github.io/main/README.md | markdown | Apache License 2.0 | # Typst 日本語ドキュメント (非公式)
[](https://github.com/typst-jp/typst-jp.github.io/actions/workflows/deploy.yml)
[](https://github.com/typst-jp/typst-jp.github.io/issues/44)
> [!NOTE]
> For English version, please refer to [README.en.md](README.en.md).
組版システム [Typst](https://typst.app/docs) の非公式な日本語ドキュメントです。[Typst GmbH](https://typst.app/legal/) の許諾を得て作成されています。
このリポジトリは[中国語版](https://github.com/typst-doc-cn/typst-doc-cn.github.io)からフォークして作成され、2024年10月時点での最新版である [Typst v0.12.0](https://typst.app/docs/changelog/#v0.12.0) の公式ドキュメントを元に日本語訳を行います。
実際に作動している Web 版は、以下の URL から閲覧できます。
> https://typst-jp.github.io/docs/
## 翻訳に参加するには
[翻訳ガイドライン (CONTRIBUTING.md)](CONTRIBUTING.md) をご覧の上、[Pull Request](https://github.com/typst-jp/typst-jp.github.io/pulls) を作成してください。[Issue](https://github.com/typst-jp/typst-jp.github.io/issues)での質問や議論も歓迎します。
ご質問などがある場合は、[「くみはんクラブ」のDiscordサーバー](https://discord.gg/9xF7k4aAuH)に参加してご連絡ください。
## 翻訳参加者
<table cellspacing="0" cellpadding="0">
<tbody>
<tr>
<td align="center" valign="top" width="14.28%"><a href="https://github.com/mkpoli"><img src="https://github.com/mkpoli.png" width="100px" alt="mkpoli"/><br /><sub><b>mkpoli</b></sub></a><br/><code>mkpoli</code><br/>言い出しっぺ<br/>保守者</td>
<td align="center" valign="top" width="14.28%"><a href="https://github.com/3w36zj6"><img src="https://github.com/3w36zj6.png" width="100px" alt="3w36zj6"/><br /><sub><b>3w36zj6</b></sub></a><br/><code>3w36zj6</code><br/>インフラ整備<br/>保守者</td>
<td align="center" valign="top" width="14.28%"><a href="https://github.com/stepney141"><img src="https://github.com/stepney141.png" width="100px" alt="stepney141"/><br /><sub><b>stepney141</b></sub></a><br/><code>stepney141</code><br/>インフラ整備<br/>保守者</td>
<td align="center" valign="top" width="14.28%"><a href="https://github.com/gomazarashi"><img src="https://github.com/gomazarashi.png" width="100px" alt="gomazarashi"/><br /><sub><b>gomazarashi</b></sub></a><br/><code>gomazarashi</code><br/>翻訳者<br/>保守者</td>
<td align="center" valign="top" width="14.28%"><a href="https://github.com/monaqa"><img src="https://github.com/monaqa.png" width="100px" alt="monaqa"/><br /><sub><b>monaqa</b></sub></a><br/><code>monaqa</code><br/>翻訳者<br/>保守者</td>
<td align="center" valign="top" width="14.28%"><a href="https://github.com/kimushun1101"><img src="https://github.com/kimushun1101.png" width="100px" alt="Shunsuke KIMURA"/><br /><sub><b>Shunsuke KIMURA</b></sub></a><br/><code>kimshun1101</code><br/>保守者<br/>翻訳者</td>
</tr>
<tr>
<td align="center" valign="top" width="14.28%"><a href="https://github.com/zr-tex8r"><img src="https://github.com/zr-tex8r.png" width="100px" alt="Takayuki YATO"/><br /><sub><b>Takayuki YATO</b></sub></a><br/><code>zr-tex8r</code><br/>アドバイザー</td>
<td align="center" valign="top" width="14.28%"><a href="https://github.com/m1sk9"><img src="https://github.com/m1sk9.png" width="100px" alt="Sho Sakuma"/><br /><sub><b>Sho Sakuma</b></sub></a><br/><code>m1sk9</code><br/>校正者</td>
<td></td>
<td></td>
<td></td>
<td></td>
</tr>
</tbody>
</table>
|
https://github.com/daskol/typst-templates | https://raw.githubusercontent.com/daskol/typst-templates/main/neurips/appendix.typ | typst | MIT License | = Appendix / supplemental material
Optionally include supplemental material (complete proofs, additional
experiments and plots) in appendix. All such materials *SHOULD be included in
the main submission*.
|
https://github.com/jgm/typst-hs | https://raw.githubusercontent.com/jgm/typst-hs/main/test/typ/compiler/while-01.typ | typst | Other | // Value of while loops.
// Ref: false
#test(while false {}, none)
#let i = 0
#test(type(while i < 1 [#(i += 1)]), "content")
|
https://github.com/rabotaem-incorporated/algebra-conspect-1course | https://raw.githubusercontent.com/rabotaem-incorporated/algebra-conspect-1course/master/sections/02-complex-numbers/!sec.typ | typst | Other | #import "../../config.typ"
#if config.enable-chapters-from-sem1 [
#import "../../utils/core.typ": *
= Комплексные числа
#include "01-construction.typ"
#include "02-trig-form.typ"
#include "03-complex-roots.typ"
] |
https://github.com/Akida31/anki-typst | https://raw.githubusercontent.com/Akida31/anki-typst/main/typst/examples/secondary.typ | typst | #import "../src/lib.typ" as anki
#import anki.theorems: item
#show: anki.setup.with(enable_theorems: true)
#set heading(numbering: "1.")
#let theorem = item("Theorem", initial_tags: ("proof",))
#let example = item("Example", initial_tags: ("example",))
#let definition = item("Definition", initial_tags: ("definition",))
= Heading1
#theorem("Euclid")[
Theorem-content
][
This is a proof
]
#example("Numbered part 2", number: n => "?" + n + "!")[
This is numbered differently depending on the current number
]
#example("Numbered", number: "42")[
This is numbered differently and has no influence.
]
#example("Pythagoras")[
Did you know?
$ a^2 + b^2 = c^2 $
]
#example("triangle", secondary: auto)[
#sym.triangle.tr.filled
]
#example("another triangle", secondary: auto)[
#sym.triangle.t.stroked
]
#definition("Imaginery unit")[
We define the Imaginery unit $i$ by its property $i^2 = -1$.
]
#example("one last triangle", secondary: auto)[
#sym.triangle.br.stroked
]
|
|
https://github.com/chamik/gympl-skripta | https://raw.githubusercontent.com/chamik/gympl-skripta/main/cj-dila/17-hana.typ | typst | Creative Commons Attribution Share Alike 4.0 International | #import "/helper.typ": dilo
#dilo("Hana", "hana", "<NAME>", "", "současnost", "ČR", "2017", "epika", "historický román")
#columns(2, gutter: 1em)[
*Téma*\
Životní příběh tří generací židovské rodiny během 2. sv. v.
*Motivy* \
Holokaust, obyčejní lidé a strasti
*Časoprostor*\
Valašské Meziříčí, Terezín, Osvětim; před, během a po 2. sv. v.
*Postavy* \
_<NAME>._ -- dcera _Rosy_ \
_<NAME>._ -- dcera _Elsy H._ \
_<NAME>._ -- dcera _Elsy H._ \
_<NAME>._ -- manželka _<NAME>._ \
_<NAME>_ -- manel _Elsy H._ \
_<NAME>._ -- přítelkyně _Elsy_ \
_<NAME>._ -- syn Ludmily \
_<NAME>_ -- přítel _Hany_ \
_<NAME>_ -- přítelkyně _Hany_ \
_<NAME>_ -- děti _Ivy_ a _<NAME>._
*Kompozice* -- tři velké části "Já, Mira"; "Ti přede mnou", "Já, Hana".
*Vypravěč* \
První a druhá část _Mira_, třetí _Hana_.
*Jazykové prostředky*\
Nevýrazná spisovná čeština.
*Obsah*\
První část nám vypráví devítiletá _Mira_ o svém dětství ve Valašském Meziříčí (1954), kdy ji tyfová epidemie náhle připraví o celou rodinu. Ze dne na den se ocitne v péči své depresivní tety _Hany_. I když je Hana ještě mladá, má zdravotní problémy a potíže komunikovat s lidmi. Život s ní není jednoduchý. _Mira_ má sice střechu nad hlavou a má co jíst, ale citů od tety _Hany_ se nikdy nedočkala.
Druhá část nás vrátí do meziválečného období a do doby druhé světové války; dospívání naivně zamilované _Hany_ a její tiché, stále nemocné sestry _Rosy_. Přibližuje nelehký život Židů, politickou situaci doby a možnosti emigrace. V okamžiku, kdy začnou platit protižidovské zákony, se změní celý jejich život. Najednou musí chodit nakupovat jen v určité hodiny, nesmějí vlastnit obchod jako dosud, atp.
V třetí části se změní vypravěč, stává se jím sama _Hana_. Popisuje hrůzy ghetta Terezín, kam byla transportována se svou rodinou. Jen mladší sestru _Rosu_ matka před transportem schovala ke známým. V Terezíně zůstala pouze _Hana_, zbytek rodiny pokračoval dále do Osvětimi. Nikoho z nich už _Hana_ nikdy neviděla. I přes nelidské zacházení, prodělaný tyfus a ostatní strasti se _Hana_ vrátila z koncentračního tábora domů.
*Literárně historický kontext*\
Doufám poměrně jasný.
]
#pagebreak()
*Ukázka*
A to byla pravda pravdoucí. <NAME> byla jediný dospělý,
od kterého jsem nikdy neslyšela slovo nesmíš. Vlastně jsem od
ní málokdy slyšela i nějaké jiné slovo, protože teta Hana skoro
vůbec nemluvila, jenom zírala. Tak divně. Jako kdyby se dívala,
ale neviděla. Jako kdyby odešla, ale tělo zapomněla na židli.
Chvílemi jsem dostala strach, že se najednou sesune na zem
a zbude po ní jen hromádka černých hadrů.
Mohlo mě napadnout, že maminka se bude tety Hany zastávat. T<NAME>ana byla její starší sestra a vlastně jediná příbuz-
ná, kterou jsme měli. Maminka ji měla hrozně ráda, čemuž
jsem se docela divila, protože teta nikdy nedala najevo, že by
jí na komkoli z nás záleželo. Jednou jsem viděla, jak ji po příchodu chtěla maminka obejmout, ale teta ucukla, jako kdyby
se o ni popálila. Maminka se na ni vždycky usmívala, mluvila
na ni konejšivě, jako na malou holčičku, a kdyby ji o to teta požádala, snesla by jí snad i modré z nebe. Ale teta ji ani nikoho
jiného nikdy o nic nepožádala. Prostě jen seděla v obývacím pokoji a dívala se do prázdna a někdy ze sebe vydala krátkou odpověď hlasem, který zněl úplně stejně jako ten maminčin.
Zasedli jsme ke slavnostnímu obědu a já jsem napůl očekávala, že místo svíčkové přistane na mém talíři hrachová kaše.
Během dopoledních výzkumných cest do kuchyně jsem sice
nevypozorovala, že by pro mě maminka vařila hrách, ale z jejího odměřeného chování jsem vytušila, že včerejší záležitost
s koupelí ještě není uzavřená.
Dostala jsem stejné jídlo jako ostatní. Že by mi maminka
u příležitosti svých třicátých narozenin udělila milost?
Už jsem začínala doufat, ale pak přišel čas na moučník.
Nádherné, báječné žloutkové věnečky s lesklou cukrovou polevou, koupené k této zvláštní a mimořádné události přímo
v cukrárně u náměstí.
Maminka je z tácku zvedala stříbrnými kleštičkami a jeden kousek za druhým pokládala na dezertní talířky se zlatým
lemováním, které vyndávala ze sekretáře jen při slavnostních
2 0
příležitostech. První položila před tetu, pak před tatínka, Dagmarku a Otu. Potom se rozhlédla a řekla: „Tak, a ještě jeden
pro mě.“
„A co já?“ zeptala jsem se poněkud unáhleně, protože jsem
věděla, jakou uslyším odpověď.
„Ty si zákusek nezasloužíš. Šla jsi k řece, i když jsi věděla,
že to máš zakázané, a navíc jsi mi ještě lhala.“
#pagebreak() |
https://github.com/Enter-tainer/typstyle | https://raw.githubusercontent.com/Enter-tainer/typstyle/master/tests/assets/unit/code/equation-dot-chain.typ | typst | Apache License 2.0 | #let a = $a^b$.body.has("t")
#a
|
https://github.com/connachermurphy/typst-cv | https://raw.githubusercontent.com/connachermurphy/typst-cv/main/README.md | markdown | MIT License | # typst-cv
CV template for Typst.
## Planned Improvements
- [X] Working paper environment with reverse numbering
- [X] Working paper alignment
- [X] Create header
- [X] Extend working paper environment to WIP and publications
- [X] Fix header spacing
- [X] Add last updated date
- [X] Link email
- [X] Add research assistance
- [X] Link styling
- [X] Check page dimensions
## Scattered Ideas
### Paper environment
Make a full array of paper attributes and use a grid for number/text justification. |
https://github.com/adam-zhang-lcps/papers | https://raw.githubusercontent.com/adam-zhang-lcps/papers/main/coffee-filter-drag.typ | typst | Creative Commons Attribution Share Alike 4.0 International | #import "@preview/tablex:0.0.6": tablex, rowspanx
#import "aet-lab-report-template.typ": aet-lab-report
#show: doc => aet-lab-report(
title: "Investigating Drag Forces on Falling Coffee Filters",
course: "AET AP Physics C: Mechanics",
teacher: "Mr. <NAME>",
date: datetime(year: 2023, month: 12, day: 7),
doc,
)
= Introduction
== Purpose
Determine the model of drag that most accurately represents the motion of a
coffee filter falling from rest. Determine the effect of mass on terminal
velocity.
== Hypothesis
The model of drag that will most accurately represent the motion of the coffee
filter is laminar flow, or $F_"drag" = -b v$. Laminar flow more closely models
objects moving at relatively slow velocities, such as the coffee filter.
Assuming a laminar flow ($n = 1$ in $-b v^n$; see #link(label("background"), "Background")),
mass will have a directly proportional relationship with terminal velocity.
The derivation for this conclusion is as follows: beginning with Newton's 2nd
Law, the coffee filter experiences a downward force of gravity, and a drag
force in the opposite direction.
$ a = (m g - b v^n)/m $
Since terminal velocity is reached when acceleration is equal to zero, the
equation can be solved for velocity as follows.
$ 0 = (m g - b v^n)/m $
$ 0 = m g - b v^n $
$ m g = b v^n $
$ v^n = (m g)/b $
Again, assuming a laminar flow, $n = 1$, resulting in velocity being directly
proportional to mass.
== Background <background>
Objects moving through fluids, including air, experience a resistive force
opposing the direction of their motion. The magnitude of this resistive force,
or drag force, is dependent upon the velocity of the object.
$ F_"drag" = -b v^n $
$b$ is a constant that depends upon many factors, such as the density of the
fluid and the cross-sectional area of the object. $n$ indicates the type of
drag relationship, of which there are commonly two: laminar flow, where $n = 1$,
and turbulent flow, where $n = 2$. Laminar flow is commonly experienced by
objects moving at relatively low velocities, whilst turbulent flow is
experienced by objects moving at relatively high velocities.
Since drag is dependent upon velocity, an accelerating object will eventually
reach a point where the drag force is equivalent to the force providing
acceleration. This state is known as terminal velocity, where the object will
no longer gain or lose speed @Hilsdorf2023CoffeeFilterDragHandout.
Objects that experience relatively high drag forces will reach terminal
velocity quickly. This experiment will measure the terminal velocity of a
coffee filter, a lightweight object with a large cross-sectional area, and
will attempt to determine which model of drag more accurately fits the
motion---laminar or turbulent. Additionally, this experiment will attempt to
determine how the mass of an object affects the terminal velocity by stacking
multiple coffee filters together.
= Methods
== Materials
The following materials are required for this experiment.
- Balance
- 5 large coffee filters
- Vernier#emoji.reg Motion Sensor
- Vernier#emoji.reg Graphical Analysis software
The setup for this experiment is shown in @setup.
#figure(
image("assets/coffee-filter-drag/coffee-filter-setup.jpeg", width: 50%),
caption: "Experimental Setup",
)<setup>
== Procedures
The following procedure was implemented during this experiment.
+ Open Vernier#emoji.reg Graphical Analysis and pair with the Vernier#emoji.reg Motion
Sensor. Place the Motion Sensor on the ground, facing upwards.
+ Measure the mass of a single coffee filter using the balance. Record the mass
in @data. <proc-outer-start>
+ Hold the coffee filter high above the motion sensor. Begin collecting data in
Vernier#emoji.reg Graphical Analysis, then drop the coffee filter.
<proc-inner-start>
+ Once the coffee filter reaches the ground, end the data collection.
+ Highlight the linear section of the position vs. time graph in Vernier#emoji.reg Graphical
Analysis. Apply a linear fit curve. Record the slope in @data as terminal
velocity. An example is shown in @vernier-example. <proc-inner-end>
+ Repeat steps #link(label("proc-inner-start"), "3")#sym.dash.en#link(label("proc-inner-end"), "5") to
obtain data for a second trial. <proc-outer-end>
+ Repeat steps #link(label("proc-outer-start"), "2")#sym.dash.en#link(label("proc-outer-end"), "6") for
2, 3, 4, and 5 filters stacked together.
+ Plot mass vs. terminal velocity. Fit a linear trendline, and record the slope
and $R^2$ in @trendlines.
+ Plot mass vs. terminal velocity squared. Fit a linear trendline, and record
the slope and $R^2$ in @trendlines.
#figure(
image(
"assets/coffee-filter-drag/coffee-filter-vernier-screenshot.png",
width: 70%,
),
caption: [Example of Selecting and Fitting a Linear Trendline to Find Terminal Velocity],
) <vernier-example>
= Results
== Data
@data shows the determined terminal velocity and calculated terminal velocity
squared for each trial for each stack of filters, along with the mass for each
stack of filters.
#figure(tablex(
align: center + horizon,
columns: 5,
[\# of Filters],
[Mass (kg)],
[Trials],
[$V_T$ (m/s)],
[$V_T^2$ (m#super([2])/s#super([2]))],
rowspanx(2)[1],
rowspanx(2)[0.03],
[1],
[0.8601],
[0.7398],
[2],
[0.8377],
[0.7017],
rowspanx(2)[2],
rowspanx(2)[0.07],
[1],
[1.244],
[1.548],
[2],
[1.223],
[1.496],
rowspanx(2)[2],
rowspanx(2)[0.10],
[1],
[1.521],
[2.313],
[2],
[1.571],
[2.468],
rowspanx(2)[2],
rowspanx(2)[0.14],
[1],
[1.652],
[2.729],
[2],
[1.711],
[2.928],
rowspanx(2)[2],
rowspanx(2)[0.17],
[1],
[2.075],
[4.306],
[2],
[1.894],
[3.587],
), caption: "Terminal Velocity per Filter Stack", kind: table) <data>
== Calculations
To determine whether laminar flow ($n = 1$) or turbulent flow ($n = 2$) was a
better fit for the motion of the coffee filter, two graphs were created;
@tv-vs-mass fits a linear equation to mass vs. terminal velocity, and
@tv2-vs-mass fits a linear equation to mass vs. terminal velocity squared.
#figure(image(
"assets/coffee-filter-drag/coffee-filter-drag-mass-vs-tm.png",
width: 70%,
), caption: "Mass vs. Terminal Velocity") <tv-vs-mass>
#figure(image(
"assets/coffee-filter-drag/coffee-filter-drag-mass-vs-tm2.png",
width: 70%,
), caption: "Mass vs. Terminal Velocity Squared") <tv2-vs-mass>
#figure(tablex(
align: center + horizon,
columns: (20%, 20%),
[Data Range],
[$R^2$],
[$V_T$],
[0.962],
[$V_T^2$],
[0.954],
), caption: [$R^2$ per Data Range], kind: table) <trendlines>
= Discussion
== Conclusion
The experiment was successful in accomplishing its purpose, and both
hypotheses were supported by the data collected.
As shown in @trendlines, a linear fit of mass vs terminal velocity ($V_T$) was
a better fit, indicating that the drag force in the motion of the coffee
filter is better modeled by a laminar flow, where $F_"drag" = -b v$.
As shown in @tv-vs-mass, an increase in mass correlated with an increase in
terminal velocity. Given the high accuracy of a linear fit to the data, the
correlation is likely linear as hypothesized.
== Errors
The primary source of error is the requirement for human judgement in
determining terminal velocity. To determine terminal velocity, the graph of
position vs. time for the falling coffee filter was manually observed, and the
linear-appearing section was selected, and applied with a linear curve fit.
This could cause random error in the data collected, since the judgement was
imprecise. Additionally, the time that the filter spent with terminal velocity
was small, making errors likely to be amplified. Further experimentation could
make use of more advanced equipment and instruments as well as a further fall
distance to eliminate this error.
Another possible source of error is the movement of the coffee filter while
falling. Given that the shape of the filter is not perfectly uniform, drag
forces would cause the filter to rotate, changing the cross-sectional area and
consequently the $b$ value which is assumed to be constant. Further
experimentation could attempt to reduce this error via carefully constructed
apparatus or account for the change in calculations.
== Extensions
Drag forces play a large role in everyday interactions, and understanding of
their behavior plays a key role in designing complex machinery such as
vehicles. One example are airplanes, which are heavily affected by drag
forces, especially at their high speeds. Another example of drag forces are
within fluids, such as water; submarines moving through the ocean are also
subject to drag forces. In both these cases, understanding of drag forces is
crucial in making them possible. |
https://github.com/maucejo/cnam_templates | https://raw.githubusercontent.com/maucejo/cnam_templates/main/template/main_presentation.typ | typst | MIT License | #import "../src/cnam-templates.typ": *
#show: cnam-presentation.with(
composante: "lmssc",
// composante: "cnam",
// color-set: "medium-blue",
// color-set: "clear-blue",
config-info(
title: [Titre de la présentation],
subtitle: [Sous-titre de la présentation],
over-title: ("Diaporama","de présentation"),
// facade: "image",
facade: "photo",
),
)
#title-slide
= Titre de la section
== Sous-titre de la section
#lorem(20)
#focus-slide[
#text(size: 2em, weight: "semibold")[Merci de votre attention]
#linebreak()
Remerciements
] |
https://github.com/npujol/chuli-cv | https://raw.githubusercontent.com/npujol/chuli-cv/main/modules/styles.typ | typst | MIT License | #let colors = (
accent: rgb("#007fad"),
inactive: luma(170),
navy: rgb("#001f3f"),
aqua: rgb("#7fdbff")
)
#let vLine() = [
#h(5pt)
]
#let hline() = [
#box(width: 1fr, line(stroke: 0.9pt, length: 100%))
]
#let dashed-line() = [
line(
length: 100%,
stroke: (
paint: colors.inactive,
thickness: 1pt,
dash: "dashed"
)
)
]
#let page-style = (
paper: "a4",
margin: (
left: 1cm,
right: 1cm,
top: 0.8cm,
bottom: 0.4cm,
)
)
#let body-style = (
fonts: ("Source Sans Pro", "Font Awesome 6 Brands", "Font Awesome 6 Free"),
size: 10pt,
weight: "regular"
)
#let list-style = (
indent: 1em
)
#let header-style = (
fonts: ("Source Sans Pro"),
table: (
columns: (5fr, 1fr),
column-gutter: 30pt
),
full-name: (
size: 36pt,
weight: "bold"
),
job-title: (
size: 18pt,
weight: "bold"
),
profile-photo: (
width: 100pt,
height: 100pt,
stroke: none,
radius: 9999pt,
image-height: 10.0cm
),
margins: (
between-info-and-socials: 2.5mm,
bottom: 3pt
),
socials: (
column-gutter: 10pt
)
)
#let section-style = (
title: (
size: 16pt,
weight: "bold",
font-color: black
),
margins: (
top: 3pt,
right-to-hline: 2pt,
)
)
#let entry-style = (
table: (
columns: (5%, 1fr)
),
title: (
size: 10pt,
weight: "bold",
color: black
),
company-or-university: (
size: 10pt,
weight: "bold",
color: colors.accent
),
time-and-location: (
size: 10pt,
weight: "regular",
color: black
),
margins: (
top: 3pt,
between-logo-and-title: 8pt,
between-title-and-subtitle: 3pt,
between-time-and-location: 10pt,
between-icon-and-text: 5pt
)
)
// Skills
#let skills-style = (
columns: (18%, 1fr),
stroke: 1pt + colors.accent,
radius: 20%,
margins: (
between-skill-tags: 6pt,
between-categories: -4pt
)
)
// language
#let language-style = (
columns: (18%, 1fr),
stroke: 1pt + colors.accent,
radius: 5pt,
margins: (
top: 3pt,
between-tags: 3pt,
between-categories: -6pt,
between-icon-and-text: 5pt
)
)
// Education with table style
#let fancy_education = (
margins: (
top: 3pt,
between-logo-and-text: 5pt,
)
) |
https://github.com/lkndl/typst-bioinfo-thesis | https://raw.githubusercontent.com/lkndl/typst-bioinfo-thesis/main/modules/headers.typ | typst |
#let header-styles(body) = {
// This styles the headers
show selector(<all-header>): it => {
align(center, emph(it))
}
show selector(<left-header>): it => {
align(left, emph(it))
}
show selector(<right-header>): it => {
align(right, emph(it))
}
body
}
#let set-headers(
// This is just a utility function to make the template.typ cleaner, and it attaches the labels used for styling
all: none, odd: none, even: none) = {
locate(loc => {
if all != none {
assert(odd == none and even == none)
[#all <all-header>]
} else if calc.even(loc.page()){
[#even <left-header>]
} else {
[#odd <right-header>]
}
})
}
#let get-open-section(
level: 1, skip-level-1: true, descend-to-level: none
) = {
// if there are no headings with the given level in the current chapter but lower-level ones, use those
locate(loc => {
if query(heading.where(level: 1), loc).any(
m => m.location().page() == loc.page()
) and skip-level-1 {
// no header on pages with a Level 1 heading = new chapter beginning
return
}
let loc-neighbours(things) = {
let open = query(things.before(loc), loc).at(-1, default: none)
let next = query(things.after(loc), loc).at(0, default: none)
return (open, next)
}
let limit-query(above, below, things) = {
if above != none {
things = things.after(above.location())
}
if below != none {
things = things.before(below.location())
}
things
}
// find recursion init args
// headings that at least have the right level
let level-headings = heading.where(level: level)
// but do not go out of parent
let outer = loc-neighbours(heading.where(level: level - 1))
// throw some out
level-headings = limit-query(..outer, level-headings)
// find the current and the next chapter
let (open, next) = loc-neighbours(level-headings)
let find(l, open, next) = {
// recurse into lower levels
let lh = heading.where(level: l)
let outer = loc-neighbours(heading.where(level: l - 1))
lh = limit-query(..outer, lh)
(open, next) = loc-neighbours(lh)
if descend-to-level != none and l >= descend-to-level {
return none
} else if open == none and next == none {
return find(l + 1, open, next)
} else {
return open
}
}
let section = find(level, open, next)
if section == none {
return none
}
// a little formatting helper
let number(it) = {
if it.numbering == none {
none
} else {
[#numbering(it.numbering, ..counter(heading).at(it.location())) ] // with space
}
}
// actually generate the content
number(section) + section.body
})
} |
|
https://github.com/elipousson/typstdoc | https://raw.githubusercontent.com/elipousson/typstdoc/main/README.md | markdown | Creative Commons Zero v1.0 Universal | # typstdoc Format
## Installing typstdoc
```bash
quarto use template elipousson/typstdoc
```
This will install the format extension and create an example qmd file
that you can use as a starting place for your document.
To skip the template (which is only just intendended as an example):
```bash
quarto add elipousson/typstdoc
```
## Using typstdoc
This format extends the existing typst template with more complete coverage of settable parameters for the `page`, `text`, and `par` Typst elements:
- [`page`](https://typst.app/docs/reference/layout/page/)
- `paper` (set by `papersize`)
- `flipped`
- `margin`
- `fill`
- `numbering` (set by `page-numbering`)
- `number-align` (set by `page-number-align`)
- `header`
- `header-ascent`
- `footer`
- `footer-descent`
- [`text`](https://typst.app/docs/reference/text/text/)
- `font` (set by `mainfont`)
- `fill` (set by `fontfill`)
- `weight` (set by `fontweight`)
- `spacing` (set as a default property of `par` blocks)
- `slashed-zero`
- [`par`](https://typst.app/docs/reference/model/par/)
- `justify`
- `first-line-indent`
- `hanging-indent`
- `linebreaks`
- `leading`
These additional parameters allow more fine-grained control over the typography and appearance of the document. You can set the font, size, and fill for the headings (using `heading-font`, `heading-fontfill`, etc.) and font, weight, and size for the title (using `title-font`, `title-fontweight`, etc.).
You can custom the color of the main body, heading, title, footer, and header text using the fill parameters. By default, these elements all inherit the main font fill.
This format includes experimental support for a listing of figures (set `lof: true`) which mostly works and a listing of tables (set `lot: true`) which mostly doesn't work.
This format supports hex color strings (with or without a hash symbol at the start of the string) and standard Typst color names (see [color](https://typst.app/docs/reference/visualize/color/) for documentation). Both quoted and unquoted fill parameters are allowed as the following example shows:
```yaml
---
format:
typstdoc-typst:
title: "Typst Document Title"
heading-fontfill: blue
title-fontfill: "#0074d9"
footer: "This is a custom footer"
footer-fontfill: 0074d9
---
```
You can also set the font, size, fill, and align for the header and footer and provide custom text for the header or footer. Note the page number will be suppressed if `page-number-align` is set to `bottom` when footer is supplied or `top` when header is supplied.
```yaml
---
title: "My Paper"
author: <NAME>
format:
typstdoc-typst:
mainfont: "Roboto"
fontsize: 18pt
leading: 12pt
heading-font: "Roboto Narrow"
heading-fontfill: blue
monofont: "Roboto Code"
---
```
The format also overrides the standard template for callouts by converting units from `pt` to `em` to ensure that the size of the border and padding around the callout text is appropriate when using a large `papersize`. While main font defaults to a point size value (11pt), the other font sizes are set using em units to allow everything to scale to match the main `fontsize` value.
This format is published under the [CC0 1.0 Universal](https://creativecommons.org/publicdomain/zero/1.0/) public domain license.
|
https://github.com/typst/packages | https://raw.githubusercontent.com/typst/packages/main/packages/preview/unichar/0.1.0/ucd/block-AA00.typ | typst | Apache License 2.0 | #let data = (
("CHAM LETTER A", "Lo", 0),
("CHAM LETTER I", "Lo", 0),
("CHAM LETTER U", "Lo", 0),
("CHAM LETTER E", "Lo", 0),
("CHAM LETTER AI", "Lo", 0),
("CHAM LETTER O", "Lo", 0),
("CHAM LETTER KA", "Lo", 0),
("CHAM LETTER KHA", "Lo", 0),
("CHAM LETTER GA", "Lo", 0),
("CHAM LETTER GHA", "Lo", 0),
("CHAM LETTER NGUE", "Lo", 0),
("CHAM LETTER NGA", "Lo", 0),
("CHAM LETTER CHA", "Lo", 0),
("CHAM LETTER CHHA", "Lo", 0),
("CHAM LETTER JA", "Lo", 0),
("CHAM LETTER JHA", "Lo", 0),
("CHAM LETTER NHUE", "Lo", 0),
("CHAM LETTER NHA", "Lo", 0),
("CHAM LETTER NHJA", "Lo", 0),
("CHAM LETTER TA", "Lo", 0),
("CHAM LETTER THA", "Lo", 0),
("CHAM LETTER DA", "Lo", 0),
("CHAM LETTER DHA", "Lo", 0),
("CHAM LETTER NUE", "Lo", 0),
("CHAM LETTER NA", "Lo", 0),
("CHAM LETTER DDA", "Lo", 0),
("CHAM LETTER PA", "Lo", 0),
("CHAM LETTER PPA", "Lo", 0),
("CHAM LETTER PHA", "Lo", 0),
("CHAM LETTER BA", "Lo", 0),
("CHAM LETTER BHA", "Lo", 0),
("CHAM LETTER MUE", "Lo", 0),
("CHAM LETTER MA", "Lo", 0),
("CHAM LETTER BBA", "Lo", 0),
("CHAM LETTER YA", "Lo", 0),
("CHAM LETTER RA", "Lo", 0),
("CHAM LETTER LA", "Lo", 0),
("CHAM LETTER VA", "Lo", 0),
("CHAM LETTER SSA", "Lo", 0),
("CHAM LETTER SA", "Lo", 0),
("CHAM LETTER HA", "Lo", 0),
("CHAM VOWEL SIGN AA", "Mn", 0),
("CHAM VOWEL SIGN I", "Mn", 0),
("CHAM VOWEL SIGN II", "Mn", 0),
("CHAM VOWEL SIGN EI", "Mn", 0),
("CHAM VOWEL SIGN U", "Mn", 0),
("CHAM VOWEL SIGN OE", "Mn", 0),
("CHAM VOWEL SIGN O", "Mc", 0),
("CHAM VOWEL SIGN AI", "Mc", 0),
("CHAM VOWEL SIGN AU", "Mn", 0),
("CHAM VOWEL SIGN UE", "Mn", 0),
("CHAM CONSONANT SIGN YA", "Mc", 0),
("CHAM CONSONANT SIGN RA", "Mc", 0),
("CHAM CONSONANT SIGN LA", "Mn", 0),
("CHAM CONSONANT SIGN WA", "Mn", 0),
(),
(),
(),
(),
(),
(),
(),
(),
(),
("CHAM LETTER FINAL K", "Lo", 0),
("CHAM LETTER FINAL G", "Lo", 0),
("CHAM LETTER FINAL NG", "Lo", 0),
("CHAM CONSONANT SIGN FINAL NG", "Mn", 0),
("CHAM LETTER FINAL CH", "Lo", 0),
("CHAM LETTER FINAL T", "Lo", 0),
("CHAM LETTER FINAL N", "Lo", 0),
("CHAM LETTER FINAL P", "Lo", 0),
("CHAM LETTER FINAL Y", "Lo", 0),
("CHAM LETTER FINAL R", "Lo", 0),
("CHAM LETTER FINAL L", "Lo", 0),
("CHAM LETTER FINAL SS", "Lo", 0),
("CHAM CONSONANT SIGN FINAL M", "Mn", 0),
("CHAM CONSONANT SIGN FINAL H", "Mc", 0),
(),
(),
("CHAM DIGIT ZERO", "Nd", 0),
("CHAM DIGIT ONE", "Nd", 0),
("CHAM DIGIT TWO", "Nd", 0),
("CHAM DIGIT THREE", "Nd", 0),
("CHAM DIGIT FOUR", "Nd", 0),
("CHAM DIGIT FIVE", "Nd", 0),
("CHAM DIGIT SIX", "Nd", 0),
("CHAM DIGIT SEVEN", "Nd", 0),
("CHAM DIGIT EIGHT", "Nd", 0),
("CHAM DIGIT NINE", "Nd", 0),
(),
(),
("CHAM PUNCTUATION SPIRAL", "Po", 0),
("CHAM PUNCTUATION DANDA", "Po", 0),
("CHAM PUNCTUATION DOUBLE DANDA", "Po", 0),
("CHAM PUNCTUATION TRIPLE DANDA", "Po", 0),
)
|
https://github.com/ludovic-esperce/cdc-javacard | https://raw.githubusercontent.com/ludovic-esperce/cdc-javacard/main/cdc-javacard.typ | typst | #import "@local/afpa-document:0.1.0": afpa
// Déclaration des variables
#let title = "Cahier des charges : Javacard"
#let subtitle = "Projet de développement d'application Desktop"
#let date = datetime.today()
#let author = "<NAME>"
#show: doc => afpa(
title,
subtitle,
date,
author,
doc
)
#outline()
#pagebreak()
= Introduction
L'objectif de ce projet est de développer une application "desktop" Java permettant de gérer une liste de contacts et d'exporter les informations sous différents formats.
Choix technologiques :
- l'application doit être codée en Java (version 17 ou ultérieure)
- l'interface graphique devra être construite avec JavaFX
- les vues de l'application devront être codées en FXML
- pas de contrainte sur les bibliothèques utilisables
Modalités de travail :
- date de début du projet : 26/07/2024
- présentation du projet : 07/08/2024
- équipes de 2
- gestion du projet inspiré par la méthode *Scrum*
- utilisation d'un dépôt Git partagé
Livrables attendus :
- code source de l'application
- diagrammes UML éventuels
- "zoning" et "wireframe" de l'interface graphique
#pagebreak()
= Fonctionnalités de l'application
Vous trouverez dans cette partie du cahier des charges une liste des fonctionnalités attendues pour le logiciel, ci-dessous un tableau récapitulatif. Chaque fonctionnalité est accompagné de son indicateur #link("https://fr.wikipedia.org/wiki/M%C3%A9thode_MoSCoW")[MoSCoW]:
#table(
columns: (1fr, auto),
inset: 10pt,
align: horizon,
fill: (_, y) =>
if y == 0 { rgb("#d5e8b5") },
table.header(
[Fonctionnalité], [MoSCoW],
),
[Interface graphique ergonomique proposant une gestion des contacts (CRUD sur les contacts)],
[*M*],
[Sauvegarde des informations de contact pour les recharger lorsque le logiciel se lance],
[*M*],
[Export d'un ou plusieurs contacts en *JSON*],
[*M*],
[Export d'un ou plusieurs contacts en *vCard*],
[*M*],
[Rechercher dans la liste des contact],
[*S*],
[Générer un QRCode contenant les informations de la vCard et l'afficher à l'écran],
[*C*],
[Export d'un ou plusieurs contacts en *CSV*],
[*C*]
)
Dans la suite de ce document, vous trouverez des informations détaillées sur ces différentes fonctionnalités.
#pagebreak()
== Gestion de contacts
L'application devra proposer une *interface graphique ergonomique* permettant de gérer une liste de contacts.
#align(center)[#image("assets/crud.png", width: 80%)]
Les opérations attendues sont les opérations *CRUD* :
- consultations d'une liste de contact(s)
- création de contact(s)
- modification de contact(s)
- suppression de contact(s)
Une contact est défini par les caractéristiques suivantes :
- *nom* (obligatoire)
- *prénom* (obligatoire)
- *genre* : homme/femme/non-binaire (obligatoire)
- *date de naissance* (optionnel)
- *un pseudonyme* (optionnel)
- *adresse* (obligatoire)
- *numéro de téléphone personnel* (obligatoire)
- *numéro de téléphone professionnel* (optionnel)
- *une adresse email* (obligatoire)
- *une adresse postale* (obligatoire)
- *un lien vers la page Github ou Gitlab du contact* (optionnel)
=== Affichage des contacts et création/modification
Un *tableau* qui liste tous les contacts gérés par l'application est à intégrer à l'interface principale.
Sur la même vue, un formulaire de création/modification devra être intégrer. Le clic sur une ligne du tableau devra pré-remplir les champ du formulaire pour permettre la modification de l'élément.
#block(inset: 8pt, radius: 8pt, fill: rgb("#F58C82"))[
Veillez à bien vérifier la validité des informations saisies par l'utilisateur pour les champs :
- adresse email
- lien vers la page Github ou Gitlab
]
Si l'utilisateur saisit des données incorrectes il faudra une *indication visuelle* explicite indiquant le champ est en erreur.
La vérification de ces informations pourra se faire en utilisant des *expressions régulières*.
Une expression régulière est une chaîne de caractères type qui correspond à un *motif* (ou "pattern") de caractères possibles.
Ce motif permet de trouver une *correpondance dans une autre chaîne de caractère* (c'est le "matching").
Afin de découvrire le fonctionnement des expressions régulières il vous est conseillé de suivre le tutoriel en ligne #link("https://regexlearn.com/learn/regex101")[ReagexLearn] (les 30 premiers exercices vous permettront de bien cerner le fonctionnement).
Une fois le fonctionnement des expressions régulières compris, vous pourrez vous référer à l'article #link("https://koor.fr/Java/Tutorial/java_regular_expression.wp")[disponible ici] pour apprendre à les implémenter en Java.
=== Chargement de la liste des contacts
Il devra être possible de sauvegarder la liste des utilisateurs dans un fichier binaire afin de pouvoir les recharger lors du lancement de l'application.
Pour se faire vous pouvez mettre en place un système de #link("https://www.baeldung.com/java-serialization-approaches#javas-native-serialization")[*sérialisation binaire*] de la liste de tous les contacts.
#pagebreak()
== Sauvegarde des contacts dans des fichiers
=== Export d'un fichier vCard
==== Qu'est-ce qu'une vCard ?
#link("https://fr.wikipedia.org/wiki/VCard")[vCard] est un format standard ouvert d'échange de données personnelles ("Visit Card").
Une vCard est un fichier de contact qu'il est possible d'utiliser afin de partager les coordonnées d'une personne.
La structuration d'un vCard en version 4 est définie dans la #link("https://datatracker.ietf.org/doc/html/rfc6350")[RFC6350] développée par l'#link("https://fr.wikipedia.org/wiki/Internet_Engineering_Task_Force")[IETF].
Vous trouverez, en ligne, de nombreux exemples de vCard.
Voici un exemple fonctionnel de vCard4 :
```
BEGIN:VCARD
VERSION:4.0
N:Gump;Forrest;;Mr.;
FN:<NAME>
ORG:Sheri Nom Co.
TITLE:Ultimate Warrior
PHOTO;MEDIATYPE=image/gif:http://www.sherinnom.com/dir_photos/my_photo.gif
TEL;TYPE=work,voice;VALUE=uri:tel:+1-111-555-1212
TEL;TYPE=home,voice;VALUE=uri:tel:+1-404-555-1212
ADR;TYPE=WORK;PREF=1;LABEL="Normality\nBaytown\, LA 50514\nUnited States of America":;;100 Waters Edge;Baytown;LA;50514;United States of America
ADR;TYPE=HOME;LABEL="42 Plantation St.\nBaytown\, LA 30314\nUnited States of America":;;42 Plantation St.;Baytown;LA;30314;United States of America
EMAIL:<EMAIL>
REV:20080424T195243Z
x-qq:21588891
END:VCARD
```
Il vous faudra prévoir une fonctionnalité permettant de sauvegarder dans un fichier ayant pour extension *".vcf"* les contacts gérés via votre interface graphique.
La section suivante vous guidera sur la façon de mener l'analyse de la structure des vCard 4 afin de comprendre quoi inscrire dans le fichier.
==== Ecriture dans un fichier de la vCard
La première étape est d'arriver à constuire une chaîne de caractères contenant les informations de la vCard.
Avant de pouvoir implémenter la fonctionnalité, vous allez devoir analyser le contenu d'une vCard (par exemple celle fournie en exemple) afin d'en comprendre la structuration.\
Cette structuration est détaillée dans la #link("https://datatracker.ietf.org/doc/html/rfc6350")[RFC6350].
Voici un premier exemple, concernant le nom du contact :
```
N:Gump;Forrest;;Mr.;
```
`N:` indique que l'information qui suit concerne le nom du contact.
Ci-dessous une description de cette chaîne de caractères :
#image("assets/n-vcard.svg")
Nous observons que de nombreux champs sont facultatifs et peuvent rester vides.
Voici un autre exemple, il s'agit ici de la ligne comprenant les informations d'adresse personnelle :
```
ADR;TYPE=HOME;LABEL="42 Plantation St.\nBaytown\, LA 30314\nUnited States of America":;;42 Plantation St.;Baytown;LA;30314;United States of America
```
Ci-dessous un descriptif de la partie située après les ":" suite à la chaîne de caractères définissant le "LABEL".
#image("assets/addr-vcard.svg")
Une fois que ceci est fait il faut écrire cette chaîne dans un fichier.
Pour écrire dans un fichier vous pouvez vous inspirer des solutions présentées par #link("https://www.geeksforgeeks.org/java-program-to-save-a-string-to-a-file/")[cet article] (la *"méthode 1"* est, par exemple, exploitable).
==== Tester ses vCard
Une fois vos vCards créées, il vous faudra les tester. Vous pouvez utiliser un outil d'affichage de contenu de vCard tel que #link("https://github.com/abdelkader/vCardEditor")[vCard Editor] sous Windows.
#pagebreak()
=== Sauvegarde dans un fichier JSON
==== Détails de la fonctionnalité
En plus de la sauvegarde en vCard, l'application devra permettre sauvegarder les contacts en utilisant le *format JSON*.
JSON est un format de données textuel sous forme de tableau associatif (stockage "clé-valeur").
Voici, par exemple, un extrait de JSON représentant les données d'une partie de la classe "Contact" :
```json
{
"firstName": "Ada",
"lastName": "Lovelace",
"nickname": "Mothergoddess"
"birthDate": "10-12-1815",
...
}
```
Vous pourrez découvrir le format JSON à l'aide de #link("https://grafikart.fr/tutoriels/json-77")[cette vidéo de Grafikart] ou en consultant #link("https://la-cascade.io/articles/json-pour-les-debutants")[cet article].
==== Conseils d'implémentation
Votre objectif est de récupérer les *informations de contacts issues d'objets* et de sauvegarder ces informations dans un fichier ayant pour extension *".json"*.
Afin d'écrire des objets dans un JSON, vous pourrez utiliser une des nombreuses bibliothèques permettant de le faire, par exemple :
- #link("https://central.sonatype.com/artifact/com.googlecode.json-simple/json-simple")[json-simple] : tutoriel disponible #link("https://mkyong.com/java/json-simple-example-read-and-write-json/")[ici]
- #link("https://central.sonatype.com/artifact/com.fasterxml.jackson.core/jackson-databind")[jackson] : tutoriel disponible #link("https://mkyong.com/java/write-json-to-a-file-with-jackson/")[ici]
- #link("https://central.sonatype.com/artifact/com.squareup.moshi/moshi")[moshi] : tutoriel disponible #link("https://mkyong.com/java/how-to-parse-json-using-moshi/#convert-java-object-to-json-string")[ici]
`json-simple` semble être une solution à la mise en place aisée qui permet de mener à bien la tâche demandée.
#pagebreak()
= Conception graphique
== Contraintes graphiques
Il vous est demandé de concenoir une application compatible avec les tailles de fenêtre allant de *1024px × 768px* à *1920px x 1080px*.
L'organisation des composants graphiques devra rester harmonieuse pour toute les tailles intermédiaires.
== Conception de "wireframe"
Pour ce projet, il ne vous est pas demandé de mener une recherche graphique poussée (le design importe peu, vous allez vous concentrer sur les fonctionnalités) mais il vous faudra faire en sorte de développer une interface la plus simplet et ergonomique possible.
Habituellement, pour construire une maquette graphique, vous devriez suivre les phases suivants :
+ *zoning* : schématisation grossière de ce sera que la vue de l'application. On y indique uniquement des rectangles qui correspondent à des blocs de composants graphiques logiquement liés.
+ *wireframe* : version plus précise du zoning sur lequel on ajoute du texte et des détails sur les composants graphiques utilisés. Attention cependant, il n'y a pas encore de notion de "design" dans cette phase
+ *maquette haute fidelité / mockup* : développement graphique détaillé se voulant au plus proche du design final (avec l'intégration des couleurs, des images...)
Vous trouverez des exemples de ces 3 phases dans l'article #link("https://olivier-godard.medium.com/zoning-wireframe-mockup-prototype-mais-à-quoi-ça-correspond-cd82de10338")[disponible ici].
Pour ce projet il vous est fortement conseillé de constuire une "zoning" et un "wireframe" pour 2 résolutions spécifiques :
- 1024px × 768px
- 1920px x 1080px
La maquette haute fidelité importe moins dans notre cas du fait qu'il n'est pas demandé de mettre en place un style complexe.
Pour dessiner ces "zoning" et "wireframe" deux choix s'offrent à vous :
- dessiner sur une feuille
- dessiner en utilisant un outil collaboratif en ligne tel que #link("https://www.figma.com/fr-fr/")["Figma"]
*Attention*, veillez à faire valider votre maquette par le client avant de commencer à coder.
#pagebreak()
= Proposition d'achitecture logicielle
Ci-dessous une proposition d'architecture logicielle utilisant le langage UML (hors fonctionnalités optionelles) :
#image("assets/architecture.svg")
= Phases de travail
Votre équipe pourra suivre les phases de travail détaillées suivantes :
+ Analyse fonctionnelle :
- lecture du cahier des charges
- définition des "persona"
- construction d'un "backlog" avec les "user stories"
+ Maquettage de l'application :
- création du "zoning" et du "wireframe"
- validation de l'interface avec le "product owner" (autrement dit : votre formateur)
+ Conception de l'application (réflexion architecturale + conception de diagrammes)
+ Préparation du "sprint" et début des développements
+ Tests fonctionnels au cours des développements
+ Livraison de l'application : *07/07/2024*
#pagebreak()
= Fonctionnalités 'C' ("Could have this...")
Si le temps vous le permet, vous pourrez implémenter les fonctionnalités non prioritaires de l'application :
#table(
columns: (1fr, auto),
inset: 10pt,
align: horizon,
fill: (_, y) =>
if y == 0 { rgb("#d5e8b5") },
table.header(
[Fonctionnalité], [MoSCoW],
),
[Générer un QRCode contenant les informations de la vCard et l'afficher à l'écran],
[*C*],
[Export d'un ou plusieurs contacts en *CSV*],
[*C*]
)
Pour la génération d'un QRCode pour pourrez utiliser une bibliothèque telle que #link("https://www.geeksforgeeks.org/how-to-generate-and-read-qr-code-with-java-using-zxing-library/")[ZXing].
En ce qui concerne l'export des contacts #link("https://fr.wikipedia.org/wiki/Comma-separated_values")[CSV] il faudra permettre à l'utilisateur de choisir le séparateur qu'il souhaite utiliser (par défaut la ',' sera proposée). |
|
https://github.com/evaporei/resume | https://raw.githubusercontent.com/evaporei/resume/main/cv.typ | typst | #show heading: set text(font: "Linux Biolinum")
#show link: underline
#set page(
margin: (x: 0.9cm, y: 1.3cm),
)
#set par(justify: true)
#let chiline() = {v(-3pt); line(length: 100%); v(-5pt)}
= <NAME> (she/her)
#link("https://github.com/evaporei")[Github] | #link("https://gitlab.freedesktop.org/eva")[Gitlab] | #link("https://www.linkedin.com/in/evapace/")[LinkedIn] |
#link("mailto:<EMAIL>")[<EMAIL>]
#chiline()
Software Engineer with 7 years of experience. Worked with Web, FFI, WebAssembly and Blockchain.
== Skills
#chiline()
Rust - C - FFI - WebAssembly - PostgreSQL - Ethereum - JavaScript - Node.js
== Selected Experience
#chiline()
*Coding Experience - GStreamer / Multimedia* #h(1fr) 2023/08 -- 2024/03 \
Igalia #h(1fr) A Coruña, Galicia, Spain (remote) \
- Created two WebRTC plugins (sink & src) for Video Room conferencing using #link("https://janus.conf.meetecho.com/")[Janus] in #link("https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs")[gst-plugins-rs] (Rust);
- Helped with a few contributions to the GES (Video & Audio Editing Services) in #link("https://gitlab.freedesktop.org/gstreamer/gstreamer")[GStreamer] (C);
- General maintenance (documentation, updating libraries, fixing examples, etc).
*Rust Engineer* #h(1fr) 2021/04 -- 2023/02 \
Edge & Node #h(1fr) San Francisco, US (remote)
\
Developed a decentralized ETL client software for #link("https://thegraph.com")[The Graph]. Delivered features such as: \
- A new WebAssembly runtime for #link("https://github.com/graphprotocol/graph-node")[graph-node], that handled and mapped multiple ABI formats for different versions of the #link("https://www.assemblyscript.org")[AssemblyScript] programming language;
- Integration of the first non-EVM compatible chain (#link("https://near.org")[NEAR Protocol]) into the client.
Advocated and contributed to open source software such as:
- #link("https://github.com/graphprotocol/graph-node")[graph-node]: Rust node that indexes blockchain data and serves it via GraphQL;
- #link("https://github.com/graphprotocol/graph-cli")[graph-cli]: tool for creating subgraphs, which are a programmable ETL that reduces blockchain data to a store;
- #link("https://github.com/graphprotocol/graph-ts")[graph-ts]: AssemblyScript standard library for subgraph development.
*Senior Software Engineer* #h(1fr) 2020/07 -- 2021/03 \
Magazine Luiza #h(1fr) São Paulo, Brazil (remote) \
- Developed MagaluPay, the company's digital account, which had over 2 million users;
- Integrated the back-end with the new government instant payments API (PIX). \
*Software Engineer* #h(1fr) 2017/10 -- 2020/07 \
Pagar.me #h(1fr) São Paulo, Brazil (on-site)
- Rewrote a C library to Rust that implemented a payment terminal protocol using FFI and WebAssembly;
- Maintained the core payments API, which mostly consisted of distributed systems challenges;
- Developed the payment link product using Next.js and updated client SDKs in Python, Java and Ruby to support it;
- Made the chargeback system handle the second presentment.
== Education
#chiline()
*Computer Science Intensive* - Bradfield CS (remote) #h(1fr) 2023/06 -- 2024/06 \
*Software Systems: Behind the Abstractions* - Bradfield CS (remote) #h(1fr) 2022/09 -- 2022/11 \
*Purely Functional Data Structures* - UFABC (Santo André, Brazil) #h(1fr) 2019/11 \
*Category Theory* - UFABC (Santo André, Brazil) #h(1fr) 2019/08 \
*Analysis and Systems Development (Associate Degree)* - FIAP (São Paulo, Brazil) #h(1fr) 2015/01 -- 2016/12 \
== Extra-curricular Activities
#chiline()
*Podcast: Rust* - TOTVS (Brazil, remote) #h(1fr) 2020/11 \
Guest on a podcast about Rust. We talked about the advantages and disadvantages of the language and ecosystem. #link("https://www.buzzsprout.com/774398/6533485-totvs-developers-21-rust")[Podcast link].\
*Talk: Interop with Android, IOS and WASM in the same project* - Rust LATAM (Uruguay, on-site) #h(1fr) 2019/03 \
Talk about how we did a Rust library at Pagar.me which had to be compiled to Android, iOS and WASM at the same time. Links for: #link("https://www.youtube.com/watch?v=W-HUyTwV4LA")[video] and #link("https://github.com/evaporei/doom-fire-interop")[repository].\
|
|
https://github.com/ymgyt/techbook | https://raw.githubusercontent.com/ymgyt/techbook/master/programmings/js/typescript/specification/control_flow.md | markdown | # Control Flow
## loop
### for-of
```typescript
const arr = ["a", "b", "c"];
for (const value of arr) {
console.log(value);
}
// rustでいうenumerate()
for (const [idx, item] of ary.entries()) {}
```
* `Array.prototype.entries()`でenumerate()できる
## switch
```typescript
switch (env.identifier()) {
case "prod":
break;
case "staging":
break;
case "dev":
console.log("Dev");
break;
default:
console.log("default")
break;
}
```
|
|
https://github.com/0x1B05/nju_os | https://raw.githubusercontent.com/0x1B05/nju_os/main/lecture_notes/content/14_多处理器系统与中断机制.typ | typst | #import "../template.typ": *
#pagebreak()
= 多处理器系统与中断机制
== 多处理器上的操作系统内核
=== AbstractMachine: TRM
Turing Machine: 一个处理器,一个地址空间
- “无情的执行指令的机器” (rvemu) 的抽象
- 可用的内存是静态变量和 heap
- 只能执行计算指令和 putch, halt
=== AbstractMachine: MPE
Multiprocessing Extension: 多个处理器,一个地址空间
- 可用的地址空间依然是静态变量和 heap (处理器间共享)
- “多个 Turing Machine,共享一个纸带”
态机模型发生了改变
- 状态:共享内存和每个处理器的内部状态 (M,R1,R2,…,Rn )
- 状态迁移:处理器 t 分隔出一个 “单处理器计算机”
- 执行 (M,Rt )→(M′,Rt′) (M,R1 ,R2,…,Rn )→(M′,R1,R2,…,Rt′,…,Rn )
=== 简易多处理器内核 (L1 的模型)
与多线程程序完全一致
- 同步仅能通过原子指令如 `xchg` 实现
```c
uint8_t shm[MEM_SIZE]; // Shared memory
void Tprocessor() {
struct cpu_state s;
while (1) {
fetch_decode_exec(&s, shm);
}
}
int main() {
for (int i = 0; i < NPROC; i++) {
create(Tprocessor);
}
}
```
== 中断机制
=== 理解中断
硬件上的中断:一根线
- IRQ , NMI (边沿触发,低电平有效)
- “告诉处理器:停停,有事来了” - 剩下的行为交给处理器处理 实际的处理器并不是
“无情地执行指令”
- 无情的执行指令
- 同时有情地响应外部的打断 - 你在图书馆陷入了自习的死循环…… - 清场的保安打断了你
=== 处理器的中断行为
“响应”
- 首先检查处理器配置是否允许中断
- 如果处理器关闭中断,则忽略
- x86 Family
- 询问中断控制器获得中断号 n
- 保存 CS, RIP, RFLAGS, SS, RSP 到堆栈
- 跳转到 IDT[n] 指定的地址,并设置处理器状态 (例如关闭中断)
- RISC-V (M-Mode)
- 检查 mie 是否屏蔽此次中断
- 跳转 PC = (mtvec & ~0xf)
- 更新 mcause.Interrupt = 1
=== RISC-V M-Mode 中断行为 RTFSC
“更多的处理器内部状态”
- TFM Volume II: Privileged Architecture
```c
struct MiniRV32IMAState {
uint32_t regs[32], pc;
uint32_t mstatus;
uint32_t cyclel, cycleh;
uint32_t timerl, timerh, timermatchl, timermatchh;
uint32_t mscratch, mtvec, mie, mip;
uint32_t mepc, mtval, mcause;
// Note: only a few bits are used. (Machine = 3, User = 0)
// Bits 0..1 = privilege.
// Bit 2 = WFI (Wait for interrupt)
// Bit 3+ = Load/Store reservation LSBs.
uint32_t extraflags;
};
```
=== 中断:奠定操作系统 “霸主地位” 的机制
操作系统内核 (代码)
- 想开就开,想关就关
应用程序
- 对不起,没有中断
- 在 gdb 里可以看到 flags 寄存器 (FL_IF)
- #link("https://www.felixcloutier.com/x86/cli")[ CLI — Clear Interrupt Flag ]
- `#GP(0)` If CPL is greater than IOPL and less than 3
- 试一试 `asm volatile ("cli");`
- 死循环也可以被打断
=== AbstractMachine 中断 API
隔离出一块 “处理事件” 的代码执行时空
- 执行完后,可以返回到被中断的代码继续执行
```c
bool cte_init(Context *(*handler)(Event ev, Context \*ctx));
bool ienabled(void);
void iset(bool enable);
```
中断引入了并发
- 最早操作系统的并发性就是来自于中断 (而不是多处理器)
- 关闭中断就能实现互斥
- 系统中只有一个处理器,永远不会被打断
- 关中断实现了 “stop the world”
=== 真正的计算机系统模型
状态
- 共享内存和每个处理器的内部状态 (M,R1 ,R2 ,…,Rn )
状态迁移
1. 处理器 t 执行一步 (M,Rt )→(M′,Rt′)
- 新状态为 (M′,R1 ,R2 ,…,Rt′,…,Rn )
2. 处理器 t 响应中断
假设 race-freedom
- 不会发生 relaxed memory behavior
- 模型能触发的行为就是真实系统能触发的所有行为
=== 例子:实现中断安全的自旋锁
实现原子性:
```c
printf("Hello\n");
```
- printf 时可能发生中断
- 多个处理器可能同时执行 printf
这件事没有大家想的简单
- 多处理器和中断是两个并发来源
== 50 行实现操作系统内核
中断处理程序的秘密 参数和返回值 “Context”
```c
Context *handler(Event ev, Context *ctx) {
...
}
```
- 中断发生后,不能执行 “任何代码”
- `movl $1, %rax` 先前状态机就被永久 “破坏” 了
- 除非把中断瞬间的处理器状态保存下来
- 中断返回时需要把寄存器恢复到处理器上
- 看看 Context 里有什么吧
=== 上下文切换
状态机在执行……
- 发生了中断
- 操作系统代码开始执行
- 状态机被 “封存”
- 我们可以用代码 “切换” 到另一个状态机
- 中断返回另一个状态机的状态
- “封存” 的状态还在
- 下次可以被恢复到处理器上执行
=== 实现多处理器多线程
AbstractMachine API
你只需要提供一个栈,就可以创建一个可运行的 context
```c
Context *on_interrupt(Event ev, Context *ctx) {
if (!current) {
current = &tasks[0]; // First trap for this CPU
} else {
current->context = ctx; // Keep the stack-saved context
}
// Schedule
do {
current = current->next;
} while (!on_this_cpu(current));
return current->context;
}
```
|
|
https://github.com/Enter-tainer/typstyle | https://raw.githubusercontent.com/Enter-tainer/typstyle/master/tests/assets/unit/comment/consecutive-comment.typ | typst | Apache License 2.0 | #{
// This is a comment
// This is another comment
// This is a third comment
let a = 0 // This is a fourth comment
// This is a fourth comment
// This is a fifth comment
let b = 1 // This is a sixth comment
}
#{
let c = 0
// end of the line
}
|
https://github.com/Myriad-Dreamin/typst.ts | https://raw.githubusercontent.com/Myriad-Dreamin/typst.ts/main/fuzzers/corpora/text/emphasis_01.typ | typst | Apache License 2.0 |
#import "/contrib/templates/std-tests/preset.typ": *
#show: test-page
// Inside of words can still use the functions.
P#strong[art]ly em#emph[phas]ized.
|
https://github.com/kotfind/hse-se-2-notes | https://raw.githubusercontent.com/kotfind/hse-se-2-notes/master/prob/lectures/2024-10-04.typ | typst | #import "/utils/math.typ": *
==== Свойства математического ожидания
+ $E c = c$
+ $E(c xi) = c E(xi)$
+ Если $a <= xi <= b$, то $a <= E xi <= b$.
+ $E(xi_1 + xi_2) = E(xi_1) + E(xi_2)$
+ Пусть $eta = phi(xi)$, где $phi$ --- детерминированная функция, тогда
$E eta = E phi(xi) = sum_(i = 1)^n phi(x_i) p_i $
=== Дисперсия
#def[
#defitem[Дисперсией] случайной величины $xi$ называется число
$ D xi = E (xi - E xi)^2 $
]
==== Свойства дисперсии
+ $D c = 0$
+ $D (c xi) = c^2 D(xi)$
+ $forall xi: D(xi) >= 0$
+ $D(xi) = E(xi^2 - 2 xi E(xi) + (E xi)^2) = E(xi^2) - 2 (E xi)^2 + (E xi)^2
= E xi^2 - (E xi)^2 $ --- удобная формула для вычислений
+ $D(xi_1 + xi_2) = E(xi_1 + xi_2)^2 - (E(xi_1 + xi_2))^2 =
E(xi_1^2) + 2E(xi_1 xi_2) + E(xi_2^2) - (E xi_1)^2 - 2 E xi_1 E xi_2 + (E xi_2)^2
= D xi_1 + D xi_2 + 2 underbrace((E(xi_1 xi_2) - E xi_1 E xi_2), "ковариация")
= D xi_1 + D xi_2 + 2 "cov"(xi_1, xi_2) $
+ Если $xi_1$ и $xi_2$ независимы, то $"cov"(xi_1, xi_2) = 0 ->
D(xi_1 + xi_2) = D xi_1 + D xi_2 $
=== Другие
#def[
#defitem[Среднеквадратическое отклонение]: $sigma_xi = sqrt(D xi)$
]
#def[
#defitem[Начальный момент порядка $k$] ($k = 1, 2, ...$): $mu_k = E xi^k$
]
$ mu_1 = E xi $
#def[
#defitem[Центральный момент порядка $k$] ($k = 2, 3, ...$): $nu_k = E(xi - E xi)^k$
]
$ nu_2 = D xi $
#def[
#defitem[Центрированная случайная величина]: $xi^0 = xi - E xi$
]
$ E xi^0 = 0 $
#def[
#defitem[Нормированная случайная величина]: $xi^* = xi^0 / sigma$
]
$ D xi^* = D xi^0 / sigma = 1/(sigma^2) D xi^0 = 1 $
== Часто встречающиеся дискретные распределения
=== Распределение Бернулли
$ xi underbrace(~, "имеет распределение") "Ber"(p), 0 < p < 1 $
#figure(
table(
columns: 3,
align: center,
$xi$, $0$, $1$,
$P$, $1 - p$, $p$,
)
)
#figure(
table(
align: center,
columns: 3,
$xi^2$, $0$, $1$,
$P$, $1 - p$, $p$,
)
)
$ E xi = 0 + 1 dot p = p $
$ D xi = E xi^2 - (E xi^2) = p - p^2 = p(1 - p) = p q $
=== Биномиальное распределение
$ xi ~ "Bi"(n, p), 0 < p < 1 $
#figure(
table(
align: center,
columns: 6,
$xi$, $0$, $...$, $k$, $...$, $n$,
$P$, $...$, $...$, $C_n^k p^k q^(n - k)$, $...$, $...$,
)
)
Матожидание. Способ 1:
$ E xi = sum_(k = 0)^n k dot C_n^k p^k q^(n - k)
= sum_(k = 0)^n k n! / (k!(n - k)!) p^k q^(n - k)
= n p sum_(k = 1)^n (n - 1)!/((k - 1)!(n - k)!) p^(k - 1) q^(n - k) = \
= {i = k - 1} = n p sum_(i = 0)^n (n - 1)!/(i!(n - 1 - i)!) p^i q^(n - 1 - i)
= n p dot 1 = n p $
Маожидание. Способ 2:
$ xi = xi_1 + xi_2 + xi_3 + ... + xi_n $
$ xi_i ~ "Ber"(p) $
$ E xi = E (sum_(i = 1)^n xi_i) = sum_(i = 1)^n (E xi_i) = n p $
Дисперсия. Способ 1:
$ D xi = E xi^2 - (E xi)^2 = sum_(k = 0)^n k^2 dot C_n^k p^k q^(n - k) = ... $
Дисперсия. Способ 2:
$ D xi = D(sum_(i = 1)^n xi_i) underbrace(=, "т.к. независимы")
sum_(i = 1)^n D(xi_i) = n p q $
#blk(title: "Пример")[
Бросаем монетку 10 раз.
$ n = 10, p = 0.5 -> cases(
E xi = 10 dot 0.5 = 5,
D xi = 10 dot 1/2 dot 1/2 = 2.5
) $
]
=== Распределение Пуассона
$ xi ~ "П"(lambda), lambda > 0 $
$ xi = {0, 1, 2, ...} $
$ P(xi = k) = (e^(-lambda) lambda^k) / (k!) $
Проверим условие нормировки:
$ sum_(k = 0)^oo (e^(-lambda) lambda^k) / (k!)
= e^(-lambda) sum lambda^k / (k!) = e^(-lambda) e^lambda = 1 $
Матожидание:
$ E xi = sum_(k = 0)^oo k (e^(-lambda) lambda^k) / (k!)
= lambda e^(-lambda) sum_(k = 1)^oo (lambda^(k - 1))/((k - 1)!)
= lambda e^(-lambda) e^lambda = lambda $
Дисперсия:
$ D xi = E xi^2 - (E xi)^2
= sum_(k = 0)^oo k^2 (e^(-lambda) lambda^k) / (k!) - lambda^2
= sum_(k = 0)^oo k (e^(-lambda) lambda^k) / ((k - 1)!) - lambda^2 =\
= lambda sum_(k = 0)^oo (k - 1 + 1) (e^(-lambda) lambda^(k - 1)) / ((k - 1)!) - lambda^2
= lambda^2 + lambda - lambda^2 = lambda $
*Теорема Пуассона* Пусть проводятся испытания по схеме Бернулли, причем
$n -> oo$, $p -> 0$,$n p -> lambda$. Тогда
$ lim_(n -> oo) C^k_n p^k (1 - p)^(n - k) = (e^(-lambda) lambda^k)/(k!) $
#proof[
$ lim_(n -> oo) C^k_n p^k (1 - p)^(n - k)
= lim_(n -> oo) n! / (k! (n - k)!) p^k (1 - p)^(n - k) =\
= lim_(n -> oo) n! / (k! (n - k)!) (lambda/n)^k (1 - lambda/n)^(n - k) =\
= lambda^k / k! lim_(n -> oo) (n dot (n - 1) dot ... dot (n - k + 1)) / (n^k)
(1 - lambda/n)^n / (1 - lambda/n)^k
= 1 dot e^(-lambda) / 1 = e^(-lambda) $
]
Погрешность при замене Бернулли на Пуассона:
$ abs(C_n^k p^k q^(n - k) - (e^(-n p) (n p)^k)/k!) <= n p^2 $
=== Геометрическое распределение
$ xi ~ G(p), 0 < p < 1 $
$ xi = {1, 2, ...} $
$ P(xi = k) = q^(k - 1)p $
*Смысл*: Испытание с двумя исходами. Останавливаемся, когда произошел первый
успех.
Матожидание:
$ E xi = sum_(k = 1)^oo k q^(k - 1) p = p sum_(k = 1)^oo k q^(k - 1)
= p sum_(k = 1)^oo (q^k)' =\
= p (sum_(k = 1)^oo q^k)' = p (q/(1 - q))' = p / (1 - q)^2 = 1/p $
Дисперсия:
$ D xi = q/(p^2) $
#blk(title: "Пример")[
Студент знает 80% материала. Его спрашивают, пока не завалят.
$ xi ~ G(0.2) $
]
|
|
https://github.com/alikindsys/aula | https://raw.githubusercontent.com/alikindsys/aula/master/test.typ | typst | #import "./Core/prelude.typ": *
#let teste(doc) = [
#show: aula(materia: [Aula - Teste], glossary: (), doc)
]
#show: teste
= Aula
Sistema de tipografia para anotações escolares.
== Extensão do `gentle-clues` para português
#advertencia[`#advertencia[]`]
#cita[`#cita[]`]
#conclusao[`#conclusao[]`]
#dica[`#dica[]`]
#erro[`#erro[]`]
#exemplo[`#exemplo[]`]
#info[`#info[]`]
#memo[`#memo[]`]
#pergunta[`#pergunta[]`]
#resumo[`#resumo[]`]
#sucesso[`#sucesso[]`]
#tarefa[`#tarefa[]`]
== Tablelas coloridas
`#color-table(blue)`
#color-table(blue)[
| *Name* | *Location* | *Height* | *Score* |
| ------ | ---------- | -------- | ------- |
| John | Second St. | 180 cm | 5 |
| Wally | Third Av. | 160 cm | 10 |
]
`#color-table(rgb("#af5ff5"))`
#color-table(rgb("#af5ff5"))[
| *Name* | *Location* | *Height* | *Score* |
| ------ | ---------- | -------- | ------- |
| John | Second St. | 180 cm | 5 |
| Wally | Third Av. | 160 cm | 10 |
]
|
|
https://github.com/Nrosa01/TFG-2023-2024-UCM | https://raw.githubusercontent.com/Nrosa01/TFG-2023-2024-UCM/main/Memoria%20Typst/capitulos/4.PluginsYScripting.typ | typst | #import "@preview/sourcerer:0.2.1": code
//Añadir subaparatado pequeño hablando de blockly y relacionandolo con lenguajes de script visuales
Algunos programas necesitan ser extendidos para añadir funcionalidad sin tener que acceder al código fuente. Además, esto permite a usuarios que no sean el desarrollador original añadir funcionalidad al programa. A estos sistemas de extensión se les denomina comúnmente plugins. Un plugin @plugin_architecture es un componente de software que añade una funcionalidad específica a un programa. Los plugins pueden ser utilizados en programas de todo tipo, desde editores de texto hasta videojuegos.
Existen tres formas principales de extender un programa: mediante librerías dinámicas, mediante un archivo de configuración o mediante un lenguaje de scripting. Cada una tiene sus ventajas y desventajas. En este capítulo se explorarán y explicarán estas opciones.
== Extensión mediante librería dinámica
Una librería dinámica es un archivo que contiene código compilado que puede ser cargado y vinculado a un programa en tiempo de ejecución. Esto significa que el programa no necesita incluir este código en su propio archivo binario, sino que puede cargarlo cuando se necesita.
Las librerías dinámicas son especialmente útiles para proporcionar una interfaz estandarizada a funciones de sistema o a librerías de terceros que pueden cambiar con el tiempo. Al vincular estas funciones en tiempo de ejecución, un programa puede beneficiarse de las actualizaciones y correcciones de errores en la librería sin necesidad de ser recompilado. Al mismo tiempo, si el programa está preparado para ello, las librería dinámicas pueden extender funcionalidad.
Las librerías dinámicas, al ser módulos de código que se cargan y vinculan en tiempo de ejecución, necesitan una forma de comunicarse con el programa principal. Esta comunicación implica saber cómo se llaman las funciones, cómo se pasan los datos y cómo se maneja la memoria. En otras palabras, necesitan un protocolo común que permita al programa y a la librería interactuar de manera efectiva. Aquí es donde entra en juego la Interfaz Binaria de Aplicación, o ABI.
La ABI @understanding_abi es un contrato entre dos piezas de código binario que define cómo deben interactuar entre sí. Incluye detalles como el formato de los datos, la disposición de las llamadas a funciones y el manejo de la memoria.
La ABI es esencial para las librerías dinámicas porque define cómo el código en la librería debe ser llamado y cómo debe interactuar con el código que la llama. Si la ABI de una librería cambia, cualquier código que dependa de ella puede dejar de funcionar correctamente a menos que sea recompilado para usar la nueva ABI. Por esta razón, los desarrolladores de librerías dinámicas suelen esforzarse por mantener la compatibilidad con la ABI para evitar romper los programas existentes. Cada lenguaje tiene su propia ABI, que puede ser o no estable. Esto depende de cómo se haya diseñado el lenguaje y de cómo se haya implementado la ABI. Un lenguaje que tenga poco tiempo de desarrollo no tendrá un ABI estable al tener que cambiar constantemente para añadir nuevas funcionalidades o corregir errores. A pesar de esto, la mayoría de lenguajes con un ABI no estable tienen soporte para usar el ABI de C, que es estable, aunque esto limita las característica que se pueden usar del lenguaje.
Cabe destacar que las librería dinámicas no son un formato universal, sino que cada sistema operativo tiene su propio mecanismo para cargar y vincular librerías dinámicas. Por ejemplo, en Windows se utilizan archivos DLL, en Linux se utilizan archivos SO y en macOS se utilizan archivos dylib. Esto significa que las librerías dinámicas no son necesariamente portables entre sistemas operativos, lo que puede ser una limitación en algunos casos. No obstante, existe un consenso al respecto a su funcionalidad. Por ejemplo, los grandes sistemas operativos actuales, Windows, Linux y MacOS, permiten definir callbacks o funciones para que una librería detecte cuando se ha cargado o descargado por el programa principal.
Por último, cabe mencionar que en Windows, las librerías dinámicas pueden contener recursos como texturas, modelos 3D, sonidos, etc. Esto permite, por ejemplo, compartir `mods` de un juego en un solo archivo. @resource_only_dll. Se denomina mod (diminutivo de "modification") a la modificación de un videojuego por parte de los usuarios @poor-2013. Es decir, es un tipo de plugin específico para videojuegos. Las librerías dinámicas y los sistemas descritos en los siguientes apartados pueden ser usados para crear "mods" si el juego lo soporta, puesto que algunos juegos ofrecen soporte oficial de "mods" mientras que en otros casos la comunidad crea herramientas para modificar el juego.
Sin embargo, las librerías dinámicas tienen algunos problema o inconveniencias a tener en cuenta. Por un lado, la compatibilidad entre plataformas ya mencionada. Por otro lado, la compatibilidad entre versiones y el ABI. Además, existen también problemas de seguridad, pues una librería dinámica puede ser modificada por un atacante para lograr la ejecución de código malicioso cierto grado de acceso al sistema. O simplemente un usuario malicioso puede distribuir una librería dinámica que no haga lo que dice hacer.
La mayor ventaja de este sistema es su flexibilidad. Si el API (las funciones que define la librería) está bien diseñado, las posibilidad de extensión pueden llegar a ser infinitas, es el caso de algunos motores de videojuegos como Unity, en el que el código del desarrollador acaba siendo una librería dinámica que usa el motor. Además, una librería dinámica puede tener estado, es decir, sus propios datos. Este estado es global pero ofrece más posibilidades de extensión y mantenimiento. Por ejemplo, aprovechando que las librerías pueden detectar cuando se carga y se descarga, sería posible para un plugin guardar el número de veces que se ha cargado, para ello lo único que hay que hacer es escribir en un fichero la cantidad de veces que se ha cargado y leerlo al cargar la librería. Extendiendo este sistema, un plugin podría persistir todo su estado en un fichero. Esto permite a los sistemas de mods gestionar su propio estado sin tener que depender del programa principal.
== Extensión mediante un archivo de configuración
Un archivo de configuración es una herramienta que ofrece la posibilidad de ajustar el comportamiento de un programa sin necesidad de modificar su código fuente y `sin necesidad de compilar código`. Esta práctica resulta especialmente útil en situaciones donde acceder al código no es una opción viable, ya sea porque no está disponible o porque el usuario carece del conocimiento técnico necesario para modificarlo, o porque el desarrollador o empresa quiera mantener el control sobre el código fuente.
La lectura de este archivo por parte del programa le permite realizar acciones específicas basadas en la información contenida en el mismo. Es como proporcionarle al programa un conjunto de instrucciones adicionales que le dicen cómo comportarse en ciertas circunstancias.
Una de las ventajas más destacadas de este enfoque es que es multiplataforma. Debido a que es un formato específico creado a medida para el programa, no depende de ningún protocolo que indique como cargar símbolos (nombres de funciones) o como gestionar la memoria y datos. Esto facilita la mantención del código.
Además, el uso de archivos de configuración no presenta riesgos de seguridad inherentes. A diferencia de ejecutar código arbitrario, que puede ser potencialmente peligroso, la lectura de un archivo de configuración solo implica que el programa interprete ciertos datos de manera específica. Al mismo tiempo, este es el mayor problema de este foramto. En una librería dinámica, el desarrollador puede realizar las operaciones que quiera dentro de una función, siendo la única limitación las funciones que el programa principal exponga para comunicarse con este. En el caso de un fichero de configuración las limitaciones se extreman al no poder controlar nada que no esté especificado en el formato. Es como si tuvieras una serie de piezas que puedes combinar de forma específica, porque el diseñador de las piezas las creó de tal forma que no todas encajan con todas, además se está limitado a las piezas que el diseñador creó. Por otro lado, al definir una serie de órdenes secuenciales que no pueden conocerse de antemano, el código no puede optimizarse tanto como en una DLL, pues hay que leer el archivo e interpretarlo adecuadamente. Sin embargo las DLLs, una vez cargadas podían ejecutar código directamente.
Los archivos de configuración, al ser de especificación libre y no estar sujeto a normas, pueden no ser ficheros de texto. Es posible que sean un formato binario no legible para el ser humano. Sin embargo, lo más habitual es que sean ficheros de texto, ya que la intención es que sean fácilmante modificables por el usuario. Además, que sea un fichero de texto elimina la dependencia de una herramienta que pueda leer y escribir el formato del archivo.
Como ejemplo se muestra un archivo de configuración para un sistema bullet hell inspirado en Danmaku:
#code(
lang: "Danmaku",
```rust
fire circle-blue <0,-5>
repeat-every 8
randomize-x -6 6
fire-particle
cartesian-velocity
randomize-time 0 4
lerpfromtoback 0.5 1.5 2.5 3.5
<0,0.4>
<0,0.7>
```
)
Un sistema bullet hell es un tipo de juego de disparos en el que el jugador debe esquivar una gran cantidad de proyectiles en pantalla. En este caso, el archivo de configuración define un patrón de disparo que lanza proyectiles azules en forma de círculo hacia arriba. El patrón se repite cada 8 fotogramas y los proyectiles se mueven aleatoriamente en el eje X entre -6 y 6 unidades. Cada proyectil tiene una velocidad inicial de 0.4 unidades en el eje Y y aumenta a 0.7 unidades a lo largo de su vida útil.
El usuario que consuma esta API está limitado al formato y funciones que el desarrollador ha dado. Además, en sistemas más complejos como el de este ejemplo, esta solución puede ser más difícil de implementar de manera eficiente. Este método de extensión va más alla de un simple archivo de configuración para un sistema con unos parámetros fijos. Esta clase de sistemas puede permitir elegir cierta combinación de parámetros en cierto orden. Este sistema es similar al siguiente que veremos.
== Extensión mediante un lenguaje de scripting
Existe un punto intermedio en cuanto a ventajas y desventajas entre los sistemas ya mencionados: los lenguajes de scripting. Un lenguaje de scripting es un lenguaje de programación que se utiliza para controlar la ejecución de un programa o para extender su funcionalidad. A diferencia de los lenguajes de programación tradicionales, los lenguajes de scripting suelen ser interpretados en lugar de compilados, lo que significa que el código se ejecuta directamente por un intérprete en lugar de ser traducido a código máquina antes de la ejecución.
Un lenguaje de scripting, al igual que otros lenguajes de programación, posee la característica de ser Turing completo. Esto implica que tiene la capacidad de llevar a cabo cualquier operación computacional que sea teóricamente posible. Sin embargo, debido a que los lenguajes de scripting son interpretados en tiempo de ejecución, en lugar de ser compilados previamente, pueden presentar una velocidad de ejecución más lenta en comparación con los lenguajes compilados.
La interpretación en tiempo de ejecución significa que el código se traduce a código máquina mientras el programa se está ejecutando, lo cual puede introducir una sobrecarga adicional que afecta el rendimiento. A pesar de esta desventaja en términos de velocidad, los lenguajes de scripting ofrecen la ventaja de ser multiplataforma.
Ser multiplataforma significa que los scripts escritos en un lenguaje de scripting pueden ser ejecutados en diferentes sistemas operativos o plataformas de hardware. Esto es posible porque el intérprete del lenguaje de scripting, que es el programa que realiza la traducción a código máquina, suele estar disponible para una amplia variedad de plataformas.
Además, los lenguajes de scripting suelen ser más fáciles de aprender y de utilizar que los lenguajes de programación tradicionales. Esto se debe a que los lenguajes de scripting suelen tener una sintaxis más sencilla y menos reglas que los lenguajes de programación compilados. Suelen ser lenguajes que gestionan la memoria automáticamente, es decir, no es necesario liberar la memoria que se ha reservado, lo que facilita la programación.
Uno de los lenguajes de scripting más usados para modificar e incluso desarrollar videojuegos es Lula. Lua es un lenguaje de scripting de alto nivel, multi-paradigma, ligero y eficiente, diseñado principalmente para la incorporación en aplicaciones. Fue creado en 1993 por <NAME>, <NAME> y <NAME>, miembros del Grupo de Tecnología en Computación Gráfica (Tecgraf) de la Pontificia Universidad Católica de Río de Janeiro, Brasil.
Lua es conocido por su simplicidad, eficiencia y flexibilidad. Su diseño se centra en la economía de recursos, tanto en términos de memoria como de velocidad de ejecución. Existe una única estructura de datos, la tabla, que se utiliza para representar tanto arrays como diccionarios. Además, para poder "heredar" funciones de una tabla, Lua define el concepto de metatabla. En Lua, cada tabla puede tener asociada una metatabla. Cuando el desarrollador llama a una función y esta no está definida en la tabla, Lua busca en la metatabla de la tabla para ver si la función está definida ahí. Esto es comparable a los prototipos en JavaScript.
Una de las características más destacadas de Lua es su capacidad para ser embebido en aplicaciones. Esto se debe a su diseño como un lenguaje de scripting, que permite que el código Lua sea llamado desde un programa en C, C++ u otros lenguajes de programación. Esta característica ha llevado a que Lua sea ampliamente utilizado en la industria de los videojuegos, donde se utiliza para controlar la lógica del juego y las interacciones del usuario. Existen motore como Defold que integran Lua como lenguaje de scripting o el popular juego Roblox, que permite a los usuarios crear sus propios juegos utilizando una version modificada de Lua llamada Luau.
Existe una versión más rápida de Lua llamada LuaJIT. El nombre no es arbitrario, JIT hace referencia a un término en inglés que significa "Just In Time", es decir, "Justo a Tiempo". Existen dos estrategias de compilación: la compilación AOT (Ahead Of Time) y la compilación JIT (Just In Time). La compilación AOT consiste en compilar el código fuente a código máquina antes de la ejecución del programa. Tradicionalmente se llaman lenguajes compilados a los lenguajes que compilan con esta estrategia. La compilación JIT, por otro lado, consiste en compilar el código fuente a código máquina durante la ejecución del programa. La compilación JIT tiene la ventaja de ser multiplataforma. LuaJIT es un intérprete de Lua que utiliza la compilación JIT para mejorar el rendimiento de los scripts Lua. Esto significa que el código Lua se compila a código máquina en tiempo de ejecución, lo que puede mejorar significativamente la velocidad de ejecución de los scripts.
Sin embargo, cabe destacar que en los lenguajes JIT, puede llegar a ser importante saber ciertos detalles de su funcionamietno interno para poder aprovechar su potencial. Como se mencionó anteriormente, la única estructura de datos en Lua es la tabla, no existen tipos salvo los primitivos (números, booleanos y cadenas de texto). Esto significa que algunas optimizaciones dependen del uso que el desarrollador haga del lenguajes. Por ejemplo, si una función recibe dos parámetros y esos dos parámetros siempre son números, LuaJIT puede optimizar la función en base a heurísticas. Sin embargo, si durante la ejecución se llama a la función con otro tipo de dato, LuaJIT desactivará la optimización y la función se ejecutará de forma más lenta. Este tipo de optimizaciones son comunes en los lenguajes JIT, por lo que es importante tener en cuenta cómo funcionan para poder aprovechar su potencial. De ser del interés del lector, se recomienda leer al respecto el monomorfismo y polimorfismo de JavaScript, ya que suele ser implementarse con una estrategia JIT y existe documentación adecuada al respecto.
A continuación se explicará de forma general qué es una CPU, que es el multithreading o multihilo y cuales son sus ventajas e inconvenientes. |
|
https://github.com/rabotaem-incorporated/algebra-conspect-1course | https://raw.githubusercontent.com/rabotaem-incorporated/algebra-conspect-1course/master/sections/04-linear-algebra/!sec.typ | typst | Other | #import "../../config.typ"
= Линейная алгебра
#if config.enable-chapters-from-sem1 [
#include "01-matrices.typ"
#include "02-elementary-things.typ"
]
<tickets-div>
#counter("ticket").update(0)
#if config.enable-chapters-from-sem2 [
#include "03-permutations-cont.typ"
#include "04-determinants.typ"
#include "05-determinants-more-props.typ"
#include "06-linear-spaces.typ"
#include "07-linear-subspaces.typ"
#include "08-linear-dep-and-indep.typ"
#include "09-basis.typ"
#include "10-coords.typ"
#include "11-rank.typ"
#include "12-direct-sum.typ"
#include "13-linear-mappings.typ"
#include "14-linear-mapping-matrix.typ"
#include "15-linear-operators.typ"
#include "16-eigen-values-vectors.typ"
] |
https://github.com/HKFoggyU/hkust-thesis-typst | https://raw.githubusercontent.com/HKFoggyU/hkust-thesis-typst/main/hkust-thesis/templates/toc-page.typ | typst | LaTeX Project Public License v1.3c | #import "../imports.typ": *
#import "../utils/invisible-heading.typ": invisible-heading
// 目录生成
#let toc-page(
// documentclass 传入参数
config: (:),
info: (:),
// 其他参数
depth: 3,
// 间距
vspace: (constants.linespacing, constants.linespacing),
indent: (0pt, 4.25em, 1.6em),
// 不显示点号
fill: (none, none),
..args,
) = {
set text(
font: constants.font-names.toc,
size: constants.font-sizes.toc,
)
// page setting
show outline.entry: outrageous.show-entry.with(
// 保留 Typst 基础样式
..outrageous.presets.typst,
body-transform: (level, it) => {
// 设置字体和字号
// 计算缩进
let indent-list = indent + range(level - indent.len()).map((it) => indent.last())
let indent-length = indent-list.slice(0, count: level).sum()
h(indent-length) + it
},
vspace: vspace,
fill: fill,
..args,
)
// page rendering
pagebreak(weak: true, to: if config.twoside { "odd" })
// set par(leading: linespacing)
{
set align(center)
let toc-text = "Table of Contents"
invisible-heading(toc-text)
heading(outlined: false)[#text(size: constants.font-sizes.title)[#upper(toc-text)]]
do-repeat([#linebreak()], 1)
}
// 显示目录
outline(title: none, depth: depth)
} |
https://github.com/kdog3682/mathematical | https://raw.githubusercontent.com/kdog3682/mathematical/main/0.1.0/src/dialogues/cover-layouts/kacper.typ | typst | // located at time-travel-edition
#import "@local/typkit:0.1.0": *
#set page(paper: "us-letter")
#let KacperStudent = (
grade: 6,
name: "<NAME>",
)
#let do-time-travel-sidebar-message(year) = {
let time-travel-text = text(
size: 50pt,
fill: blue,
"TIME TRAVEL EDITION",
weight: "bold",
)
let year-text = bold("(" + str(year) + ")", size: 50pt)
let c = {
time-travel-text
h(20pt)
year-text
}
let c = box(centered(c), width: 100%)
return rotate(c, 270deg, reflow: true)
}
#let do-title(season, year, subject) = {
let a = {
text(season, size: 32pt)
h(15pt)
pattern-text(year, style: "criss-cross")
}
let b = bold(subject + " Workbook", size: 28pt)
centered(a + v(10pt) + b)
lines.soft
}
#let do-student(student) = {
return colon("For student", student.name, size: 18pt, font: "courier")
}
#let cover(
season: "Autumn",
year: 1991,
subject: "Math",
student: KacperStudent,
) = {
let title = do-title(season, year, subject)
let student-line = do-student(student)
let grade-level = text(
"G" + str(student.grade),
size: 50pt,
weight: "bold",
)
let hmc-mark = [— Hammy Math Class ©#get-year() —]
let top-content = {
title
v(10pt)
student-line
}
// the main page part
let body-content = {
let pic = rect(width: 200pt, height: 200pt, fill: blue)
placed(pic, center + horizon)
placed(grade-level, right + bottom)
}
let table = table.with(inset: 0pt, stroke: none)
let items = (
table.cell(colspan: 2, top-content),
do-time-travel-sidebar-message(year),
table.cell(body-content),
)
let payload = table(columns: (auto, 1fr), rows: (auto, 1fr), ..items)
page(
footer: {
placed(hmc-mark, bottom + center)
},
payload
)
}
#cover()
|
|
https://github.com/kdog3682/2024-typst | https://raw.githubusercontent.com/kdog3682/2024-typst/main/src/te-anchoring.typ | typst | #let main() = {
circle((0, 0), name: "circle", radius: 1)
let pos = (name: "circle", anchor: "west")
content(pos, [A], anchor: "south-east", name: "A")
content(pos, [B], anchor: "center", name: "B")
circle("A", radius: 0.5)
circle("B", radius: 0.5)
// The initial pos sets the position of the content.
// The anchor then further anchors the position relative to the initial
// the coordinate system seems backwards.
content(pos,
// in the cetz library,
// everything has a coordinate position.
// the coordinate system itself shifts to accomodate all the positions
// all the anchors are accessible inside the same scope
}
//content((name: "circle", anchor: 160deg), box(fill: white)[160deg], anchor: "south-east")
let origin = (0,0)
let a44 = (4, 4)
//circle(origin, radius: 1, fill: none, stroke: (dash: "loosely-dotted", paint: white))
let mark = (
// symbol: ">",
// mark-style: (stroke: blue, fill: black),
// mark-size: 1,
// doesnt do anything
width: 0.2,
length: 0.3,
start: ">",
end: ">",
fill: black,
)
/*
let line1 = line(origin, (4,0), mark: mark, name: "l1")
line1
let vline(n, height: 0.15) = {
let x1 = n
let x2 = n
let y1 = -height
let y2 = height
line((x1, y1), (x2, y2))
content((x1, y1 - 0.5), text(str(n)))
}
for i in range(0, 9) {
if (i == 3) {
circle((2,0.5), fill: black, radius: 0.1,
name: "point"
)
content("point.north", [hi])
}
if i == 0 or i == 8 or i == 1 or i == 7{
continue
}
vline(i / 2)
}
//circle((-3,-3), radius: 1, fill: yellow)
//grid(origin, a44)
// box and whisker ...
// right now ... it doesnt work from my computer ...
// loading a template file
// loading generated files
|
Subsets and Splits
No saved queries yet
Save your SQL queries to embed, download, and access them later. Queries will appear here once saved.