repo
stringlengths 26
115
| file
stringlengths 54
212
| language
stringclasses 2
values | license
stringclasses 16
values | content
stringlengths 19
1.07M
|
---|---|---|---|---|
https://github.com/jinnovation/resume | https://raw.githubusercontent.com/jinnovation/resume/main/resume.typ | typst | #import "time.typ"
#import "data.typ": personal, skills, education, speaking, work
#show link: set text(blue)
#let heading_font = "Linux Libertine"
#let body_font = "Linux Libertine"
#let line_spacing = 6pt
#let cvheading(personal_info) = {
table(columns: (1fr, auto), inset: 0pt, stroke: none,
heading(level: 1)[ #personal_info.name ],
[ #link("mailto:" + personal_info.email) \
#link(personal_info.linkedin)[#personal_info.linkedin.split("//").at(1)] \
#link(personal_info.github)[#personal_info.github.split("//").at(1)] \
#link(personal_info.huggingface)[#personal_info.huggingface.split("//").at(1)]])
}
#let aux(content) = {
set text(fill: gray)
content
}
#let cvinit(doc) = {
set text(
font: body_font,
size: 10pt,
hyphenate: false,
)
set list(
spacing: line_spacing,
)
set par(
leading: line_spacing,
justify: true,
)
// section headings, e.g. "Professional Experience"
show heading.where(level: 2): it => block(width: 100%)[
#set align(left)
#set text(font: heading_font, size: 1.1em, weight: "bold")
#upper(it.body)
#v(-0.75em) #line(length: 100%, stroke: 1pt + black) // draw a line
]
// company names
show heading.where(level: 3): it => block(width: 100%)[
#set text(font: heading_font, size: 1.1em, weight: "bold", fill: blue)
#it
]
// my name
show heading.where(level: 1): it => block(width: 100%)[
#set text(font: heading_font, size: 2.0em, weight: "bold")
#upper(it.body)
#v(2pt)
]
set page(
paper: "us-letter", // a4, us-letter
numbering: none,
number-align: center, // left, center, right
margin: 1.25cm, // 1.25cm, 1.87cm, 2.5cm
)
doc
}
#let cvspeaking(speaking: speaking, isbreakable: true) = {
block(below: 2.0em)[
== Speaking
#for speak in speaking {
let date = time.strpdate(speak.date)
let title = if speak.url != none [#link(speak.url)[#speak.title]] else [#speak.title]
block(width: 100%, breakable: isbreakable, spacing: 0.5em)[
*#speak.conference*, "#title" #h(1fr) #aux[#date]
]
}
]
}
#let cvwork(work: work, isbreakable: true) = {
block(below: 2.0em)[
== Select Work Experience
#for w in work {
if w.at("hide", default: false) {
continue
}
let start = time.strpdate(w.startDate)
let end = if w.at("endDate", default: none) != none [#time.strpdate(w.endDate)] else [Current]
let org = if w.at("url", default: none) != none [
*#link(w.url)[#w.organization]*
] else [
*#w.organization*
]
block(width: 100%, breakable: isbreakable)[
=== #org
*#w.position* #h(1fr) #aux[#w.location, #start #sym.dash.en #end] \
#if w.keys().contains("blurb") [
#set text(style: "italic")
#w.blurb
]
#if w.keys().contains("highlights") [
#for hi in w.highlights [
- #hi
]
]
]
}
]
}
#let cv_skills(skills: skills) = {
[
== Skills
#for (group, items) in skills [
- *#group*: #items.join(", ")
]
]
}
#let cveducation(education: education, isbreakable: true) = {
block(below: 2.0em)[
== Education
#for edu in education {
block(width: 100%, breakable: isbreakable)[
*#edu.institution*
#text(style: "italic")[
#edu.degrees.map(it => [#it.type #it.area]).join(", ")
]
#h(1fr)
#aux[#edu.startYear #sym.dash.en #edu.endYear]
]
}
]
}
#let endnote() = {
place(
bottom + right,
block[
#set text(size: 8pt, fill: silver)
Last Updated: #datetime.today().display("[year]-[month]-[day]").
Also available at: #link("https://jonathanj.in")[https://jonathanj.in]
]
)
}
// ========================================================================== //
#show: doc => cvinit(doc)
#cvheading(personal)
#cvwork()
#cveducation()
#cvspeaking()
#cv_skills()
#endnote()
|
|
https://github.com/7sDream/fonts-and-layout-zhCN | https://raw.githubusercontent.com/7sDream/fonts-and-layout-zhCN/master/template/heading.typ | typst | Other | #import "consts.typ"
#import "util.typ"
#let __metadata-head(..data) = metadata((
kind: "head",
) + data.named())
#let __get-metadata-head(it) = {
assert.eq(it.func(), heading)
let next_heading = util.query-first(heading, it.location(), none)
let end = if next_heading != none {
next_heading.location()
} else {
none
}
return util.query-first(metadata, it.location(), end, kind: "head")
}
#let __get-head-footnote(meta) = {
let body = if meta != none {
meta.at("footnote", default: none)
}
if body != none {
footnote(body)
}
}
#let __heading(
show-number: true,
number-function: none,
is_center: false,
clean_footnote_counter: false,
text_size: 1em,
above: none,
bellow: none,
it,
) = [
#set text(size: text_size, weight: "regular")
#let head = __get-metadata-head(it)
#let foot = __get-head-footnote(head)
#if clean_footnote_counter {
counter(footnote).update(0)
}
#let body = it.body
#if show-number and it.numbering != none {
let num = numbering(it.numbering, ..counter(heading).at(it.location()))
if number-function != none {
num = number-function(num, it)
}
body = num + h(0.6em) + body
}
#let body = strong[#body] + foot
#if is_center {
body = align(center, body)
}
#if above != none [
#v(consts.size.par-spacing + above, weak: true)
]
#body
#if bellow != none [
#v(consts.size.par-spacing + bellow, weak: true)
]
]
#let heading-setting(doc) = [
#set heading(numbering: "1.1.1.1") if util.is-pdf-target()
#show heading.where(level: 1): __heading.with(
number-function: (num, it) => [第#num#it.supplement],
is_center: true,
clean_footnote_counter: true,
text_size: consts.size.Huge,
above: consts.size.chapter-spacing,
bellow: consts.size.chapter-spacing,
)
#show heading.where(level: 2): __heading.with(
text_size: consts.size.LARGE,
above: consts.size.section-above,
)
#show heading.where(level: 3): __heading.with(
text_size: consts.size.Large,
above: consts.size.subsection-above,
)
#show heading.where(level: 4): __heading.with(
text_size: consts.size.large,
above: consts.size.subsubsection-above,
)
#doc
]
#let chapter(body, ..args) = [
#if util.is-pdf-target() { pagebreak(weak: true) }
#heading(level: 1, supplement: [章], ..args.named().at("heading", default: (:)), body)
#if "label" in args.named() {
args.named().at("label")
}
#__metadata-head(..args.named().at("meta", default: (:)))
]
#let section(body, ..args) = [
#heading(level: 2, ..args.named().at("heading", default: (:)), body)
#if "label" in args.named() {
args.named().at("label")
}
#__metadata-head(..args.named().at("meta", default: (:)))
]
#let subsection(body, ..args) = [
#heading(level: 3, ..args.named().at("heading", default: (:)), body)
#if "label" in args.named() {
args.named().at("label")
}
#__metadata-head(..args.named().at("meta", default: (:)))
]
#let subsubsection(body, ..args) = [
#heading(level: 4, ..args.named().at("heading", default: (:)), body)
#if "label" in args.named() {
args.named().at("label")
}
#__metadata-head(..args.named().at("meta", default: (:)))
]
|
https://github.com/Wallbreaker5th/typst-introduction-in-one-page | https://raw.githubusercontent.com/Wallbreaker5th/typst-introduction-in-one-page/master/typst-introduction.typ | typst | Creative Commons Zero v1.0 Universal | #set text(
font: "LXGW WenKai GB",
size: 14pt,
weight: 700,
)
#show raw: set text(
font: "LXGW WenKai Mono GB",
weight: 700,
)
#set page(
margin: (x: 3%, y: 5%),
flipped: true,
)
#show raw.where(block: true): it => {
block(it, fill: gray.lighten(80%), inset: 0.5em, radius: 0.5em)
}
#let title(it) = {
move(
box(
text(stroke: black + 0.01em, size: 1.8em, it),
fill: green.lighten(60%),
outset: 0.5cm,
radius: (top-left: 0.5cm, bottom-right: 0.5cm),
),
dx: -0.2cm,
)
}
#let under-heavy-line(it) = {
underline(
it,
stroke: green.lighten(80%) + 0.5em,
evade: false,
background: true,
offset: -0.5pt,
)
}
#let subtitle(it) = {
set text(
stroke: 0.01em,
size: 1.4em,
)
under-heavy-line(it)
}
#show heading.where(level: 2): it => {
align(center, under-heavy-line(it))
}
#show heading.where(level: 3): it => {
align(center, under-heavy-line(it))
}
#let main-stroke = blue.lighten(30%) + 0.2cm
#let sub-stroke = blue.lighten(60%) + 0.1cm
#let subsub-stroke = (paint: blue.lighten(60%), thickness: 0.05cm, dash: "dashed")
#let sLaTeX = {
set text(
font: "New Computer Modern Sans",
weight: 500,
)
box(
width: 2.55em,
{
set align(left)
[L]
place(top, dx: 0.3em, text(size: 0.7em)[A])
place(
top,
dx: 0.7em,
box(
width: 1.8em,
{
set align(left)
[T]
place(top, dx: 0.56em, dy: 0.22em)[E]
place(top, dx: 1.1em)[X]
},
),
)
},
)
}
#let sample-code = ```typ
#set heading(numbering: "一、") // 样式设置
= 兰亭集序
永和九年,岁在*癸丑*,暮春之初,会于会稽山阴之兰亭,修禊事也。 // 标记语法
#{ // 编程语言
set text(size: 0.8em)
let t(name, s, o) = table(
inset:0.3em, columns:s.len()+1, align:center,
strong(name), ..s,
[*年份*],
..(range(o,s.len())+range(o)).map(str)
)
t("天干","甲乙丙丁戊己庚辛壬癸".clusters(),4)
t("地支","子丑寅卯辰巳午未申酉戌亥".clusters(),4)
}
$ cases(x equiv 3 (mod 10), // 公式排版
x equiv 5 (mod 12) )
=> x equiv 53 (mod 60) $
$ 353 - floor(353/60) = 53 $
```
#v(-1em)
#grid(
columns: (16em, 1.5fr, 1fr, 9.5em, 9.5em),
// stroke: black+1pt,
inset: (x: 0.5em, y: 0.5em),
grid.cell(
rowspan: 2,
inset: (bottom: 1.5em),
title[Typst 介绍与展示]
),
grid.cell(
rowspan: 1,
colspan: 1,
x: 0,
y: 2,
)[
#subtitle[什么是 Typst?]
Typst 是一门用于文档排版的标记语言。通过 Typst,你可以用简洁语法编写出美观的文档。
如果你使用过 Markdown 或者 #sLaTeX,你应该很熟悉“从带标记的文本生成文档”的流程。
],
grid.cell(
rowspan: 3,
colspan: 1,
x: 0,
y: 3,
)[
#subtitle[Typst 的优势]
- 公式排版、参考文献管理等基本功能
- 语法简洁,容易上手
- 现代的、增量编译的编程语言可以
- 快速地生成文档,并实时预览
- 有更好的代码提示和报错信息
- 更方便地编程与编写模板
- 环境搭建简单
- 有包管理器,不需要像 TeX Live 那样在本地安装大量用不到的包
- 得益于友好的编程语言以及 Wasm 插件支持,Typst 已经有了许多功能强大的包
],
grid.cell(
rowspan: 1,
colspan: 4,
x: 1,
y: 0,
align: center,
inset: (right: 0pt)
)[
#subtitle[代码展示]
],
grid.cell(
rowspan: 3,
colspan: 2,
x: 1,
y: 1,
inset: (right: 0pt)
)[
#sample-code
],
grid.cell(
rowspan: 3,
colspan: 2,
x: 3,
y: 1,
)[
#set text(font: "Source Han Sans SC", weight: 500, size: 0.95em)
#eval("[" + sample-code.text + "]")
],
grid.cell(
rowspan: 1,
colspan: 4,
x: 1,
y: 4,
align: center
)[
#subtitle[部分包效果展示]
],
grid.cell(
rowspan: 1,
colspan: 1,
x: 3,
y: 5,
align: center,
)[
#import "@preview/cetz:0.2.1"
== CeTZ
#v(1em)
#cetz.canvas({
import cetz.draw: *
circle((0, 0), radius: 1)
let A = (60deg, 1)
let B = (120deg, 1)
line(A, B)
let C = (-80deg, 1)
let D = (-110deg, 1)
line(A, C, stroke: red)
line(B, C, stroke: red)
line(A, D, stroke: blue)
line(B, D, stroke: blue)
let angle = cetz.angle.angle
angle(C, A, B, stroke: red, fill: red.transparentize(70%), radius: 0.4)
angle(D, A, B, stroke: blue, fill: blue.transparentize(70%), radius: 0.4)
line(C, D, stroke: (dash: "dashed"))
let O = (0, 0)
circle(O, radius: 1pt, fill: black)
content(O, $O$, anchor: "south", padding: 3pt)
}, length: 1.5cm)
],
grid.cell(
rowspan: 1,
colspan: 1,
x: 2,
y: 5,
)[
#import "@preview/pinit:0.1.3": *
== Pinit
#v(1em)
后之览者,亦将有感于#pin(1)斯#pin(2)文。
#pinit-highlight(1, 2)
#pinit-point-from(2, [这])
],
grid.cell(
rowspan: 1,
colspan: 1,
x: 1,
y: 5,
)[
#import "@preview/showybox:2.0.1": showybox
== Showybox
#showybox(
frame: (
border-color: blue.darken(50%),
title-color: blue.lighten(60%),
body-color: blue.lighten(80%),
inset: 0.6em,
),
title-style: (
boxed-style: (
fill: blue.lighten(60%),
radius: (top-left: 10pt, bottom-right: 10pt),
),
color: black
),
title: "通知",
[近日将有一股强冷空气来袭,请注意保暖。],
[秋季天干物燥,要时刻注意消防安全。]
)
],
grid.cell(
rowspan: 1,
colspan: 1,
x: 4,
y: 5,
align: center,
)[
== Fletcher
#import "@preview/fletcher:0.4.2" as fletcher: node, edge
#fletcher.diagram(
node-stroke: blue.darken(50%),
node-fill: blue.lighten(80%),
spacing: 0.9em,
edge-stroke: 1pt,
node((0, 0), [A]),
edge("~>"),
node((-1, 1), [B\ C], corner-radius: 5pt),
edge("-->"),
node((1, 1), [D]),
edge("->"),
node((0, 2), [E]),
edge((0, 2), (0, 0), "->", stroke: red),
edge((0, 2), (-1, 1), "->", bend: 45deg),
edge((1, 1), "dd,lll,uu,r", "=>")
)
],
grid.vline(
x: 1,
stroke: main-stroke
),
grid.hline(
y: 4,
start: 1,
end: 6,
stroke: sub-stroke
),
)
#place(right+bottom, move(dy: 1.5em)[
#set text(fill: gray)
This work by Wallbreaker5th is marked with CC0 1.0.\
Repo: https://github.com/Wallbreaker5th/typst-introduction-in-one-page
])
|
https://github.com/Eleanoreee/DL_TAczb | https://raw.githubusercontent.com/Eleanoreee/DL_TAczb/main/main.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: "Assignment 3",
authors: (
"Eleanore who is DYING",
),
date: "September 28, 2023",
)
// We generated the example code below so you can see how
// your document will look. Go ahead and replace it with
// your own content!
== Problem 4
Demonstrating the equivalence between a multiple layer neural network without an activation function and a layer of linear networ
== Solution 4
Let's firstly consider a 2 layer neural network, while $W_1$ is weight matrix and $b$ is bias, it would compute $W_1 x + b_1$.
A second layer would then compute: $ W_2(W_1 x + b_1) + b_2 = W_2W_1 x + W_2b_1 +b_2 $
//$ W_3(W_2W_1 x + W_2b_1 +b_2) + b_3 = W_1W_2W_3x + W_2W_3b_1 + W_3b_2 + b_3 $
*which is equivalent to $W'x + b'$*.
Also, adding layers will not change the resulte.
Thus, we can concludes that MLP without activation function is equivalent to only a layer of linear network. This also tells us the function of activation function: add non-linear properties.
//$ W_n (W_(n-1)x + b_(n-1)) +b_n = (product_(i=1)^(n) W_i) x + $
== Problem 5
What does the negative sign signify in Gradient Descent?
== Solution 5
GD moves the vector in the *opposite direction* of the current slope towards the minima.
== Problem 6
What could be the outcome if there are too many layers with sigmoid as the activation function?
== Solution 6
Firstly, since $sigma$ is based on exponetial function, the *calculated amount is big*.
Secondly, when we use GD, the fomular for updating weight is,
$ w_(i+1) = w_i - eta (diff cal(L))/(diff w_t) $
while
$ (diff cal(L))/(diff w_i) &= (diff cal(L))/(diff x_i) dot (diff x_i)/(diff z_i) dot (diff z_i)/(diff w_i) \
&= (diff cal(L))/(diff x_i) dot sigma'(z_i)x_(i-1)
$
Since the derivative of $sigma$ is
$ sigma '(z) &= e^(-z)/((1+e^(-z))^2)
= sigma (z) (1-sigma (z))
$
Also, the range of derivative of $sigma$ is $(0, 0.25)$.
Thus, in the process of BP, as we approaching input layer, the continued multiplication will become smaller, causing *the update of gradient become slower*. In this situation, the neural network just work in shallow layers, in fact.
== Problem 7
Prove $tanh (z)+1 = 2 sigma (2z)$, and explore their potential relationship and why we replace sigmoid with tanh. (hint: range, derivative)
== Solution 7
As we know,
$ tanh (z) &= (1-e^(-2z))/(1+e^(-2z)) \
tanh (z) + 1 &= 2/(1+e^(-2z)) \
$
while
$ 2 sigma (2z) = 2 1/(1+e^(-2z))
$
Thus, $tanh (z)+1 = 2 sigma (2z)$
Then,let's look at the difference between this two function by graph.
#figure(
image("tanh vs. sigmoid.png", width: 40%),
caption: [
the image of $tanh$ vs. sigmoid
],
)
Transformation from $sigma$ to $tanh$ make the center(inflection point) of activation function change from $0.5$ to $0$. Thus, *use of $tanh$ will make the probability distribution after activating centered at $0$* rather than $0.5$, which is more natural.
Then, let's find the derivatives.
$ sigma '(z) = sigma (z) (1-sigma (z)) $
$ tanh '(z) &= (4e^(-2z))/(1+e^(-2z))^2 \
&= ((1+e^(-2z))^2-(1-e^(-2z))^2)/(1+e^(-2z))^2 \
&= 1- tanh (z)^2
$
Calculating and comparing the range of derivative for $tanh$ and $sigma$, we find,
$ tanh'(z) &: (0, 0.25) \
sigma '(z) &: (0, 1)
$
Thus, *larger derivatives of $tanh$ lead to faster convergence during training*, as updates to the model's parameters are more substantial.
//Thus, in the process of GD with backpropagation, while $z=w x$ and $y = g(z)$ the local gradient is,
//$ (diff a)/(diff w) &= (diff a)/ (diff z) dot (diff z)/(diff w) \
//&= a(1-a) dot x
//$
//Since $a(1-a)$ is always larger than $0$, the sign of local gradient will only depends on $x$. After proceesed by activation function $a= sigma(z)$, all $x$ will be larger than $0$, making the sign of the local gradient $(diff a)/(diff w)$ always positive.
== Problem 8
How can the problem of Overfitting be solved? Provide a list of at least three methods and illustrate two of them.
== Solution 8
*1. Imporve training dataset.*
We could have find or create more data.
*2. Randonly dropout some point in training set*
We could randomly egnore some of the neuro in the process of training.
*3. Use simple model rather than complicated one*.
== Problem 9
Thinking: Why does model training require more VRAM than inference? Not necessary to prove it, show me your guess.
== Solution 9
In the process of *training*, which is usually refers to BP. It requires space to *store each weight’s gradients and learning rates*.
*Inference* refers to FP, where only the parameters of network need to be active in the memory. The activations are discarded once the forward pass moves to a new layer. Hence, only the layer that is active in memory and the layer that gets calculated are comsumpting memory. Thus, inference only needs to continuously *hold the network parameters and temporarily hold two feature maps*. |
|
https://github.com/zurgl/typst-resume | https://raw.githubusercontent.com/zurgl/typst-resume/main/resume/en/education.typ | typst | #import "../../templates/resume/section.typ": *
#import "../../templates/resume/entry.typ": *
#import "@preview/fontawesome:0.1.0": *
#cvSection("Education")
|
|
https://github.com/Mc-Zen/pillar | https://raw.githubusercontent.com/Mc-Zen/pillar/main/tests/examples/number-alignment/test.typ | typst | MIT License | #set page(width: auto, height: auto, margin: 1pt)
#let clr = if "dark" in sys.inputs { white } else { black }
#set page(fill: white) if clr == black
#set text(fill: clr)
#set table.hline(stroke: clr)
#set table.vline(stroke: clr)
#import "/src/pillar.typ"
#let percm = $"cm"^(-1)$
#pillar.table(
cols: "l|CCCC",
[], [$Δ ν_0$ in #percm], [$B'_ν$ in #percm], [$B''_ν$ in #percm],[$D'_ν$ in #percm],
table.hline(),
[Measurement], [14525.278], [1.41], [1.47], [1.5e-5],
[Uncertainty], [2], [0.3], [0.3], [4e-6],
[Ref. [2]], [14525,74856], [1.37316], [1.43777], [5.401e-6]
) |
https://github.com/ukihot/igonna | https://raw.githubusercontent.com/ukihot/igonna/main/articles/infra/internet.typ | typst | == インターネットとネットワークの定義
ネットワークとはコンピュータとコンピュータが繋がることで情報を通信できる仕組みであり、構造を指す。
外部ネットワーク同士が繋がりあい、結果的に形成された地球上を駆け巡る巨大なネットワークの総称がインターネットである。
== インターネットの仕組み
総務省を引用する。@internet
#quote(attribution: [総務省])[ネットワーク上で、情報やサービスを他のコンピュータに提供するコンピュータをサーバ、サーバから提供された情報やサービスを利用するコンピュータをクライアントと呼びます。私たちが普段使うパソコンや携帯電話、スマートフォンなどは、クライアントにあたります。]
=== IPアドレス
IPアドレスは、コンピューターやスマートフォンなどがインターネット上で通信するときに使われる、そのデバイスを特定するための「住所」のようなものである。
家の住所があるように、コンピューターもそれぞれが異なるIPアドレスを持っている。
これにより、データがどのデバイスに届くかが決まる。
=== DNS
DNSは、Domain Name System(ドメインネームシステム)の略であり、人間が覚えやすいウェブサイトの名前(例: www.google.com)を、コンピューターが理解しやすいIPアドレスに変換するシステムである。
言い換えると、DNSはインターネット上での住所録のようなものです。
あるウェブサイトにアクセスするとき、DNSがそのウェブサイトの名前をIPアドレスに変換してくれます。
=== サブネットマスク
サブネットマスクは、IPアドレスをグループ分けする。
これにより、同じネットワーク内のデバイス同士は通信しやすくなる。
IPアドレスは通常、ネットワーク部とホスト部に分かれており、サブネットマスクは、どの部分がネットワークで、どの部分がホストであるかを示す。
ネットワークを効果的に管理し、通信を効率的に行う目的がある。
=== ゲートウェイ
ゲートウェイは、コンピューターネットワークにおいて異なるプロトコルやネットワーク間で通信を中継・変換するためのデバイスやソフトウェアのことを指す。
簡単に言えば、異なる種類のネットワークやプロトコル間で通信を円滑に行うための出入り口のようなものである。
内部ネットワークと外部ネットワークの中継地である。
=== LAN
LAN(Local Area Network)は、狭い範囲内でコンピューターやデバイスがつながっているネットワークのことである。
学校内のコンピューター、家庭内のデバイス、あるいはオフィス内のコンピューター同士が、ケーブルや無線などで直接つながっている状態を指す。
=== ファイアウォール
ファイアウォールは、内部ネットワークを守るための防御壁のようなものである。
例えば、会社の警備員が不審な人が入ってこないように見張っているように、ネットワーク上においても不正アクセスや悪意あるプログラムから防衛する必要がある。
ファイアウォールは、ネットワークに入るデータや通信をチェックし、ウイルスや不正アクセスを遮断することで、コンピューターや情報を安全を確保する。
=== DMZ
DMZは、DeMilitarized Zone(非武装地帯)の略であり、外部と内部のネットワークの間においてファイアウォールで隔離された中立的なセグメント(区域)を指す。
外部のユーザーやデバイスがネットワークにアクセスする際の対話エリアであり、ここに置かれたサーバーやシステムが外部からのアクセスを受け付け、内部の重要なデータやシステムに直接アクセスされないようにする。
外部ネットワークにはあらゆる脅威が存在する。
DMZは、内部への侵略を目論む攻撃者から内部情報資産を防衛するための仕組みとして機能する。 |
|
https://github.com/typst/packages | https://raw.githubusercontent.com/typst/packages/main/packages/preview/unichar/0.1.0/ucd/block-0A80.typ | typst | Apache License 2.0 | #let data = (
(),
("GUJARATI SIGN CANDRABINDU", "Mn", 0),
("GUJARATI SIGN ANUSVARA", "Mn", 0),
("GUJARATI SIGN VISARGA", "Mc", 0),
(),
("GUJARATI LETTER A", "Lo", 0),
("GUJARATI LETTER AA", "Lo", 0),
("GUJARATI LETTER I", "Lo", 0),
("GUJARATI LETTER II", "Lo", 0),
("GUJARATI LETTER U", "Lo", 0),
("GUJARATI LETTER UU", "Lo", 0),
("GUJARATI LETTER VOCALIC R", "Lo", 0),
("GUJARATI LETTER VOCALIC L", "Lo", 0),
("GUJARATI VOWEL CANDRA E", "Lo", 0),
(),
("GUJARATI LETTER E", "Lo", 0),
("GUJARATI LETTER AI", "Lo", 0),
("GUJARATI VOWEL CANDRA O", "Lo", 0),
(),
("GUJARATI LETTER O", "Lo", 0),
("GUJARATI LETTER AU", "Lo", 0),
("GUJARATI LETTER KA", "Lo", 0),
("GUJARATI LETTER KHA", "Lo", 0),
("GUJARATI LETTER GA", "Lo", 0),
("GUJARATI LETTER GHA", "Lo", 0),
("GUJARATI LETTER NGA", "Lo", 0),
("GUJARATI LETTER CA", "Lo", 0),
("GUJARATI LETTER CHA", "Lo", 0),
("GUJARATI LETTER JA", "Lo", 0),
("GUJARATI LETTER JHA", "Lo", 0),
("GUJARATI LETTER NYA", "Lo", 0),
("GUJARATI LETTER TTA", "Lo", 0),
("GUJARATI LETTER TTHA", "Lo", 0),
("GUJARATI LETTER DDA", "Lo", 0),
("GUJARATI LETTER DDHA", "Lo", 0),
("GUJARATI LETTER NNA", "Lo", 0),
("GUJARATI LETTER TA", "Lo", 0),
("GUJARATI LETTER THA", "Lo", 0),
("GUJARATI LETTER DA", "Lo", 0),
("GUJARATI LETTER DHA", "Lo", 0),
("GUJARATI LETTER NA", "Lo", 0),
(),
("GUJARATI LETTER PA", "Lo", 0),
("GUJARATI LETTER PHA", "Lo", 0),
("GUJARATI LETTER BA", "Lo", 0),
("GUJARATI LETTER BHA", "Lo", 0),
("GUJARATI LETTER MA", "Lo", 0),
("GUJARATI LETTER YA", "Lo", 0),
("GUJARATI LETTER RA", "Lo", 0),
(),
("GUJARATI LETTER LA", "Lo", 0),
("GUJARATI LETTER LLA", "Lo", 0),
(),
("GUJARATI LETTER VA", "Lo", 0),
("GUJARATI LETTER SHA", "Lo", 0),
("GUJARATI LETTER SSA", "Lo", 0),
("GUJARATI LETTER SA", "Lo", 0),
("GUJARATI LETTER HA", "Lo", 0),
(),
(),
("GUJARATI SIGN NUKTA", "Mn", 7),
("GUJARATI SIGN AVAGRAHA", "Lo", 0),
("GUJARATI VOWEL SIGN AA", "Mc", 0),
("GUJARATI VOWEL SIGN I", "Mc", 0),
("GUJARATI VOWEL SIGN II", "Mc", 0),
("GUJARATI VOWEL SIGN U", "Mn", 0),
("GUJARATI VOWEL SIGN UU", "Mn", 0),
("GUJARATI VOWEL SIGN VOCALIC R", "Mn", 0),
("GUJARATI VOWEL SIGN VOCALIC RR", "Mn", 0),
("GUJARATI VOWEL SIGN CANDRA E", "Mn", 0),
(),
("GUJARATI VOWEL SIGN E", "Mn", 0),
("GUJARATI VOWEL SIGN AI", "Mn", 0),
("GUJARATI VOWEL SIGN CANDRA O", "Mc", 0),
(),
("GUJARATI VOWEL SIGN O", "Mc", 0),
("GUJARATI VOWEL SIGN AU", "Mc", 0),
("GUJARATI SIGN VIRAMA", "Mn", 9),
(),
(),
("GUJARATI OM", "Lo", 0),
(),
(),
(),
(),
(),
(),
(),
(),
(),
(),
(),
(),
(),
(),
(),
("GUJARATI LETTER VOCALIC RR", "Lo", 0),
("GUJARATI LETTER VOCALIC LL", "Lo", 0),
("GUJARATI VOWEL SIGN VOCALIC L", "Mn", 0),
("GUJARATI VOWEL SIGN VOCALIC LL", "Mn", 0),
(),
(),
("GUJARATI DIGIT ZERO", "Nd", 0),
("GUJARATI DIGIT ONE", "Nd", 0),
("GUJARATI DIGIT TWO", "Nd", 0),
("GUJARATI DIGIT THREE", "Nd", 0),
("GUJARATI DIGIT FOUR", "Nd", 0),
("GUJARATI DIGIT FIVE", "Nd", 0),
("GUJARATI DIGIT SIX", "Nd", 0),
("GUJARATI DIGIT SEVEN", "Nd", 0),
("GUJARATI DIGIT EIGHT", "Nd", 0),
("GUJARATI DIGIT NINE", "Nd", 0),
("GUJARATI ABBREVIATION SIGN", "Po", 0),
("GUJARATI RUPEE SIGN", "Sc", 0),
(),
(),
(),
(),
(),
(),
(),
("GUJARATI LETTER ZHA", "Lo", 0),
("GUJARATI SIGN SUKUN", "Mn", 0),
("GUJARATI SIGN SHADDA", "Mn", 0),
("GUJARATI SIGN MADDAH", "Mn", 0),
("GUJARATI SIGN THREE-DOT NUKTA ABOVE", "Mn", 0),
("GUJARATI SIGN CIRCLE NUKTA ABOVE", "Mn", 0),
("GUJARATI SIGN TWO-CIRCLE NUKTA ABOVE", "Mn", 0),
)
|
https://github.com/Yzx7/public_study_files | https://raw.githubusercontent.com/Yzx7/public_study_files/main/Monografía FIEE/chapters/intro.typ | typst | = Introducción
El tema de estudio de esta experiencia es la *ley de reflexión en espejos planos*. El problema que se pretende resolver en el laboratorio es comprobar experimentalmente si la *ley de reflexión* se cumple en todas las circunstancias observadas. Según esta ley, el *ángulo de incidencia* es siempre igual al *ángulo de reflexión*, lo que implica que un rayo de luz, al incidir en una superficie reflectante como un espejo plano, será reflejado siguiendo esta relación matemática.
En cuanto a los fundamentos teóricos, la ley de reflexión establece que el rayo incidente, el rayo reflejado y la normal a la superficie del espejo están todos contenidos en un mismo plano, y que el ángulo de incidencia (θi) es igual al ángulo de reflexión (θr). Además, se comprueba que un espejo plano forma siempre una *imagen virtual*, simétrica y de tamaño igual al del objeto real. Así, se cumplen las relaciones:
- *Distancia del objeto al espejo (s₀)* = *Distancia de la imagen al espejo (si)*
- *Tamaño del objeto (h₀)* = *Tamaño de la imagen (hi)*
El propósito de este experimento es, por lo tanto, *verificar la ley de reflexión* y comprobar que la distancia y tamaño del objeto reflejado son idénticos a los del objeto real.
|
|
https://github.com/bigskysoftware/hypermedia-systems-book | https://raw.githubusercontent.com/bigskysoftware/hypermedia-systems-book/main/ch06-more-htmx-patterns.typ | typst | Other | #import "lib/definitions.typ": *
== More Htmx Patterns
=== Active Search <_active_search>
So far so good with Contact.app: we have a nice little web application with some
significant improvements over a plain HTML-based application. We’ve added a
proper "Delete Contact" button, done some dynamic validation of input and looked
at different approaches to add paging to the application. As we have said, many
web developers would expect that a lot of JavaScript-based scripting would be
required to get these features, but we’ve done it all in relatively pure HTML,
using only htmx attributes.
We _will_ eventually add some client-side scripting to our application:
hypermedia is powerful, but it isn’t _all powerful_
and sometimes scripting might be the best (or only) way to achieve a given goal.
For now, however, let’s see what we can accomplish with hypermedia.
The first advanced htmx feature we will create is known as the "Active Search"
pattern. Active Search is when, as a user types text into a search box, the
results of that search are dynamically shown. This pattern was made popular when
Google adopted it for search results, and many applications now implement it.
To implement Active Search, we are going to use techniques closely related to
the way we did email validation in the previous chapter. If you think about it,
the two features are similar in many ways: in both cases we want to issue a
request as the user types into an input and then update some other element with
a response. The server-side implementations will, of course, be very different,
but the frontend code will look fairly similar due to htmx’s general approach of "issue
a request on an event and replace something on the screen."
==== Our Current Search UI <_our_current_search_ui>
Let’s recall what the search field in our application currently looks like:
#figure(caption: [Our search form],
```html
<form action="/contacts" method="get" class="tool-bar">
<label for="search">Search Term</label>
<input id="search" type="search" name="q"
value="{{ request.args.get('q') or '' }}"> <1>
<input type="submit" value="Search"/>
</form>
```)
1. The `q` or "query" parameter our client-side code uses to search.
Recall that we have some server-side code that looks for the `q`
parameter and, if it is present, searches the contacts for that term.
As it stands right now, the user must hit enter when the search input is
focused, or click the "Search" button. Both of these events will trigger a `submit` event
on the form, causing it to issue an HTTP `GET` and re-rendering the whole page.
Currently, thanks to `hx-boost`, the form will use an AJAX request for this `GET`,
but we don’t yet get that nice search-as-you-type behavior we want.
==== Adding Active Search <_adding_active_search>
#index[htmx patterns][active search]
To add active search behavior, we will attach a few htmx attributes to the
search input. We will leave the current form as it is, with an
`action` and `method`, so that the normal search behavior works even if a user
does not have JavaScript enabled. This will make our "Active Search" improvement
a nice "progressive enhancement."
So, in addition to the regular form behavior, we _also_ want to issue an HTTP `GET` request
when a key up occurs. We want to issue this request to the same URL as the
normal form submission. Finally, we only want to do this after a small pause in
typing has occurred.
As we said, this functionality is very similar to what we needed for email
validation. We can, in fact copy the `hx-trigger` attribute directly from our
email validation example, with its small 200-millisecond delay, to allow a user
to stop typing before a request is triggered.
This is another example of how common patterns come up again and again when
using htmx.
#figure(caption: [Adding active search behavior],
```html
<form action="/contacts" method="get" class="tool-bar">
<label for="search">Search Term</label>
<input id="search" type="search" name="q"
value="{{ request.args.get('q') or '' }}" <1>
hx-get="/contacts" <2>
hx-trigger="search, keyup delay:200ms changed"/> <3>
<input type="submit" value="Search"/>
</form>
```)
1. Keep the original attributes, so search will work if JavaScript is not
available.
2. Issue a `GET` to the same URL as the form.
3. Nearly the same `hx-trigger` specification as for the email input validation.
We made a small change to the `hx-trigger` attribute: we switched out the `change` event
for the `search` event. The `search` event is triggered when someone clears the
search or hits the enter key. It is a non-standard event, but it doesn’t hurt to
include here. The main functionality of the feature is provided by the second
triggering event, the `keyup`. As in the email example, this trigger is delayed
with the
`delay:200ms` modifier to "debounce" the input requests and avoid hammering our
server with requests on every keyup.
==== Targeting The Correct Element <_targeting_the_correct_element>
What we have is close to what we want, but we need to set up the correct target.
Recall that the default target for an element is itself. As things currently
stand, an HTTP `GET` request will be issued to the
`/contacts` path, which will, as of now, return an entire HTML document of
search results, and then this whole document will be inserted into the _inner_ HTML
of the search input.
This is, in fact, nonsense: `input` elements aren’t allowed to have any HTML
inside of them. The browser will, sensibly, just ignore the htmx request to put
the response HTML inside the input. So, at this point, when a user types
anything into our input, a request will be issued (you can see it in your
browser development console if you try it out) but, unfortunately, it will
appear to the user as if nothing has happened at all.
To fix this issue, what do we want to target with the update instead? Ideally
we’d like to just target the actual results: there is no reason to update the
header or search input, and that could cause an annoying flash as focus jumps
around.
The `hx-target` attribute allows us to do exactly that. Let’s use it to target
the results body, the `tbody` element in the table of contacts:
#figure(caption: [Adding active search behavior],
```html
<form action="/contacts" method="get" class="tool-bar">
<label for="search">Search Term</label>
<input id="search" type="search" name="q"
value="{{ request.args.get('q') or '' }}"
hx-get="/contacts"
hx-trigger="search, keyup delay:200ms changed"
hx-target="tbody"/> <1>
<input type="submit" value="Search"/>
</form>
<table>
...
<tbody>
...
</tbody>
</table>
```)
1. Target the `tbody` tag on the page.
Because there is only one `tbody` on the page, we can use the general CSS
selector `tbody` and htmx will target the body of the table on the page.
Now if you try typing something into the search box, we’ll see some results: a
request is made and the results are inserted into the document within the `tbody`.
Unfortunately, the content that is coming back is still an entire HTML document.
Here we end up with a "double render" situation, where an entire document has
been inserted _inside_ another element, with all the navigation, headers and
footers and so forth re-rendered within that element. This is an example of one
of those mis-targeting issues we mentioned earlier.
Thankfully, it is pretty easy to fix.
==== Paring Down Our Content <_paring_down_our_content>
Now, we could use the same trick we reached for in the "Click To Load" and "Infinite
Scroll" features: the `hx-select` attribute. Recall that the `hx-select` attribute
allows us to pick out the part of the response we are interested in using a CSS
selector.
So we could add this to our input:
#figure(caption: [Using "hx-select" for active search],
```html
<input id="search" type="search" name="q"
value="{{ request.args.get('q') or '' }}"
hx-get="/contacts"
hx-trigger="change, keyup delay:200ms changed"
hx-target="tbody"
hx-select="tbody tr"/> <1>
```)
1. Adding an `hx-select` that picks out the table rows in the `tbody` of the
response.
However, that isn’t the only fix for this problem, and, in this case, it isn’t
the most efficient one. Instead, let’s change the
_server-side_ of our Hypermedia-Driven Application to serve
_only the HTML content needed_.
==== HTTP Request Headers In Htmx <_http_request_headers_in_htmx>
In this section, we’ll look at another, more advanced technique for dealing with
a situation where we only want a _partial bit_ of HTML, rather than a full
document. Currently, we are letting the server create the full HTML document as
response and then, on the client side, we filter the HTML down to the bits that
we want. This is easy to do, and, in fact, might be necessary if we don’t
control the server side or can’t easily modify responses.
In our application, however, since we are doing "Full Stack" development (that
is: we control both frontend _and_ backend code, and can easily modify either)
we have another option: we can modify our server responses to return only the
content necessary, and remove the need to do client-side filtering.
This turns out to be more efficient, since we aren’t returning all the content
surrounding the bit we are interested in, saving bandwidth as well as CPU and
memory on the server side. So let’s explore returning different HTML content
based on the context information that htmx provides with the HTTP requests it
makes.
Here’s a look again at the current server-side code for our search logic:
#figure(caption: [Server-side search],
```python
@app.route("/contacts")
def contacts():
search = request.args.get("q")
if search is not None:
contacts_set = Contact.search(search) <1>
else:
contacts_set = Contact.all()
return render_template("index.html", contacts=contacts_set) <2>
```)
1. This is where the search logic happens.
2. We simply re-render the `index.html` template every time, no matter what.
How do we want to change this? We want to render two different bits of HTML
content _conditionally_:
- If this is a "normal" request for the entire page, we want to render the `index.html` template
in the current manner. In fact, we don’t want anything to change if this is a "normal"
request.
- However, if this is an "Active Search" request, we only want to render the
content that is within the `tbody`, that is, just the table rows of the page.
So we need some way to determine exactly which of these two different types of
requests to the `/contact` URL is being made, in order to know exactly which
content we want to render.
It turns out that htmx helps us distinguish between these two cases by including
a number of HTTP _Request Headers_ when it makes requests. Request Headers are a
feature of HTTP, allowing clients (e.g., web browsers) to include name/value
pairs of metadata associated with requests to help the server understand what
the client is requesting.
Here is an example of (some of) the headers the FireFox browser issues when
requesting `https://hypermedia.systems`:
#figure(caption: [HTTP headers],
```http
GET / HTTP/2
Host: hypermedia.systems
User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:103.0) Gecko/20100101 Firefox/103.0
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,*/*;q=0.8
Accept-Encoding: gzip, deflate, br
Accept-Language: en-US,en;q=0.5
Cache-Control: no-cache
Connection: keep-alive
DNT: 1
Pragma: no-cache
```)
Htmx takes advantage of this feature of HTTP and adds additional headers and,
therefore, additional _context_ to the HTTP requests that it makes. This allows
you to inspect those headers and choose what logic to execute on the server, and
what sort of HTML response you want to send to the client.
Here is a table of the HTTP headers that htmx includes in HTTP requests:
/ `HX-Boosted`: #[
This will be the string "true" if the request is made via an element using
hx-boost
]
/ `HX-Current-URL`: #[
This will be the current URL of the browser
]
/ `HX-History-Restore-Request`: #[
This will be the string "true" if the request is for history restoration after a
miss in the local history cache
]
/ `HX-Prompt`: #[
This will contain the user response to an hx-prompt
]
/ `HX-Request`: #[
This value is always "true" for htmx-based requests
]
/ `HX-Target`: #[
This value will be the id of the target element if it exists
]
/ `HX-Trigger-Name`: #[
This value will be the name of the triggered element if it exists
]
/ `HX-Trigger`: #[
This value will be the id of the triggered element if it exists
]
Looking through this list of headers, the last one stands out: we have an id, `search` on
our search input. So the value of the `HX-Trigger`
header should be set to `search` when the request is coming from the search
input, which has the id `search`.
Let’s add some conditional logic to our controller to look for that header and,
if the value is `search`, we render only the rows rather than the whole `index.html` template:
#figure(caption: [Updating our server-side search],
```python
@app.route("/contacts")
def contacts():
search = request.args.get("q")
if search is not None:
contacts_set = Contact.search(search)
if request.headers.get('HX-Trigger') == 'search': <1>
# TODO: render only the rows here <2>
else:
contacts_set = Contact.all()
return render_template("index.html", contacts=contacts_set)
```)
1. If the request header `HX-Trigger` is equal to "search" we want to do something
different.
2. We need to learn how to render just the table rows.
OK, so how do we render only the result rows?
==== Factoring Your Templates <_factoring_your_templates>
Now we come to a common pattern in htmx: we want to _factor_ our server-side
templates. This means that we want to break our templates up a bit so that they
can be called from multiple contexts. In this case, we want to break the rows of
the results table out to a separate template we will call `rows.html`. We will
include it from the original
`index.html` template, and also use it in our controller to render it by itself
when we want to respond with only the rows for Active Search requests.
Here’s what the table in our `index.html` file currently looks like:
#figure(caption: [The contacts table],
```html
<table>
<thead>
<tr>
<th>First <th>Last <th>Phone <th>Email <th/>
</tr>
</thead>
<tbody>
{% for contact in contacts %}
<tr>
<td>{{ contact.first }}</td>
<td>{{ contact.last }}</td>
<td>{{ contact.phone }}</td>
<td>{{ contact.email }}</td>
<td><a href="/contacts/{{ contact.id }}/edit">Edit</a>
<a href="/contacts/{{ contact.id }}">View</a></td>
</tr>
{% endfor %}
</tbody>
</table>
```)
The `for` loop in this template is what produces all the rows in the final
content generated by `index.html`. What we want to do is to move the `for` loop
and, therefore, the rows it creates out to a
_separate template file_ so that only that small bit of HTML can be rendered
independently from `index.html`.
Again, let’s call this new template `rows.html`:
#figure(caption: [Our new `rows.html` file],
```html
{% for contact in contacts %}
<tr>
<td>{{ contact.first }}</td>
<td>{{ contact.last }}</td>
<td>{{ contact.phone }}</td>
<td>{{ contact.email }}</td>
<td><a href="/contacts/{{ contact.id }}/edit">Edit</a>
<a href="/contacts/{{ contact.id }}">View</a></td>
</tr>
{% endfor %}
```)
Using this template we can render only the `tr` elements for a given collection
of contacts.
Of course, we still want to include this content in the `index.html`
template: we are _sometimes_ going to be rendering the entire page, and
sometimes only rendering the rows. In order to keep the `index.html`
template rendering properly, we can include the `rows.html` template by using
the jinja `include` directive at the position we want the content from `rows.html` inserted:
#figure(caption: [Including the new file],
```html
<table>
<thead>
<tr>
<th>First</th>
<th>Last</th>
<th>Phone</th>
<th>Email</th>
<th></th>
</tr>
</thead>
<tbody>
{% include 'rows.html' %} <1>
</tbody>
</table>
```)
1. This directive "includes" the `rows.html` file, inserting its content into the
current template.
So far, so good: our `/contacts` page is still rendering properly, just as it
did before we split the rows out of the `index.html` template.
==== Using Our New Template <_using_our_new_template>
The last step in factoring our templates is to modify our web controller to take
advantage of the new `rows.html` template file when it responds to an active
search request.
Since `rows.html` is just another template, just like `index.html`, all we need
to do is call the `render_template` function with `rows.html`
rather than `index.html`. This will render _only_ the row content rather than
the entire page:
#figure(caption: [Updating our server-side search],
```python
@app.route("/contacts")
def contacts():
search = request.args.get("q")
if search is not None:
contacts_set = Contact.search(search)
if request.headers.get('HX-Trigger') == 'search':
return render_template("rows.html", contacts=contacts_set) <1>
else:
contacts_set = Contact.all()
return render_template("index.html", contacts=contacts_set)
```)
1. Render the new template in the case of an active search.
Now, when an Active Search request is made, rather than getting an entire HTML
document back, we only get a partial bit of HTML, the table rows for the
contacts that match the search. These rows are then inserted into the `tbody` on
the index page, without any need for
`hx-select` or other client-side processing.
And, as a bonus, the old form-based search _still works_. We conditionally
render the rows only when the `search` input issues the HTTP request via htmx.
Again, this is a progressive enhancement to our application.
#sidebar[HTTP Headers & Caching][One subtle aspect of the approach we are taking here, using headers to determine
the content of what we return, is a feature baked into HTTP: caching. In our
request handler, we are now returning different content depending on the value
of the `HX-Trigger` header. If we were to use HTTP Caching, we might get into a
situation where someone makes a
_non-htmx_ request (e.g., refreshing a page) and yet the
_htmx_ content is returned from the HTTP cache, resulting in a partial page of
content for the user.
The solution to this problem is to use the HTTP Response `Vary` header and call
out the htmx headers that you are using to determine what content you are
returning. A full explanation of HTTP Caching is beyond the scope of this book,
but the
#link(
"https://developer.mozilla.org/en-US/docs/Web/HTTP/Caching",
)[MDN article on the topic]
is quite good, and the
#link("https://htmx.org/docs/#caching")[htmx documentation] discusses this issue
as well.]
==== Updating the Navigation Bar With "hx-push-url" <_updating_the_navigation_bar_with_hx_push_url>
One shortcoming of our current Active Search implementation, when compared with
the normal form submission, is that when you submit the form version it updates
the navigation bar of the browser to include the search term. So, for example,
if you search for "joe" in the search box, you will end up with a url that looks
like this in your browser’s nav bar:
#figure(caption: [The updated location after a form search],
```
https://example.com/contacts?q=joe
```)
This is a nice feature of browsers: it allows you to bookmark this search or to
copy the URL and send it to someone else. All they have to do is to click on the
link, and they will repeat the exact same search. This is also tied in with the
browser’s notion of history: if you click the back button it will take you to
the previous URL that you came from. If you submit two searches and want to go
back to the first one, you can simply hit back and the browser will "return" to
that search.
#index[htmx patterns][back button support]
As it stands right now, during our Active Search, we are not updating the
browser’s navigation bar. So, users aren’t getting links that can be copied and
pasted, and you aren’t getting history entries either, which means no back
button support. Fortunately, we’ve already seen how to fix this: with the `hx-push-url` attribute.
The `hx-push-url` attribute lets you tell htmx "Please push the URL of this
request into the browser’s navigation bar." Push might seem like an odd verb to
use here, but that’s the term that the underlying browser history API uses,
which stems from the fact that it models browser history as a "stack" of
locations: when you go to a new location, that location is "pushed" onto the
stack of history elements, and when you click "back", that location is "popped"
off the history stack.
So, to get proper history support for our Active Search, all we need to do is to
set the `hx-push-url` attribute to `true`.
#figure(caption: [Updating the URL during active search],
```html
<input id="search" type="search" name="q"
value="{{ request.args.get('q') or '' }}"
hx-get="/contacts"
hx-trigger="change, keyup delay:200ms changed"
hx-target="tbody"
hx-push-url="true"/> <1>
```)
1. By adding the `hx-push-url` attribute with the value `true`, htmx will update
the URL when it makes a request.
Now, as Active Search requests are sent, the URL in the browser’s navigation bar
is updated to have the proper query in it, just like when the form is submitted.
You might not _want_ this behavior. You might feel it would be confusing to
users to see the navigation bar updated and have history entries for every
Active Search made, for example. Which is fine: you can simply omit the `hx-push-url` attribute
and it will go back to the behavior you want. The goal with htmx is to be
flexible enough to achieve the UX that _you_ want, while staying within the
declarative HTML model.
==== Adding A Request Indicator <_adding_a_request_indicator>
A final touch for our Active Search pattern is to add a request indicator to let
the user know that a search is in progress. As it stands the user has no
explicit signal that the active search functionality is handling a request. If
the search takes a bit, a user may end up thinking that the feature isn’t
working. By adding a request indicator we let the user know that the hypermedia
application is busy and they should wait (hopefully not too long!) for the
request to complete.
Htmx provides support for request indicators via the `hx-indicator`
attribute. This attribute takes, you guessed it, a CSS selector that points to
the indicator for a given element. The indicator can be anything, but it is
typically some sort of animated image, such as a gif or svg file, that spins or
otherwise communicates visually that
"something is happening."
#index[htmx patterns][request indicator]
#index[hx-indicator]
Let’s add a spinner after our search input:
#figure(caption: [Adding a request indicator to search],
```html
<input id="search" type="search" name="q"
value="{{ request.args.get('q') or '' }}"
hx-get="/contacts"
hx-trigger="change, keyup delay:200ms changed"
hx-target="tbody"
hx-push-url="true"
hx-indicator="#spinner"/> <1>
<img id="spinner" class="htmx-indicator"
src="/static/img/spinning-circles.svg"
alt="Request In Flight..."/> <2>
```)
1. The `hx-indicator` attribute points to the indicator image after the input.
2. The indicator is a spinning circle svg file, and has the
`htmx-indicator` class on it.
We have added the spinner right after the input. This visually co-locates the
request indicator with the element making the request, and makes it easy for a
user to see that something is in fact happening.
It just works, but how does htmx make the spinner appear and disappear? Note
that the indicator `img` tag has the `htmx-indicator` class on it.
`htmx-indicator` is a CSS class that is automatically injected into the page by
htmx. This class sets the default `opacity` of an element to
`0`, which hides the element from view, while at the same time not disrupting
the layout of the page.
When an htmx request is triggered that points to this indicator, another class, `htmx-request` is
added to the indicator which transitions its opacity to 1. So you can use just
about anything as an indicator, and it will be hidden by default. Then, when a
request is in flight, it will be shown. This is all done via standard CSS
classes, allowing you to control the transitions and even the mechanism by which
the indicator is shown (e.g., you might use `display` rather than `opacity`).
#sidebar[Use Request Indicators!][Request indicators are an important UX aspect of any distributed application. It
is unfortunate that browsers have de-emphasized their native request indicators
over time, and it is doubly unfortunate that request indicators are not part of
the JavaScript ajax APIs.
Be sure not to neglect this significant aspect of your application. Requests
might seem instant when you are working on your application locally, but in the
real world they can take quite a bit longer due to network latency. It’s often a
good idea to take advantage of browser developer tools that allow you to
throttle your local browser’s response times. This will give you a better idea
of what real world users are seeing, and show you where indicators might help
users understand exactly what is going on.]
With this request indicator, we now have a pretty sophisticated user experience
when compared with plain HTML, but we’ve built it all as a hypermedia-driven
feature. No JSON or JavaScript to be seen. And our implementation has the
benefit of being a progressive enhancement; the application will continue to
work for clients that don’t have JavaScript enabled.
=== Lazy Loading <_lazy_loading>
#index[htmx patterns][lazy loading]
With Active Search behind us, let’s move on to a very different sort of
enhancement: lazy loading. Lazy loading is when the loading of a particular bit
of content is deferred until later, when needed. This is commonly used as a
performance enhancement: you avoid the processing resources necessary to produce
some data until that data is actually needed.
Let’s add a count of the total number of contacts to Contact.app, just below the
bottom of our contacts table. This will give us a potentially expensive
operation that we can use to demonstrate how to add lazy loading with htmx.
First let’s update our server code in the `/contacts` request handler to get a
count of the total number of contacts. We will pass that count through to the
template to render some new HTML.
#figure(caption: [Adding a count to the UI],
```python
@app.route("/contacts")
def contacts():
search = request.args.get("q")
page = int(request.args.get("page", 1))
count = Contact.count() <1>
if search is not None:
contacts_set = Contact.search(search)
if request.headers.get('HX-Trigger') == 'search':
return render_template("rows.html",
contacts=contacts_set, page=page, count=count) <2>
else:
contacts_set = Contact.all(page)
return render_template("index.html",
contacts=contacts_set, page=page, count=count)
```)
1. Get the total count of contacts from the Contact model.
2. Pass the count out to the `index.html` template to use when rendering.
As with the rest of the application, in the interest of staying focused on the _hypermedia_ part
of Contact.app, we’ll skip over the details of how `Contact.count()` works. We
just need to know that:
- It returns the total count of contacts in the contact database.
- It may be slow (for the sake of our example).
Next lets add some HTML to our `index.html` that takes advantage of this new bit
of data, showing a message next to the "Add Contact" link with the total count
of users. Here is what our HTML looks like:
#figure(caption: [Adding a contact count element to the application],
```html
<p>
<a href="/contacts/new">Add Contact</a
> <span>({{ count }} total Contacts)</span> <1>
</p>
```)
1. A simple span with some text showing the total number of contacts.
Well that was easy, wasn’t it? Now our users will see the total number of
contacts next to the link to add new contacts, to give them a sense of how large
the contact database is. This sort of rapid development is one of the joys of
developing web applications the old way.
@fig-totalcontacts is what the feature looks like in our application. Beautiful.
#figure(image("images/screenshot_total_contacts.png"),
caption: [Total contact count display])<fig-totalcontacts>
Of course, as you probably suspected, all is not perfect. Unfortunately, upon
shipping this feature to production, we start getting complaints from users that
the application "feels slow." Like all good developers faced with a performance
issue, rather than guessing what the issue might be, we try to get a performance
profile of the application to see what exactly is causing the problem.
It turns out, surprisingly, that the problem is that innocent looking
`Contacts.count()` call, which is taking up to a second and a half to complete.
Unfortunately, for reasons beyond the scope of this book, it is not possible to
improve that load time, nor is possible to cache the result.
This leaves us with two options:
- Remove the feature.
- Come up with some other way to mitigate the performance issue.
Let’s assume that we can’t remove the feature, and therefore look at how we can
mitigate this performance issue by using htmx instead.
==== Pulling Out The Expensive Code <_pulling_out_the_expensive_code>
The first step in implementing the Lazy Load pattern is to pull the expensive
code --- that is, the call to `Contacts.count()` --- out of the request handler
for the `/contacts` endpoint.
Let’s put this function call into its own HTTP request handler as a new HTTP
endpoint that we will put at `/contacts/count`. For this new endpoint, we won’t
need to render a template at all: its sole job is going to be to render that
small bit of text that is in the span, "(22 total Contacts)."
Here is what the new code will look like:
#figure(caption: [Pulling the expensive code out],
```python
@app.route("/contacts")
def contacts():
search = request.args.get("q")
page = int(request.args.get("page", 1)) <1>
if search is not None:
contacts_set = Contact.search(search)
if request.headers.get('HX-Trigger') == 'search':
return render_template("rows.html",
contacts=contacts_set, page=page)
else:
contacts_set = Contact.all(page)
return render_template("index.html",
contacts=contacts_set, page=page) <2>
@app.route("/contacts/count")
def contacts_count():
count = Contact.count() <3>
return "(" + str(count) + " total Contacts)" <4>
```)
1. We no longer call `Contacts.count()` in this handler.
2. `Count` is no longer passed out to the template to render in the
`/contacts` handler.
3. We create a new handler at the `/contacts/count` path that does the expensive
calculation.
4. Return the string with the total number of contacts.
So now we have moved the performance issue out of the `/contacts`
handler code, which renders the main contacts table, and created a new HTTP
endpoint that will produce this expensive-to-create count string for us.
Now we need to get the content from this new handler _into_ the span, somehow.
As we said earlier, the default behavior of htmx is to place any content it
receives for a given request into the `innerHTML`
of an element, and that turns out to be exactly what we want here: we want to
retrieve this text and put it into the `span`. So we can simply place an `hx-get` attribute
on the span, pointing to this new path, and do exactly that.
However, recall that the default _event_ that will trigger a request for a `span` element
in htmx is the `click` event. Well, that’s not what we want! Instead, we want
this request to trigger immediately, when the page loads.
To do this, we can add the `hx-trigger` attribute to update the trigger of the
requests for the element, and use the `load` event.
The `load` event is a special event that htmx triggers on all content when it is
loaded into the DOM. By setting `hx-trigger` to `load`, we will cause htmx to
issue the `GET` request when the `span` element is loaded into the page.
Here is our updated template code:
#figure(caption: [Adding a contact count element to the application],
```html
<p>
<a href="/contacts/new">Add Contact</a
> <span hx-get="/contacts/count" hx-trigger="load"></span> <1>
</p>
```)
1. Issue a `GET` to `/contacts/count` when the `load` event occurs.
Note that the `span` starts empty: we have removed the content from it, and we
are allowing the request to `/contacts/count` to populate it instead.
And, check it out, our `/contacts` page is fast again! When you navigate to the
page it feels very snappy and profiling shows that yes, indeed, the page is
loading much more quickly. Why is that? Well, we’ve deferred the expensive
calculation to a secondary request, allowing the initial request to finish
loading faster.
You might say "OK, great, but it’s still taking a second or two to get the total
count on the page." True, but often the user may not be particularly interested
in the total count. They may just want to come to the page and search for an
existing user, or perhaps they may want to edit or add a user. The total count
of contacts is just a "nice to have" bit of information in these cases.
By deferring the calculation of the count in this manner we let users get on
with their use of the application while we perform the expensive calculation.
Yes, the total time to get all the information on the screen takes just as long.
It actually will be a bit longer, since we now need two HTTP requests to get all
the information for the page. But the
_perceived performance_ for the end user will be much better: they can do what
they want nearly immediately, even if some information isn’t available
instantaneously.
Lazy Loading is a great tool to have in your belt when optimizing web
application performance.
==== Adding An Indicator <_adding_an_indicator>
#index[htmx patterns][request indicator]
A shortcoming of the current implementation is that currently there is no
indication that the count request is in flight, it just appears at some point
when the request finishes.
This isn’t ideal. What we want here is an indicator, just like we added in our
Active Search example. And, in fact, we can simply reuse that same exact spinner
image, copy-and-pasted into the new HTML we have created.
Now, in this case, we have a one-time request and, once the request is over, we
are not going to need the spinner anymore. So it doesn’t make sense to use the
exact same approach we did with the active search example. Recall that in that
case we placed a spinner _after_ the span and using the `hx-indicator` attribute
to point to it.
In this case, since the spinner is only used once, we can put it
_inside_ the content of the span. When the request completes the content in the
response will be placed inside the span, replacing the spinner with the computed
contact count. It turns out that htmx allows you to place indicators with the `htmx-indicator` class
on them inside of elements that issue htmx-powered requests. In the absence of
an
`hx-indicator` attribute, these internal indicators will be shown when a request
is in flight.
So let’s add that spinner from the active search example as the initial content
in our span:
#figure(caption: [Adding an indicator to our lazily loaded content],
```html
<span hx-get="/contacts/count" hx-trigger="load">
<img id="spinner" class="htmx-indicator"
src="/static/img/spinning-circles.svg"/> <1>
</span>
```)
1. Yep, that’s it.
Now when the user loads the page, rather than having the total contact count
magically appear, there is a nice spinner indicating that something is coming.
Much better.
Note that all we had to do was copy and paste our indicator from the active
search example into the `span`. Once again we see how htmx provides flexible,
composable features and building blocks. Implementing a new feature is often
just copy-and-paste, maybe a tweak or two, and you are done.
==== But That’s Not Lazy! <_but_thats_not_lazy>
#index[htmx patterns][lazy loading]
You might say "OK, but that’s not really lazy. We are still loading the count
immediately when the page is loaded, we are just doing it in a second request.
You aren’t really waiting until the value is actually needed."
Fine. Let’s make it _lazy_ lazy: we’ll only issue the request when the `span` scrolls
into view.
To do that, lets recall how we set up the infinite scroll example: we used the `revealed` event
for our trigger. That’s all we want here, right? When the element is revealed we
issue the request?
Yep, that’s it. Once again, we can mix and match concepts across various UX
patterns to come up with solutions to new problems in htmx.
#figure(caption: [Making it truly lazy],
```html
<span hx-get="/contacts/count" hx-trigger="revealed"> <1>
<img id="spinner" class="htmx-indicator"
src="/static/img/spinning-circles.svg"/>
</span>
```)
1. Change the `hx-trigger` to `revealed`.
Now we have a truly lazy implementation, deferring the expensive computation
until we are absolutely sure we need it. A pretty cool trick, and, again, a
simple one-attribute change demonstrates the flexibility of both htmx and the
hypermedia approach.
=== Inline Delete <_inline_delete>
#index[htmx patterns][inline delete]
For our next hypermedia trick, we are going to implement the "Inline Delete"
pattern. With this feature, a contact can be deleted directly from the table of
all contacts, rather than requiring the user to navigate all the way to the edit
view of particular contact, in order to access the "Delete Contact" button we
added in the last chapter.
Recall that we already have "Edit" and "View" links for each row, in the
`rows.html` template:
#figure(caption: [The existing row actions],
```html
<td>
<a href="/contacts/{{ contact.id }}/edit">Edit</a>
<a href="/contacts/{{ contact.id }}">View</a>
</td>
```)
Now we want to add a "Delete" link as well. And, thinking on it, we want that
link to act an awful lot like the "Delete Contact" button from
`edit.html`, don’t we? We’d like to issue an HTTP `DELETE` to the URL for the
given contact and we want a confirmation dialog to ensure the user doesn’t
accidentally delete a contact.
Here is the "Delete Contact" button html:
#figure(caption: [The existing row actions],
```html
<button
hx-delete="/contacts/{{ contact.id }}"
hx-push-url="true"
hx-confirm="Are you sure you want to delete this contact?"
hx-target="body">
Delete Contact
</button>
```)
As you may suspect by now, this is going to be another copy-and-paste job.
One thing to note is that, in the case of the "Delete Contact" button, we wanted
to re-render the whole screen and update the URL, since we are going to be
returning from the edit view for the contact to the list view of all contacts.
In the case of this link, however, we are already on the list of contacts, so
there is no need to update the URL, and we can omit the `hx-push-url` attribute.
#index[hx-delete][example]
Here is the code for our inline "Delete" link:
#figure(caption: [The existing row actions],
```html
<td>
<a href="/contacts/{{ contact.id }}/edit">Edit</a>
<a href="/contacts/{{ contact.id }}">View</a>
<a href="#" hx-delete="/contacts/{{ contact.id }}"
hx-confirm="Are you sure you want to delete this contact?"
hx-target="body">Delete</a> <1>
</td>
```)
1. Almost a straight copy of the "Delete Contact" button.
As you can see, we have added a new anchor tag and given it a blank target (the `#` value
in its `href` attribute) to retain the correct mouse-over styling behavior of
the link. We’ve also copied the
`hx-delete`, `hx-confirm` and `hx-target` attributes from the "Delete Contact"
button, but omitted the `hx-push-url` attributes since we don’t want to update
the URL of the browser.
We now have inline delete working, even with a confirmation dialog. A user can
click on the "Delete" link and the row will disappear from the UI as the entire
page is re-rendered.
#sidebar[A Style Sidebar][One side effect of adding this delete link is that we are starting to pile up
the actions in a contact row:
#figure(
image("images/screenshot_stacked_actions.png"),
caption: [That’s a lot of actions],
placement: none,
)<fig-stacked-actions>
It would be nice if we didn’t show the actions all in a row, and, additionally,
it would be nice if we only showed the actions when the user indicated interest
in a given row. We will return to this problem after we look at the relationship
between scripting and a Hypermedia-Driven Application in a later chapter.
For now, let’s just tolerate this less-than-ideal user interface, knowing that
we will fix it later.]
==== Narrowing Our Target <_narrowing_our_target>
We can get even fancier here, however. What if, rather than re-rendering the
whole page, we just removed the row for the contact? The user is looking at the
row anyway, so is there really a need to re-render the whole page?
To do this, we’ll need to do a couple of things:
- We’ll need to update this link to target the row that it is in.
- We’ll need to change the swap to `outerHTML`, since we want to replace (really,
remove) the entire row.
- We’ll need to update the server side to render empty content when the
`DELETE` is issued from a "Delete" link rather than from the "Delete Contact"
button on the contact edit page.
First things first, update the target of our "Delete" link to be the row that
the link is in, rather than the entire body. We can once again take advantage of
the relative positional `closest` feature to target the closest `tr`, like we
did in our "Click To Load" and "Infinite Scroll" features:
#figure(caption: [The existing row actions],
```html
<td>
<a href="/contacts/{{ contact.id }}/edit">Edit</a>
<a href="/contacts/{{ contact.id }}">View</a>
<a href="#" hx-delete="/contacts/{{ contact.id }}"
hx-swap="outerHTML"
hx-confirm="Are you sure you want to delete this contact?"
hx-target="closest tr">Delete</a> <1>
</td>
```)
1. Updated to target the closest enclosing `tr` (table row) of the link.
==== Updating The Server Side <_updating_the_server_side>
Now we need to update the server side. We want to keep the "Delete Contact"
button working as well, and in that case the current logic is correct. So we’ll
need some way to differentiate between `DELETE`
requests that are triggered by the button and `DELETE` requests that come from
this anchor.
The cleanest way to do this is to add an `id` attribute to the "Delete Contact"
button, so that we can inspect the `HX-Trigger` HTTP Request header to determine
if the delete button was the cause of the request. This is a simple change to
the existing HTML:
#figure(caption: [Adding an `id` to the "delete contact" button],
```html
<button id="delete-btn" <1>
hx-delete="/contacts/{{ contact.id }}"
hx-push-url="true"
hx-confirm="Are you sure you want to delete this contact?"
hx-target="body">
Delete Contact
</button>
```)
1. An `id` attribute has been added to the button.
By giving this button an id attribute, we now have a mechanism for
differentiating between the delete button in the `edit.html` template and the
delete links in the `rows.html` template. When this button issues a request, it
will look something like this:
#figure[```http
DELETE http://example.org/contacts/42 HTTP/1.1
Accept: text/html,*/*
Host: example.org
...
HX-Trigger: delete-btn
...
```]
You can see that the request now includes the `id` of the button. This allows us
to write code very similar to what we did for the active search pattern, using a
conditional on the `HX-Trigger` header to determine what we want to do. If that
header has the value `delete-btn`, then we know the request came from the button
on the edit page, and we can do what we are currently doing: delete the contact
and redirect to
`/contacts` page.
If it _does not_ have that value, then we can simply delete the contact and
return an empty string. This empty string will replace the target, in this case
the row for the given contact, thereby removing the row from the UI.
Let’s refactor our server-side code to do this:
#figure(caption: [Updating our server code to handle two different delete) patterns],
```python
@app.route("/contacts/<contact_id>", methods=["DELETE"])
def contacts_delete(contact_id=0):
contact = Contact.find(contact_id)
contact.delete()
if request.headers.get('HX-Trigger') == 'delete-btn': <1>
flash("Deleted Contact!")
return redirect("/contacts", 303)
else:
return "" <2>
```)
1. If the delete button on the edit page submitted this request, then continue to
do the previous logic.
2. If not, simply return an empty string, which will delete the row.
And that’s our server-side implementation: when a user clicks "Delete" on a
contact row and confirms the delete, the row will disappear from the UI. Once
again, we have a situation where just changing a few lines of simple code gives
us a dramatically different behavior. Hypermedia is powerful in this manner.
==== The Htmx Swapping Model <_the_htmx_swapping_model>
#index[htmx][swap model]
This is pretty cool, but there is another improvement we can make if we take
some time to understand the htmx content swapping model: it would be nice if,
rather than just instantly deleting the row, we faded it out before we removed
it. The fade would make it clear that the row is being removed, giving the user
some nice visual feedback on the deletion.
It turns out we can do this pretty easily with htmx, but to do so we’ll need to
dig in to exactly how htmx swaps content.
You might think that htmx simply puts the new content into the DOM, but that’s
not in fact how it works. Instead, content goes through a series of steps as it
is added to the DOM:
- When content is received and about to be swapped into the DOM, the
`htmx-swapping` CSS class is added to the target element.
- A small delay then occurs (we will discuss why this delay exists in a moment).
- Next, the `htmx-swapping` class is removed from the target and the
`htmx-settling` class is added.
- The new content is swapped into the DOM.
- Another small delay occurs.
- Finally, the `htmx-settling` class is removed from the target.
There is more to the swap mechanic (settling, for example, is a more advanced
topic that we will discuss in a later chapter) but this is enough for now.
Now, there are small delays in the process here, typically on the order of a few
milliseconds. Why so? It turns out that these small delays allow _CSS transitions_ to
occur.
#sidebar[CSS Transitions][
#indexed[CSS transitions] are a technology that allow you to animate a
transition from one style to another. So, for example, if you changed the height
of something from 10 pixels to 20 pixels, by using a CSS transition you can make
the element smoothly animate to the new height. These sorts of animations are
fun, often increase application usability, and are a great mechanism to add
polish to your web application.
]
Unfortunately, CSS transitions are difficult to access in plain HTML: you
usually have to use JavaScript and add or remove classes to get them to trigger.
This is why the htmx swap model is more complicated than you might initially
think. By swapping in classes and adding small delays, you can access CSS
transitions purely within HTML, without needing to write any JavaScript!
==== Taking Advantage of "htmx-swapping" <_taking_advantage_of_htmx_swapping>
OK, so, let’s go back and look at our inline delete mechanic: we click an
htmx-enhanced link which deletes the contact and then swaps some empty content
in for the row. We know that before the `tr` element is removed, it will have
the `htmx-swapping` class added to it. We can take advantage of that to write a
CSS transition that fades the opacity of the row to 0. Here is what that CSS
looks like:
#figure(caption: [Adding a fade out transition],
```css
tr.htmx-swapping { <1>
opacity: 0; <2>
transition: opacity 1s ease-out; <3>
}
```)
1. We want this style to apply to `tr` elements with the `htmx-swapping`
class on them.
2. The `opacity` will be 0, making it invisible.
3. The `opacity` will transition to 0 over a 1 second time period, using the `ease-out` function.
Again, this is not a CSS book and we are not going to go deeply into the details
of CSS transitions, but hopefully the above makes sense to you, even if this is
the first time you’ve seen CSS transitions.
So, think about what this means from the htmx swapping model: when htmx gets
content back to swap into the row it will put the `htmx-swapping`
class on the row and wait a bit. This will allow the transition to a zero
opacity to occur, fading the row out. Then the new (empty) content will be
swapped in, which will effectively remove the row.
Sounds good, and we are nearly there. There is one more thing we need to do: the
default "swap delay" for htmx is very short, a few milliseconds. That makes
sense in most cases: you don’t want to have much of a delay before you put the
new content into the DOM. But, in this case, we want to give the CSS animation
time to complete before we do the swap, we want to give it a second, in fact.
#index[hx-swap][delay]
Fortunately htmx has an option for the `hx-swap` annotation that allows you to
set the swap delay: following the swap type you can add `swap:`
followed by a timing value to tell htmx to wait a specific amount of time before
it swaps. Let’s update our HTML to allow a one second delay before the swap is
done for the delete action:
#figure(caption: [The existing row actions],
```html
<td>
<a href="/contacts/{{ contact.id }}/edit">Edit</a>
<a href="/contacts/{{ contact.id }}">View</a>
<a href="#" hx-delete="/contacts/{{ contact.id }}"
hx-swap="outerHTML swap:1s" <1>
hx-confirm="Are you sure you want to delete this contact?"
hx-target="closest tr">Delete</a>
</td>
```)
1. A swap delay changes how long htmx waits before it swaps in new content.
With this modification, the existing row will stay in the DOM for an additional
second, with the `htmx-swapping` class on it. This will give the row time to
transition to an opacity of zero, giving the fade out effect we want.
Now, when a user clicks on a "Delete" link and confirms the delete, the row will
slowly fade out and then, once it has faded to a 0 opacity, it will be removed.
Pretty fancy, and all done in a declarative, hypermedia-oriented manner, no
JavaScript required. (Well, obviously htmx is written in JavaScript, but you
know what we mean: we didn’t have to write any JavaScript to implement the
feature.)
=== Bulk Delete <_bulk_delete>
#index[htmx patterns][bulk delete]
The final feature we are going to implement in this chapter is a "Bulk Delete."
The current mechanism for deleting users is nice, but it would be annoying if a
user wanted to delete five or ten contacts at a time, wouldn’t it? For the bulk
delete feature, we want to add the ability to select rows via a checkbox input
and delete them all in a single go by clicking a "Delete Selected Contacts"
button.
To get started with this feature, we’ll need to add a checkbox input to each row
in the `rows.html` template. This input will have the name
`selected_contact_ids` and its value will be the `id` of the contact for the
current row.
Here is what the updated code for `rows.html` looks like:
#figure(caption: [Adding a checkbox to each row],
```html
{% for contact in contacts %}
<tr>
<td><input type="checkbox" name="selected_contact_ids"
value="{{ contact.id }}"></td> <1>
<td>{{ contact.first }}</td>
... omitted
</tr>
{% endfor %}
```)
1. A new cell with the checkbox input whose value is set to the current contact’s
id.
We’ll also need to add an empty column in the header for the table to
accommodate the checkbox column. With that done we now get a series of check
boxes, one for each row, a pattern no doubt familiar to you from the web (@fig-checkboxes).
#figure(image("images/screenshot_checkboxes.png"), caption: [
Checkboxes for our contact rows
])<fig-checkboxes>
If you are not familiar with or have forgotten the way checkboxes work in HTML:
a checkbox will submit its value associated with the name of the input if and
only if it is checked. So if, for example, you checked the contacts with the ids
3, 7 and 9, then those three values would all be submitted to the server. Since
all the checkboxes in this case have the same name, `selected_contact_ids`, all
three values would be submitted with the name `selected_contact_ids`.
==== The "Delete Selected Contacts" Button <_the_delete_selected_contacts_button>
The next step is to add a button below the table that will delete all the
selected contacts. We want this button, like our delete links in each row, to
issue an HTTP `DELETE`, but rather than issuing it to the URL for a given
contact, like we do with the inline delete links and with the delete button on
the edit page, here we want to issue the
`DELETE` to the `/contacts` URL.
As with the other delete elements, we want to confirm that the user wishes to
delete the contacts, and, for this case, we are going to target the body of
page, since we are going to re-render the whole table.
Here is what the button code looks like:
#figure(caption: [The "delete selected contacts" button],
```html
<button
hx-delete="/contacts" <1>
hx-confirm="Are you sure you want to delete these contacts?" <2>
hx-target="body"> <3>
Delete Selected Contacts
</button>
```)
1. Issue a `DELETE` to `/contacts`.
2. Confirm that the user wants to delete the selected contacts.
3. Target the body.
Pretty easy. One question though: how are we going to include the values of all
the selected checkboxes in the request? As it stands right now, this is just a
stand-alone button, and it doesn’t have any information indicating that it
should include any other information in the `DELETE`
request it makes.
#index[input values]
Fortunately, htmx has a few different ways to include values of inputs with a
request.
One way would be to use the `hx-include` attribute, which allows you to use a
CSS selector to specify the elements you want to include in the request. That
would work fine here, but we are going to use another approach that is a bit
simpler in this case.
#index[forms]
By default, if an element is a child of a `form` element and makes a non-`GET` request,
htmx will include all the values of inputs within that form. In situations like
this, where there is a bulk operation for a table, it is common to enclose the
whole table in a form tag, so that it is easy to add buttons that operate on the
selected items.
Let’s add that form tag around the table, and be sure to enclose the button in
it as well:
#figure(caption: [The "delete selected contacts" button],
```html
<form> <1>
<table>
... omitted
</table>
<button
hx-delete="/contacts"
hx-confirm="Are you sure you want to delete these contacts?"
hx-target="body">
Delete Selected Contacts
</button>
</form> <2>
```)
1. The form tag encloses the entire table.
2. The form tag also encloses the button.
Now, when the button issues a `DELETE`, it will include all the contact ids that
have been selected as the `selected_contact_ids` request variable.
==== The Server Side for Delete Selected Contacts <_the_server_side_for_delete_selected_contacts>
The server-side implementation is going to look like our original server-side
code for deleting a contact. In fact, once again, we can just copy and paste,
and make a few fixes:
- We want to change the URL to `/contacts`.
- We want the handler to get _all_ the ids submitted as
`selected_contact_ids` and iterate over each one, deleting the given contact.
Those are the only changes we need to make! Here is what the server-side code
looks like:
#figure(caption: [The "delete selected contacts" button],
```python
@app.route("/contacts/", methods=["DELETE"]) <1>
def contacts_delete_all():
contact_ids = [
int(id)
for id in request.form.getlist("selected_contact_ids")
] <2>
for contact_id in contact_ids: <3>
contact = Contact.find(contact_id)
contact.delete() <4>
flash("Deleted Contacts!") <5>
contacts_set = Contact.all()
return render_template("index.html", contacts=contacts_set)
```)
1. We handle a `DELETE` request to the `/contacts/` path.
2. Convert the `selected_contact_ids` values submitted to the server from a list of
strings to a list integers.
3. Iterate over all of the ids.
4. Delete the given contact with each id.
5. Beyond that, it’s the same code as our original delete handler: flash a message
and render the `index.html` template.
So, we took the original delete logic and slightly modified it to deal with an
array of ids, rather than a single id.
You might notice one other small change: we did away with the redirect that was
in the original delete code. We did so because we are already on the page we
want to re-render, so there is no reason to redirect and have the URL update to
something new. We can just re-render the page, and the new list of contacts
(sans the contacts that were deleted) will be re-rendered.
And there we go, we now have a bulk delete feature for our application. Once
again, not a huge amount of code, and we are implementing these features
entirely by exchanging hypermedia with a server in the traditional, RESTful
manner of the web.
#html-note[Accessible by Default?][
#index[ARIA]
#index[accessibility]
Accessibility problems can arise when we try to implement controls that aren’t
built into HTML.
Earlier, in Chapter One, we looked at the example of a \<div\> improvised to
work like a button. Let’s look at a different example: what if you make
something that looks like a set of tabs, but you use radio buttons and CSS hacks
to build it? It’s a neat hack that makes the rounds in web development
communities from time to time.
The problem here is that tabs have requirements beyond clicking to change
content. Your improvised tabs may be missing features that will lead to user
confusion and frustration, as well as some undesirable behaviors. From the
#link(
"https://www.w3.org/WAI/ARIA/apg/patterns/tabs/",
)[ARIA Authoring Practices Guide on tabs]:
- Keyboard interaction
- Can the tabs be focused with the Tab key?
- ARIA roles, states, and properties
- "\[The element that contains the tabs\] has role `tablist`."
- "Each \[tab\] has role `tab` \[…\]"
- "Each element that contains the content panel for a `tab` has role
`tabpanel`."
- "Each \[tab\] has the property `aria-controls` referring to its associated
tabpanel element."
- "The active `tab` element has the state `aria-selected` set to
`true` and all other `tab` elements have it set to `false`."
- "Each element with role `tabpanel` has the property
`aria-labelledby` referring to its associated `tab` element."
You would need to write a lot of code to make your improvised tabs fulfill all
of these requirements. Some of the ARIA attributes can be added directly in
HTML, but they are repetitive and others (like
`aria-selected`) need to be set through JavaScript since they are dynamic. The
keyboard interactions can be error-prone too.
It’s not impossible, not even that hard, to make your own tab set
implementation. However, it’s difficult to trust that a new implementation will
work for all users in all environments, since most of us have limited resources
for testing.
_Stick with established libraries_ for UI interactions. If a use case requires a
bespoke solution, _test exhaustively_ for keyboard interaction and
accessibility. Test manually. Test automatically. Test with screen readers, test
with a keyboard, test on different browsers and hardware, and run linters (while
coding and/or in CI). Testing is critical to ensure machine readability, or
human readability, or page weight.
#index[HTML][\<details\>]
Also consider: Does the information need to be presented as tabs? Sometimes the
answer is yes, but if not, a sequence of details and disclosures fulfills a very
similar purpose.
#figure(```html
<details><summary>Disclosure 1</summary>
Disclosure 1 contents
</details>
<details><summary>Disclosure 2</summary>
Disclosure 2 contents
</details>
```)
Compromising UX just to avoid JavaScript is bad development. But sometimes it’s
possible to achieve an equal (or better!) quality of UX while allowing for a
simpler and more robust implementation by changing the design.
]
|
https://github.com/lxl66566/my-college-files | https://raw.githubusercontent.com/lxl66566/my-college-files/main/信息科学与工程学院/互联网原理与技术/作业/实践3/main.typ | typst | The Unlicense | #import "../template.typ": *
#show: project.with(
title: "实践 3:Wireshark实验——TCP",
authors: (
"absolutex",
)
)
= 内容
捕获从计算机到远程服务器的批量 TCP 传输。访问一个网页,考察该访问过程中的TCP传输过程。
== 客户端计算机(源)使用的 IP 地址和 TCP 端口号是什么?服务器IP 地址是什么? 在哪个端口号上发送和接收此连接的 TCP 段?
#figure(
image("20231109-09.33.png", width: 100%),
)
客户端IP:192.168.1.106,TCP端口号:57998
服务端IP:192.168.3.11,TCP端口号:443
== 启动 TCP 连接的 TCP SYN 段的序列号是什么?
#figure(
image("20231109-09.43.png", width: 100%),
)
949402233
== 发送给客户端计算机以回复 SYN 的 SYNACK 段的序号、ack号分别是多少? SYNACK 段中的 Acknowledgment 的值是多少?
#figure(
image("20231109-09.48.png", width: 100%),
)
#figure(
image("20231109-1425.png", width: 100%),
caption: [补图]
)
SYNACK 段的序号:1
ack号:1
SYNACK 段中的 Acknowledgment 的值是 1
== 包含 HTTP POST 命令的 TCP 段的序号是多少?
#figure(
image("20231109-09.55.png", width: 100%),
)
不包含 HTTP POST 命令。
== 估算RTT是多少?
#figure(
image("20231109-10.00.png", width: 100%),
)
首个客户端分组时间戳:2.152433166
#figure(
image("20231109-10.01.png", width: 100%),
)
首个服务端分组时间戳:2.159949756
$$RTT = (2.159949756 - 2.152433166) / 2 = 0.00752 s$$ |
https://github.com/typst/packages | https://raw.githubusercontent.com/typst/packages/main/packages/preview/unichar/0.1.0/ucd/block-1D2C0.typ | typst | Apache License 2.0 | #let data = (
("KAKTOVIK NUMERAL ZERO", "No", 0),
("KAKTOVIK NUMERAL ONE", "No", 0),
("KAKTOVIK NUMERAL TWO", "No", 0),
("KAKTOVIK NUMERAL THREE", "No", 0),
("KAKTOVIK NUMERAL FOUR", "No", 0),
("KAKTOVIK NUMERAL FIVE", "No", 0),
("KAKTOVIK NUMERAL SIX", "No", 0),
("KAKTOVIK NUMERAL SEVEN", "No", 0),
("KAKTOVIK NUMERAL EIGHT", "No", 0),
("KAKTOVIK NUMERAL NINE", "No", 0),
("KAKTOVIK NUMERAL TEN", "No", 0),
("KAKTOVIK NUMERAL ELEVEN", "No", 0),
("KAKTOVIK NUMERAL TWELVE", "No", 0),
("KAKTOVIK NUMERAL THIRTEEN", "No", 0),
("KAKTOVIK NUMERAL FOURTEEN", "No", 0),
("KAKTOVIK NUMERAL FIFTEEN", "No", 0),
("KAKTOVIK NUMERAL SIXTEEN", "No", 0),
("KAKTOVIK NUMERAL SEVENTEEN", "No", 0),
("KAKTOVIK NUMERAL EIGHTEEN", "No", 0),
("KAKTOVIK NUMERAL NINETEEN", "No", 0),
)
|
https://github.com/piepert/philodidaktik-hro-phf-ifp | https://raw.githubusercontent.com/piepert/philodidaktik-hro-phf-ifp/main/src/parts/ephid/beurteilen_bewerten/anforderung_bewertung.typ | typst | Other | #import "/src/template.typ": *
== Anforderung an Leistungsbewertung
In der Didaktik des Philosophieunterrichts werden drei Anforderungen an Leistungsauswertungen herausgestellt: Leistungsbewertungen müssen #ix("valide", "Validität"), #ix("reliabel", "Reliabilität") und #ix("intersubjektiv", "Intersubjektivität") sein.#en[Vgl. @Klager2021_Bewertung[S. 5]]
#let colg = 1em
#grid(columns: (33.33%-(colg/2),)*3,
column-gutter: colg,
row-gutter: 1em,
strong[#ix("Validität")],
strong[#ix("Reliabilität")],
strong[#ix("Intersubjektivität")],
[
Geprüft werden sollen hauptsächlich #ix("Kompetenzen", "Kompetenz"), die an bestimmten Kriterien festgemacht werden. Dinge, die nicht zum Fachunterricht gehören, sollen nicht Teil von Prüfungen des Faches sein.#en[Die #ix("Validität") ist ebenfalls unter dem Begriff der #ix("Gültigkeit bekannt"). Siehe dazu @SchmidtRuthendorf2017_PhilosophierenMessen]
], [
Die Situation, in der die Leistung erfasst wird, soll angemessen sein.
- situative Rahmenbedingungen
- soziale Rahmenbedingungen
- klare Aufgabenstellungen
- Vermeiden von "Messfehlern"
], [
Das Ergebnis sollte unabhängig der Prüfenden sein. Mögliche Fehlerquellen sind:
- Halo-Effekt, Sympathie, Geschlecht, soziale Erwünschtheit
- Vorurteile und subjektive Theorien
- Projektion
- Vor- und Zusatzinformationen, Pygmalioneffekt
- Reihungs- und Kontrasteffekte
- Tendenzfehler und Extremwertvermeidung
- Rechenfehler
])
#task(key: "intersubjektivität")[Intersubjektivität][
Wählen und erläutern Sie eine Fehlerquelle der Intersubjektivität in Leistungsbewertungen an einem Beispiel!
][
Intersubjektivität in der Leistungsbewertung beschreibt das Kriterium, dass die Bewertung unabhängig der Prüfenden sein sollte. Rechenfehler beim Summieren nach der Punktevergabe sind Fehler, die bei unterschiedlichen Lehrkräften unterschiedlich auftreten können. Werden dieselben Tests von SuS von unterschiedlichen Prüfenden bewertet, so kann, selbst wenn sie komplett gleich bewerten würden, beim Aufsummieren der Punkte unterschiedliche Noten entstehen. Dies macht das Ergebnis der Prüfung abhängig von den Prüfenden. Damit sind sie eine mögliche Fehlerquelle für fehlende Intersubjektivität.
]
#task[Leistungsbewertung von #ix("Gruppenarbeit")][
Erklären Sie an einem Beispiel, warum die Gruppenarbeit keine geeignete Sozialform für eine Leistungsbewertung ist!
][
An die Leistungsbewertung werden drei Anforderungen gestellt: sie muss valide, reliabel und intersubjektiv sein. Die Validität und Reliabilität sind in der Gruppenarbeit bemängelbar. Besonders bei Gruppenarbeiten sind soziale Faktoren, wie das Umfeld oder die Situation, in der die Schüler leben, das Ergebnis stark beeinflussen. Beurteilt werden soll jedoch die Kompetenz, nicht die Umstände.
Ein weiterer Punkt ist, dass die bewertete Leistung (im besten Fall) eine Aggregation der Einzelleistungen der SuS ist. Das Aufteilen in Einzelleistungen ist nicht möglich, da jedoch die SuS nur einzeln bewertet werden können (da sie jeder nur einzeln ein Zeugnis besitzen), ist auch aus dieser Perspektive die Gruppenarbeit keine geeignete Sozialform für eine Leistungsbewertung.
]
#task[Reliabilität von Bewertung][
Erläutern Sie die #ix("Reliabilität") von Bewertungen an zwei Beispielen des Philosophieunterrichts.
][
Angenommen eine mündliche Prüfung wird abgehalten und direkt außerhalb des Raumes ist durch Bauarbeiten eine starke Lärmbelästigung vorhanden. Die Geprüften wie auch die Prüfenden haben mit großen Konzentrationsproblemen kämpfen, was die Aufnahme- und Verarbeitungsfähigkeit und damit die erbrachte Leistung -- wahrscheinlich negativ -- beeinflusst.
Etwas anderes wäre ein schriftlicher Test, jedoch werden die Aufgabenstellungen vor dem Test mündlich angesagt. Durch Unaufmerksamkeit der SuS kommt es in einigen Fällen zur Übernahme falscher Aufgabenstellungen und damit Punktverlusten.
Diese Beispiele beziehen sich auf Situationen, in der eine Leistung erfasst wird. Diese muss der Leistung entpsrechend angemessen sein und die Grundlagen bieten, sodass die Geprüften nicht in der Erbringung ihrer Leistung behindert werden.
] |
https://github.com/jeffa5/typst-acm | https://raw.githubusercontent.com/jeffa5/typst-acm/main/manual.typ | typst | #import "lib.typ": *
#let author1 = (
name: "<NAME>",
institution: "University of Cambridge",
email: "<EMAIL>",
)
#let author2 = (
name: "Dummy",
institution: "Dummy Inst.",
email: "<EMAIL>",
)
#let conference = (
name: "Conference",
location: "Somewhere, Global",
date: "XXth XX 20XX",
)
#show: doc => sigplan(
title: "Sigplan papers",
authors: (author1, author2),
conference: conference,
abstract: lorem(100),
keywords: ("typst", "acm"),
bibliography-file: "refs.bib",
doc,
)
= Introduction
#lorem(500)
= Motivation
#lorem(100)
== Sub Motivation 1
#lorem(200)
== Sub Motivation 2
#lorem(300)
= Conclusion
#lorem(100)
|
|
https://github.com/OverflowCat/BUAA-Digital-Image-Processing-Sp2024 | https://raw.githubusercontent.com/OverflowCat/BUAA-Digital-Image-Processing-Sp2024/master/chap04/main.typ | typst | #set text(lang: "zh", cjk-latin-spacing: auto, font: "Noto Serif CJK SC")
#set page(numbering: "1", margin: (left: 1.4cm, right: 1.9cm))
#show figure.caption: set text(font: "Zhuque Fangsong (technical preview)")
#show "。": "."
#show heading: set text(font: "Noto Sans CJK SC", size: 1.15em)
#import "helper.typ": *
= 数字图像处理#h(1em)第4章#h(1em)频率域滤波#h(1em)作业
#v(1em)
#Q[完成由式(4.3-11)和式(4.3-12)给出的步骤。(教材P192页,第4.6题。)]
#let PIT = $display(pi dot.c (t - n Delta T) / (Delta T))$
$
f(t)
&= IFT {F(mu)}
= IFT {H(mu) tilde(F)(mu)}
= h(t) CONV overline(f)(t)\
&= INTOO h(z) tilde(f)(t - z) dif z\
&= INTOO (sin(pi z / Delta T))/((pi z / Delta T)) SUMOO f(t - z) delta(t - n Delta T - z) dif z\
&= SUMOO INTOO (sin(pi z / Delta T))/((pi z / Delta T)) f(t - z) delta(t - n Delta T - z) dif z\
&= SUMOO f(n Delta T) (sin(PIT))/(PIT)\
&= SUMOO f(n Delta T) sinc((t - n Delta T) / (Delta T)).
$
#Q[写出二维连续卷积的表达式(教材P192页,第4.11题。)]
$ f(t, z) CONV h(t, z) = INTOO INTOO f(alpha, beta) h(t - alpha, z - beta) dif alpha dif beta. $
#include "3.typ"
#Q[由4.5.4节中的讨论可知,收缩一幅图像会导致混淆现象。放大一幅图像也会导致混淆现象吗?请解释。(教材P192页,第4.13题。)]
缩小图像时可能会导致混叠是因为采样率降低。放大操作引入了更多的样本,所以不会导致混叠。
#Q[4.6.6节中在讨论频率域滤波时需要对图像进行填充。在该节中给出的图像填充方法是,在图像中行和列的末尾填充0值(见左图)。如果我们把图像放在中心,四周填充0值(见右图而不改变所用0值的总数,会有区别吗?试解释原因。(教材P193页,第4.21题。)]
DFT 是周期延拓的,填充零值相当于多个周期的图像间插入空区域,减少相互干扰。无论是在图像末尾还是周围填充,只要其数量相同,效果就等同。填充后的图像就像棋盘,原始图像或位于方格中心或占据整个方格,但每个方格内容相同,数学上等价。两种填充方式都能有效防止 DFT 周期性延拓,可根据实际需要选择,通常在图像末尾填充零更方便。
#include "6.typ"
#Q[
一种成熟的医学技术被用于检测电子显微镜生成的某类图像。为简化检测任务,技术人员决定采用数字图像增强技术,并在处理结束后,检查了一组具有代表性的图像,发现了如下问题:
+ 明亮且孤立的点是不感兴趣的点;
+ 清晰度不够;
+ 一些图像的对比度不够;
+ 平均灰度值已被改变,而正确地执行某种灰度度量的这个值应是 $V$。
技术人员想要纠正这些问题,然后将 $I_1$ 和 $I_2$ 波段之间的所有灰度显示为白色,同时保持其余灰度的正常色调。请为技术人员提出达到期望目的的处理步骤。可以使用第3章和第4章的技术。(教材P195页,第4.43题。)
]
+ 进行中值滤波;
+ 利用高斯高通滤波器进行高频强调;
+ 将 $I_1$ 和 $I_2$ 波段之间的所有像素的灰度级设为最高。
|
|
https://github.com/34j/latex-typst-compile-and-release-reusable-workflow | https://raw.githubusercontent.com/34j/latex-typst-compile-and-release-reusable-workflow/main/README.md | markdown | # Reusable GitHub Actions Workflow for Building LaTeX/Typst Document and Creating Release
## Features
- Support both LaTeX ([LaTeXmk][latexmk] or [Cluttex][cluttex]) and [Typst][typst]
- Install custom fonts from [Google Fonts][google-fonts]
- Comment the link to the Compiled PDF file in the Pull Request
- Automatically create a release with the compiled PDF file attached
## Usage
1. Set `Settings/Actions/General/Workflow Permissions` to `Read and write permissions`
2. `.github/workflows/release.yaml`
```yaml
name: Build LaTeX/Typst document and Create Release
on:
push:
branches:
- main
pull_request:
jobs:
release:
uses: 34j/latex-typst-compile-and-release-reusable-workflow/.github/workflows/release.yaml@main
secrets:
gh_pat: ${{ secrets.GITHUB_TOKEN }}
```
## Advanced Usage
```yaml
name: Build LaTeX/Typst document and Create Release
on:
push:
branches:
- main
pull_request:
jobs:
release:
uses: 34j/latex-typst-compile-and-release-reusable-workflow/.github/workflows/release.yaml@main
with:
cluttex_parallel: true
cluttex: false
latexmk: false
typst: true
upload_artifact: true
upload_release: true
fonts: '"Roboto" "Noto Sans" "Noto Serif"' # Google Fonts
secrets:
gh_pat: ${{ secrets.GITHUB_TOKEN }}
```
[latexmk]: https://ctan.org/pkg/latexmk
[cluttex]: https://ctan.org/pkg/cluttex
[typst]: https://github.com/typst/typst
[google-fonts]: https://fonts.google.com/
|
|
https://github.com/jgm/typst-hs | https://raw.githubusercontent.com/jgm/typst-hs/main/test/typ/compiler/methods-03.typ | typst | Other | // Error: 2:2-2:15 type array has no method `fun`
#let numbers = ()
#numbers.fun()
|
https://github.com/Enter-tainer/zint-wasi | https://raw.githubusercontent.com/Enter-tainer/zint-wasi/master/xtask/README.md | markdown | MIT License | # tiaoma xtask
[xtask](https://github.com/matklad/cargo-xtask) is an extension to `cargo build` that's made specifically to make building
this plugin and testing it simpler.
xtask commands are executed through cargo:
```lua
cargo xtask <COMMAND> [ARGS...]
```
## Commands
- `package-plugin`: builds the tiaoma wasm plugin
- `--debug`: creates a debug build of the plugin
- `build-manual`: compiles the manual
- `package`: packages all requirements needed for publishing
Command arguments are transitive, which means that running
`cargo xtask package --debug` will pass that flag to all task that `package`
depends on (i.e. `package-plugin`).
There are some other internal commands (like `ci`), but they're not meant to be
run as part of the normal development process, but instead under very specific
conditions. Don't rely on them being present, consistent or free of
side-effects.
## State options
xtask can be configured with various state variables. These are stored in
[`xtask/state`](./state) and can be overriden with environment variables
prefixed with `XTASK_` (`XTASK_<OPTION>`).
- Versions (to download):
- `WASI_SDK_VERSION`: WASI SDK version used to compile the package
- `BINARYEN_VERSION`: binaryen version used for `wasm-opt`
- `TYPST_VERSION`: typst version used to compile the manual
- Paths:
- `WORK_DIR`: path to the output directory
- `TYPST_PKG`: path to the typst package directory
- `WASM_MIN_PROTOCOL_DIR`: path to `wasm-minimal-protocol` project used to compile `wasi-stub`
A bunch of other, unlisted, variables are also defined/used, but they're
constants related to project structure for the most part and changing them will
break things.
The `xtask/state` is expected to be part of the source tree in VCS, this allows
xtask to keep track of changes to state that become visible only during builds
(e.g. file hashes).
|
https://github.com/fabriceHategekimana/master | https://raw.githubusercontent.com/fabriceHategekimana/master/main/2_Etat_de_l_art/Système_F.typ | typst | #pagebreak()
#import "@preview/simplebnf:0.1.0": *
#import "../src/module.typ" : *
=== Le système F
Si le lambda calcul simplement typé apporte la notion de type au lambda calcul. Le système F apporte la notion de Générique sur ces types. Comme discuté dans le le lambda calcul simplement typé, la notion de type restreint fortement les opérations faisable sur les types. On le sait, on aura aussi parfois besoin d'avoir des fonctions plus générales pour la manipulation de type.
Le système F, également connu sous le nom de polymorphisme de deuxième ordre, est une extension du lambda-calcul typé qui permet l'utilisation de types génériques. Il introduit la quantification universelle sur les types, ce qui permet de définir des fonctions et des structures de données polymorphes. Par exemple, une fonction dans le système F peut être définie pour opérer sur des tableaux de n'importe quel type sans avoir à redéfinir la fonction pour chaque type de tableau.
#Definition[Syntaxe du système F
$ #bnf(
Prod(
$t$,
annot: $sans("terms:")$,
{
Or[$x$][_variable_]
Or[$λ x:T.t$][_abstraction_]
Or[$t$ $t$][_application_]
Or[$λ X. t$][_type abstraction_]
Or[$t$ $[T]$][_application_]
},
),
Prod(
$v$,
annot: $sans("values:")$,
{
Or[$λ x:T.t$][_abstraction value_]
Or[$λ X. t$][_type abstraction value_]
},
),
Prod(
$T$,
annot: $sans("types:")$,
{
Or[$X$][_type variable_]
Or[$T -> T$][_type of functions_]
Or[$forall X.T$][_universal type_]
},
),
Prod(
$Gamma$,
annot: $sans("context:")$,
{
Or[$X$][_empty context_]
Or[$Gamma, "x:T"$][_term variable binding_]
Or[$Gamma, X$][_type variable binding_]
},
),
) $
]
#Definition[Évaluation du système F
$ #proof-tree(eval("E-APP1", $t_1 t_2 --> t_1p t_2$, $t_1 --> t_1p$)) $
$ #proof-tree(eval("E-APP2", $v_1 t_2 --> v_1 t_2p$, $t_2 --> t_2p$)) $
$ #proof-tree(eval("E-APPABS", $(lambda x . t_12) v_2 --> [x\/v_2] t_12$)) $
$ #proof-tree(eval("E-TAPP", $t_1 [T_2] --> t_1p [T_2]$, $t_1 --> t_1p$)) $
$ #proof-tree(eval("E-TAPPTABS", $(lambda X . t_12) [T_2] --> [X \/ T_2] t_12$)) $
]
#Definition[Typage du système F
$ #proof-tree(typing_c("T-VAR", "x : T", $ x:T in Gamma$)) $
$ #proof-tree((typing_c("T-ABS", $lambda x:T_1 . t_2 : T_1 -> T_2$))) $
$ #proof-tree(typing_c("T-APP", $t_1 t_2 : T_12 $, $Gamma tack.r : T_11 -> T_12$, $Gamma tack.r t_2 : T_11$)) $
$ #proof-tree(typing_c("T-TABS", $lambda X . t_2 : forall X . T_2$, $Gamma, X tack.r t_2 : T_2$)) $
$ #proof-tree(typing_c("T-TAPP", $t_1 [T_2] : [X\/T_2] T_12$)) $
]
L'ajout de génériques dans le typage est un avantage considérable car il accroît la réutilisabilité et la flexibilité du code tout en maintenant une forte sécurité des types. Cela permet aux développeurs de créer des bibliothèques et des outils plus abstraits et polyvalents, réduisant ainsi le besoin de redondance et minimisant les erreurs. En conséquence, le système F et les types génériques favorisent une programmation plus expressive et plus sûre, où les invariants de type sont vérifiés à la compilation, garantissant une robustesse accrue des applications.
L'ajout de générique est aussi un élément crucial pour la définition de généricité pour des tableaux de taille différente. Nous verrons dans la suite comment ajouter cette notion.
|
|
https://github.com/a-mhamdi/graduation-report | https://raw.githubusercontent.com/a-mhamdi/graduation-report/main/Typst/en-Report/Title-page.typ | typst | MIT License | #let titlepage(
title: "",
titre: "",
diploma: "",
program: "",
supervisor: "",
author: "",
date: none,
) = {
set page(
header: none,
margin: (left: 30mm, right: 30mm, top: 40mm, bottom: 40mm),
numbering: none,
number-align: center,
)
let body-font = "Garamond"
let sans-font = "Garamond"
set text(
font: body-font,
size: 12pt,
lang: "en"
)
set par(leading: 1em)
// --- Title Page ---
v(15mm)
align(center, text(font: sans-font, 1.25em, weight: 100, "Ministry of Higher Education and Scientific Research, Tunisia"))
v(10mm)
align(center, text(font: sans-font, 1.25em, weight: 100, "Institute of Technological Studies of Bizerte"))
v(5mm)
align(center, image("Logo-ISETBZ.png", width: 25%))
v(15mm)
align(center, text(font: sans-font, 1.3em, weight: 100, diploma + " in " + program))
v(8mm)
align(center, text(font: sans-font, 2em, weight: 700, title))
pad(
top: 3em,
right: 15%,
left: 15%,
grid(
columns: 2,
gutter: 1em,
strong("Author: "), author,
strong("Supervisor: "), supervisor,
strong("Date: "), date,
)
)
pagebreak()
}
|
https://github.com/Myriad-Dreamin/typst.ts | https://raw.githubusercontent.com/Myriad-Dreamin/typst.ts/main/fuzzers/corpora/math/attach-p1_02.typ | typst | Apache License 2.0 |
#import "/contrib/templates/std-tests/preset.typ": *
#show: test-page
// A mixture of attachment positioning schemes.
$
attach(a, tl: u), attach(a, tr: v), attach(a, bl: x),
attach(a, br: y), limits(a)^t, limits(a)_b \
attach(a, tr: v, t: t),
attach(a, tr: v, br: y),
attach(a, br: y, b: b),
attach(limits(a), b: b, bl: x),
attach(a, tl: u, bl: x),
attach(limits(a), t: t, tl: u) \
attach(a, tl: u, tr: v),
attach(limits(a), t: t, br: y),
attach(limits(a), b: b, tr: v),
attach(a, bl: x, br: y),
attach(limits(a), b: b, tl: u),
attach(limits(a), t: t, bl: u),
limits(a)^t_b \
attach(a, tl: u, tr: v, bl: x, br: y),
attach(limits(a), t: t, bl: x, br: y, b: b),
attach(limits(a), t: t, tl: u, tr: v, b: b),
attach(limits(a), tl: u, bl: x, t: t, b: b),
attach(limits(a), t: t, b: b, tr: v, br: y),
attach(a, tl: u, t: t, tr: v, bl: x, b: b, br: y)
$
|
https://github.com/polarkac/MTG-Stories | https://raw.githubusercontent.com/polarkac/MTG-Stories/master/stories/054%20-%20Lost%20Caverns%20of%20Ixalan/006_Episode%206.typ | typst | #import "@local/mtgstory:0.2.0": conf
#show: doc => conf(
"Episode 6",
set_name: "Lost Caverns of Ixalan",
story_date: datetime(day: 20, month: 10, year: 2023),
author: "<NAME>",
doc
)
== Huatli
#emph[Inti is dead.]
The battle raged in the sky, Sun Empire and Oltec warriors chasing the twisted Dusk Legion soldiers through the roiling detritus of the cosmium reef. On the ground, Huatli cradled the broken body of her cousin, kneeling in the blood-spattered soil of a land far from home.
She had failed to protect him. Death was a warrior's constant companion, but no one eagerly fell into her embrace. What would she tell her family? Every word of comfort she had ever offered to the loved ones of a lost comrade turned to sand in her mouth.
A gust of wind and the flapping of wings signaled the arrival of her enemy. Vito carried the same lance he had wielded when she met him in the River Herald's underground city, but his form was corrupted, a vile combination of man and bat.
"Aclazotz will be pleased when I deliver you to him," Vito said, his voice rougher, fangs longer. "His victory is at hand."
Huatli stood, readying her sword and razor-edged shield. #emph[Tilonalli, smite my enemies] , she prayed silently.
Vito circled her, his lance aimed at Huatli's heart. "When we return to Torrezon, I will be made a saint. I will bring my people the pure gospel of blood, unsullied by our weak queen and the false Saint Elenda. The faithful shall reform to accept the true rites of Aclazotz or be purged."
That knowledge would please Caparocti, if he still lived; it would be easier to invade Torrezon if the vampires were already killing each other. In this moment, however, Huatli hardly cared.
Vito thrust. Huatli knocked the point of his lance downward as she sidestepped. He struck again and again, while she danced out of his reach.
"Together, Vona and I will rule at our master's side," he continued. "We will dwell in his house for eternity, while the faithful who served him in his confinement will rule here. An alliance of blood and power."
Would he never cease talking? Huatli watched for an opening. She needed to turn this fight to her favor.
"I should let you live," Vito said, baring his teeth. "Who better to make my words canon than the poet of my fallen enemy? Who better to carry the tale of my victory to the empire that will soon be nothing but a memory?"
Huatli extended her senses, reaching out with her magic to the land around her, searching. Calling. Hearing her call answered.
"Where are your fine speeches, Warrior-Poet?" Vito taunted. "Has the return of Aclazotz stopped your tongue? Or was it the death of your precious seneschal?"
Huatli fell to one knee, stretching her magic until she felt like a paper-thin layer of rubber. The sounds around her faded. She called to the mountains and forests, the fields and valleys. More voices replied, until her head swam with the effort of containing them all.
"You wish to throw yourself at my mercy?" Vito asked. He struck again, the point of his lance sliding off the armor of her upper arm. The pain galvanized her will.
Huatli stood, swaying under the onslaught of the multitudes she summoned. Vito aimed to trip her, but she danced backward, years of training making her nimble despite the magic splitting her focus.
Vito leaped into the air, using the height and distance to his advantage. Huatli couldn't reach him, couldn't hit him, could only continue to push his blows aside with her shield. Already her muscles ached from exertion. Soon, she would tire. Soon, she would fall.
Not yet. Not until Inti was avenged. The ground trembled beneath her boots.
"Abandon your foolish hopes," Vito said, hovering above her like a grim shadow. "Aclazotz is risen, and his eternal reign is inevitable."
He stabbed his lance down at Huatli. She caught it in the gap of her shield, twisting the weapon out of his hand.
"Only death is inevitable," Huatli said. "Even for you."
A cry rent the air. Vito turned to find its source. A flying dinosaur barreled into him, sending him tumbling to the ground. From another direction, Pantlaza raced into the light shed by Huatli's armor, attacking Vito with the huge, sharp claws on his feet. They carved a pair of long slices into his gray skin, which bled ichor as black as his foul heart.
"You dare?" Vito shrieked.
More dinosaurs appeared from land and sky, swarming over the vampire with tooth and claw. Each time he took to the air, he was driven back down. On the ground, he was flanked and harried from all sides.
Huatli picked up the lance, a superb weapon wielded by a wicked hand. It deserved a fitting end.
Vito threw a dinosaur off, leaving a gap in the wall surrounding him. With a roar, Huatli charged, the full might of her rage and sorrow filling her arm with strength. The lance slid through the vampire's plate armor, piercing his vile heart and pinning him to the ground.
#figure(image("006_Episode 6/01.png", width: 100%), caption: [Art by: <NAME>], supplement: none, numbering: none)
Vito froze in shock and, Huatli hoped, pain. He collapsed to his knees, monstrous hands futilely attempting to pull out the lance. His own blood made the haft too slippery to grasp.
"Aclazotz," he whispered, "why have you forsaken me?"
Huatli stood over him in silence as he fell sideways, blood pooling beneath him on the dark earth. The red light died in his monstrous eyes.
The empire was rid of a dangerous enemy. And yet, Huatli felt hollow. The vampire's death would not return her cousin to life.
The dinosaurs clustered around her as they had surrounded Vito. Instead of attacking, they nuzzled her with their snouts, brushed her skin with their feathers, comforted her. Pantlaza trilled at Huatli, crooning like a father to a hurt child.
"Thank you," Huatli murmured, touching the light of the Threefold Sun where it gleamed on her armor. But the battle was not over. More vampires remained, and Aclazotz still darkened this land.
With a mental command, Huatli sent the flying dinosaurs toward the cosmium reef, and the others toward the steward and her other allies. She mounted her own bat and flew away from the bodies of family and foe, promising Inti that she would return when every vampire in the Core was eradicated.
#v(0.35em)
#line(length: 100%, stroke: rgb(90%, 90%, 90%))
#v(0.35em)
== Malcolm
The army of the Mycotyrant spread across the pristine land like … well, like a virulent fungal infection, which was basically what it was. Malcolm felt guilty for bringing this problem to a place that seemed idyllic, aside from the vampires and the darkness and the return of an ancient evil.
Right, no, everything was bad.
As he listened to Quint confer with a spirit named Abuelo—an Echo, he called himself—Malcolm thought of Vraska and all she'd told him of other planes and cities and seas. He missed her. She'd died in the invasion, or so he'd heard. He didn't want to believe it of his former captain, who had always seemed so powerful, nearly invincible, but war had a nasty habit of stripping away people's lovely illusions and replacing them with ugly truths. Wayta was a walking example of that, a child forced to grow up faster than a Herald-magicked weed. She stood nearby, while Breeches voraciously ate his way through some local fruit. Malcolm should do the same, but his stomach clenched with worry.
"We won't know unless we try," Quint said, holding up a khipu. Abuelo nodded, his expression determined.
"What are they doing?" Malcolm asked Wayta.
She shrugged. "Magic."
Quint laid the khipu on the ground and traced shimmering blue sigils above it. The magic spread to the khipu, blue shifting to pink as the crystals knotted into the strings of the garment lit up. Abuelo stilled as if holding his breath.
#figure(image("006_Episode 6/02.png", width: 100%), caption: [Art by: <NAME>], supplement: none, numbering: none)
A teal bubble of light formed above the garment, which rose to hover at Malcolm's shoulder height. The light stretched and roiled like a miniature storm, then from one blink to the next, it became the figure of a woman. The khipu hung from her neck, over her poncho. Wrinkled lips stretched in a smile as she peered up at Abuelo.
"There you are!" she exclaimed. "I thought that titan got you."
Abuelo chuckled. "It did."
"Oh, I suppose it did." She looked around. "What happened to the other Komon?"
"I don't know," Abuelo said. "But let me introduce you to our new friends. Everyone, this is Abuela."
Abuela sniffed the air. "The Mycotyrant nears. We must gather the other Echoes."
Breeches swallowed whatever he'd been chewing. "MORE GHOSTS?" he asked, dismayed.
"Better than mushroom-encrusted dinosaurs," Malcolm muttered.
Lights crested a nearby hill. Malcolm took to the air to scout, sighting people whose ponchos and khipu suggested they were Oltec. They carried staves tipped with pink crystals, and some were accompanied by furry long-necked creatures he'd never seen before. Their faces were lined with tattoos, some glowing faintly in the dark of the hidden sun.
Malcolm returned to his allies to find Abuela clapping her ghostly hands in excitement.
"The gardeners have arrived!" she exclaimed.
Abuelo nodded. "We are fortunate they came so quickly."
"What can they do?" Malcolm asked.
The steward answered, her voice rich with purpose. "Since the beginning of the Quiet Age, they've been developing practices to fight this enemy. We had hoped never to need them, but we wished to be prepared."
One of the gardeners approached the steward, saluting and bowing her head politely. "<NAME> sends his regards, and some of his fellow Echoes."
Various gardeners produced different objects—a necklace, a headdress, a small crystal mask, a serrated blade, and more. Spirits burst into existence, anchored to the items. Some were less solid, some less human, but all bowed to the steward and awaited further orders.
<NAME> surveyed the group. "Our ancient enemies have returned. While our Thousand Moons fight to save Chimil, you must preserve the land for their return."
"<NAME> will aid us," the gardener replied. "As will <NAME>, with his fire and storms, and the other gods."
The lone vampire standing nearby—Amalia, that was her name—stepped forward, gripping her pant leg nervously. "I may be able to help," she said. "I can change the land with my map."
<NAME> pointed. "Coordinate with the gardeners. We must all work together." Kellan, whom Malcolm had only seen by her side, squeezed Amalia's shoulder in support and offered her a dimpled grin.
"May the gods guide us all," <NAME> said. "Save Chimil and save the Core!" A roar of approval replied, and the members of the newly formed army set out.
Malcolm flew toward the mass of fungus, which had finally stopped swarming through the golden door. Their eerie green glow made them an easy target in the darkness, distinct from shafts of white or pink or blood-red emanating from other sources. At the center of the group, two huge mushroom-headed creatures held the Mycotyrant aloft in its fibrous web.
Malcolm shivered and surveyed the land, then turned back to meet the others.
"The Mycotyrant isn't far. He's heading …" What cardinal directions made sense here? The sun didn't move. "This way," he said finally, pointing.
The gardener turned to Amalia, who pulled a map and quill out of a container slung across her back. She bit her finger open, daubed it in her ash tin, and carefully smeared the blood mixture on the paper. Malcolm peered at the map. Parts of it were filled in, but others were blank. As the solution spread, the empty portions of the map disappeared, replaced by a detailed depiction of the terrain. It even showed the mass of the mushroom army as a dark stain.
"We could use that kind of magic in the coalition," he told Amalia. "If you ever want to jump ship, so to speak."
Amalia gave him a faint, almost embarrassed smile.
"Wait until you see the rest," Kellan said, nudging her with his hip.
Amalia asked the gardener, "Where do you want the fissure?"
The gardener ran her finger around a particular section of the map. "There. Make it as deep as you can. We will do the rest."
Amalia nodded and lowered her quill to the paper. She waited, took a deep breath, then swiped the nib across the map.
The ground rumbled and shook. Malcolm stumbled. When he looked at the map again, a deep crevice lay in the path of the army, encircling them so retreat would be difficult.
Kellan gripped Amalia's elbow as she wavered. "You're amazing at this," he said.
Amalia's cheeks darkened—was she blushing? Vampires didn't blush. What a precious little fledgling.
Malcolm flew back toward the Mycotyrant and his troops. The first small mushroom scouts found the trench, too deep and steep for them to climb, too wide to leap. More of the creatures arrived, dozens, hundreds, and to his horror they began to throw themselves off the cliff.
No, they held each other, grafted together, forming a thick fungal chain. One of the flying creatures dove into the space and grabbed the last mushroom, carrying it to the opposite side. More of them piled on, and soon a thick bridge spanned the crevice.
So much for that plan, Malcolm thought.
Before he could get any closer to the Mycotyrant, Malcolm felt more than saw something above him. A fungus-encrusted bat swooped down, narrowly missing him. More such creatures filled the skies, their movements awkward and stilted compared to his, but they could overwhelm him with sheer numbers.
"Not today, stinkhorn," he said, and retreated.
Below him, the Echoes formed a ghostly vanguard that reached the mushrooms before everyone else. Malcolm landed next to Breeches and Quint and gestured at them.
"What are they doing?" Malcolm asked.
Quint lowered his goggles. "Watch."
An Echo with a face like a bare skull floated up to one of the smaller walking mushrooms, which paused as if in confusion. Silently, the Echo slid into the creature and vanished.
At first, nothing happened. Then the mushroom shuddered and jerked, veins of bright teal splitting its skin. It dissolved into blue smoke as if consumed by invisible fire.
The Echo reformed and drifted to the next enemy. Other Echoes followed suit, and one by one, soldiers in the fungal army dissipated.
"They turn themselves into a sickness," Quint explained. "It only affects the mycoids—that's what they call the mushrooms."
"Impressive," Malcolm said. "There are so many of them, though."
"The counter-infection is only one of our tools," a gardener said. "Here is another."
The gardeners divided into groups of three and stood shoulder to shoulder, raising their staves. Thin rings of pink light emanated from crystals embedded in the wood, rippling outward in waves. With a shout, the gardeners lowered their weapons, and the magic sliced through the air, toward the mycoids.
#figure(image("006_Episode 6/03.png", width: 100%), caption: [Art by: <NAME>], supplement: none, numbering: none)
Every fungus the light touched burst into flames. Dozens of the creatures fell writhing to the ground, then lay still, disintegrating into ash.
Still, more came. The fight devolved into a melee, with some mycoids wielding spears or blades, and others casting spells that choked the Oltec with fetid spores. Kellan stayed near Amalia, gracefully fending off enemies with a pair of magical blades. An unfurled scroll hovered in front of Quint like a shield—and it worked as well as one, the magically rigid paper shattering and deflecting incoming arrows and spears. Quint wielded another scroll like a whip, sigils sending ribbons of golden energy lashing out to loop around enemies and cut through them like razors. The mycoids advanced despite their injuries, leaving piles of decomposing fungus in their wake.
The titans remained on the far side of the crevice, too heavy to cross the mushroom bridge. The Mycotyrant hung between them, baleful green eyes glaring at its enemies.
Malcolm caught Breeches staring at the fungal overlord with the same shrewd expression he wore when he was calculating how deep a mark's pockets were. He finally bared his teeth in a wild grin and pointed.
"BIG BOOM!" Breeches exclaimed.
"You think it can kill the Mycotyrant?" Malcolm asked incredulously.
Breeches nodded and grinned. From his pack, he retrieved the weapon he'd acquired in High and Dry as payment for a debt. The metal tube was about the length of a forearm, with an elaborate vine pattern etched in the surface, a jutting leaf for a trigger, and flower petals molded to the end. Malcolm had been surprised when the previous owner agreed to turn the thing over. Once he'd seen it in action, however, he'd concluded he would rather stick with cannons, thanks very much. It was more destructive and unreliable than it was worth.
Those qualities would likely serve them well now.
Malcolm picked Breeches up and leaped into the air, circling around from the direction he'd decided to call south. "We'll probably get one chance," Malcolm said. "Don't miss."
Breeches glared at him indignantly.
Malcolm didn't argue. It would definitely hit something. He just didn't want it to be him.
One of the titans holding the Mycotyrant swiveled its wrinkled morel head to watch Malcolm and Breeches fly closer. With a roar, it grabbed a nearby mycoid and threw it, the smaller creature flailing its limbs and trying to hit Malcolm or Breeches in passing with its spear.
Malcolm dropped and it sailed over him. Another mycoid followed, then another, and he wished he were back at High and Dry telling the story of this unbelievable day to friends over a drink.
"Mushrooms," he would say. "Smart mushrooms, turned into projectiles. Trying to stab me. No, seriously. Swear it on my song."
Assuming he survived, which he fervently hoped to.
"Any time now, Breeches," Malcolm said, his tone strained.
Breeches pointed the tube at the Mycotyrant.
A fungus-covered dinosaur swooped. Malcolm dodged, and Breeches fumbled the artifact, which flipped and twirled between his hands. He whipped his tail forward and caught it before it could plummet to the ground. The flowery end, unfortunately, now stared Malcolm in the face.
"Careful where you aim that thing!" Malcolm shouted. "Hit the blasted Mycotyrant already!"
"FLY BETTER!" Breeches retorted. He passed the tube to his feet, then to his hands, holding the artifact so both sides were at arm's length.
Malcolm said, "Warn me before you—"
#emph[FOOOOOM!]
Smoke and sparks billowed from the back of the tube. From the front, an enormous ball of molten fire sprayed, thick as pitch and just as sticky. The force of the weapon's magic sent Malcolm and Breeches flying backward, and Malcolm nearly dropped his goblin passenger before righting himself.
Everything in the fireball's path was leveled. The Mycotyrant had only a moment to see its death looming before the projectile tore through the nearest titan, hitting it squarely in the body. It fell from its web to the ground, pinned beneath the fiery projectile, which splashed flames in all directions.
Every fungal creature around it shrieked in unison, some collapsing like puppets whose strings had been cut. Others struck by the sticky fire flailed their arms, running around or rolling on the ground. A few launched themselves into the fissure, turning the shadowy space into a pit of flickering flames.
They were soon joined by the bridge as gardeners broke the front ranks, their own magical fires cleansing the area. Echoes continued to transform mushrooms, the harmless smoke combining with its acrid counterpart. The once fertile earth lay bare, scorched, littered with lumps of ash and the bodies of the fallen.
But they were winning, and hopefully this meant Downtown would be safe as well.
Malcolm nearly smacked himself for daring to hope again. How had the impulse not been beaten out of him?
As if in response, a storm of dark energy erupted from the distant mountains. Bolts of red lightning flashed, illuminating rocks sheared away in a landslide that sent up clouds of dirt. The ground shook, sending people stumbling or knocking them off their feet entirely. Shouts of concern crossed the battleground, and far above in the cosmium reef, bats shrieked like nails dragged across metal. Malcolm's feathers shivered involuntarily.
As the dust cleared, the casing around the sun shifted apart slowly, almost imperceptibly. Most of the land remained shrouded in shadow, but shafts of light shone through as the strange dawn broke.
The Oltec cheered, and even Quint and Amalia and Kellan joined in the celebration. Malcolm landed nearby, finally dropping Breeches and rubbing the muscle aches out of his arms. One person, he noticed, wasn't celebrating.
Wayta stared at the mountains, squinting her single visible eye. "What is that?" she asked.
Pillars of a great temple rose from the sheared mountain face. A blood-red glow emanated from inside, and Amalia stumbled, grabbing her head and wincing.
"Aclazotz," Amalia said. "That's his temple. We need to go there, to stop him!"
What could he do that was worse than covering the sun? Malcolm wondered.
Anim Pakal whistled, then turned to the assembled warriors. "Gardeners, please continue to eliminate the Mycotyrant's forces. Leave not even a single spore alive. My Moons, come. We will root out the disease of cosmium eaters and end them as well."
Amalia trailed after her, followed by Kel with his magic swords. Abuelo and Abuela flitted around with the other Echoes, gleefully turning mushrooms into mist. Quint swiped a handkerchief across his goggles with his trunk, then tucked it into a pouch on his belt.
"This is going to be an incredible paper," Quint said.
Wayta made a choked sound, then began to laugh so hard tears leaked from her eye. Malcolm had never seen her stoic demeanor so completely altered; she looked younger, happier. Poor Quint seemed confused, but he cracked a smile, too.
Breeches tilted his hat back with his tail and sighed happily. "BIG BOOM."
It was more like a big #emph[foom] , Malcolm thought, but he didn't want to spoil the moment. He had a feeling it would be spoiled by something else soon enough.
#v(0.35em)
#line(length: 100%, stroke: rgb(90%, 90%, 90%))
#v(0.35em)
== Amalia
The trail to the temple of Aclazotz was littered with cosmium eaters, alive and dead. The Thousand Moons mercilessly fought any they encountered, with assistance from Amalia and Kellan. Acrid smoke from the fungal fires mingled with the clouds of dirt from the landslide, forcing Amalia to squint and blink away grit. Dinosaurs roamed the terrain, their feathers and claws and teeth caked with blood, as if patrolling—or hunting.
"Behind you!" Amalia yelled.
Kellan spun as he ducked, dragging one of his glowing blades through a vampire's knee. The other he angled up, slicing his enemy open from crotch to collarbone. Her other leg buckled, and bringing his sword together like scissors, Kellan took off her head.
Amalia blanched and looked away. "You're surprisingly good at that, Kel," she muttered.
"These guys aren't so tough," Kellan said. "You ever tangle with a giant goose?"
"What's a goose?" Amalia asked.
"It's like a dinosaur with a grudge."
They continued, climbing inexorably toward the temple. The warriors carried torches and glowing crystals, while Amalia's floating candles remained tethered to her belt, flickering madly. Darkness churned above, a shadow darker than night like a stain on the air, but the red flashes had stopped. Amalia dreaded what they would find.
A vampire-bat swooped toward Kellan, who barely dodged the creature's spear thrust. It still wore the armor of the Dusk Legion, to Amalia's horror. What had Vito done to her people? What would she tell Queen Miralda if she ever escaped this place?
#figure(image("006_Episode 6/04.png", width: 100%), caption: [Art by: <NAME>], supplement: none, numbering: none)
She had to keep going. To bear witness. To carry the stories back home.
A whistle rose and fell from further ahead, answered by a pair of matching notes.
"We have found the entrance, <NAME>," one of the scouts said.
<NAME> inclined her head, then gestured for Amalia to approach. "Come," she said. "Perhaps you can tell us something of your god."
Amalia flinched at the reminder of her connection to Aclazotz and sent a beseeching look Kellan's way. He gave her a dimpled grin.
"I'm with you," he said.
A stone door loomed, cracked in half by the earthquake, leaving a jagged hole to the temple beyond. Amalia climbed into an antechamber whose roof had collapsed, then ducked under partially crumbled pillars that looked as if the god himself had thrust them aside in his rage.
Inside, rows of seats led down to a stage with a pit at one end and a barred cave at the other. Lengths of gem-encrusted chains lay scattered as if blown apart by a massive force. Everything was broken, covered in debris and dust that lingered in the air. The scent of blood suffused Amalia's senses until she wanted to scream. So much death. For what? To turn Vito and Clavileño and the others into monsters?
"Aclazotz is gone," Anim said. "So are the rest of the cosmium eaters, and the Dusk Legion, assuming any of them survived the battle."
A warrior cleared his throat. "One of the eaters has been apprehended for questioning."
Three more of the Thousand Moons dragged in their prisoner. His poncho and khipu were streaked with blood down the front, as was his chin, and he spat defiantly at Anim. She wiped the red-tinged fluid away and crossed her arms.
"Where is Aclazotz?" Anim asked.
"He is free," the cosmium eater said. "He gathers his children, and soon he will end the Fifth Age and begin a new age of blood. All who join him will feast on the weak for eternity, and all who oppose him will be consumed."
"No," Amalia whispered in horror.
The eater's gaze shifted to her. "You," he said venomously. "Traitor. We saw you run when you were called. And now you align yourself with the enemies of your god? You and all your kind will be cleansed in fire and blood, and your names will be forgotten."
Amalia could only stare at him mutely, the once strong bonds of her faith breaking like the chains that littered the ground.
"Where is Aclazotz?" Anim repeated, grabbing the man's chin. He snapped at her, and she recoiled.
"He is beyond your reach," the eater replied. "But you will not be beyond his for long."
Amalia stumbled out of the temple, back into the open air, the eater's laughter pursuing her like an attack dog. She stopped beyond the door, wrapping her arms around herself and shivering.
She shouldn't have left home. Shouldn't have gone on this forsaken journey. Bartolomé died to protect her and Kellan, but his sacrifice was in vain. The schism would never heal. Worse, it seemed Vito had been right all along. What would Aclazotz do to Queen Miralda? To Saint Elenda? To her family? Did he want to transform all vampires into his own image?
A hand touched her arm, startling her. Amalia looked up at Kellan, his dark eyes gentle.
"I'm sorry," Amalia murmured. "I was raised to believe my god was distant, but benevolent. That he charged us with a sacred mission to serve and pass along his gift. Now I find he's … he's …"
"Not what you expected?" Kellan asked.
Amalia nodded. "I feel as if I've been living a lie."
"I might understand that more than anyone else here." Kellan offered her a sad smile. "You still have a choice, though. You're not locked into a destiny someone else planned for you."
"What can I do? Go back to Torrezon and warn Queen Miralda of all this? How can I choose a mere woman over my own god?" Amalia stared at the temple, the door, broken like her faith.
Kellan seemed to consider that one. "If you don't like what your god is doing, maybe you should find another one?"
"Another god?" Amalia laughed bitterly. "You make it sound easy."
"It's probably tricky," Kellan said. "Maybe Quint can help. He's smart, and all those professors at the university he talks about are probably even smarter. You could talk to them."
Other planes. Other gods. Other vampires? It was almost more than Amalia could imagine. But then, she'd never expected to find a whole world beneath her own, inside it, like a seed in an avocado, a pearl in an oyster. She'd found something inside herself, too—not a pearl, perhaps, not yet, but a grain of something that might become harder and stronger.
"Will you tell me about your gods?" she asked Kellan.
"We don't have those where I'm from," Kellan said. "But I can tell you about the fae. Next best thing, I think." Together they returned to the path, walking away from the ruins and back toward the growing dawn.
#v(0.35em)
#line(length: 100%, stroke: rgb(90%, 90%, 90%))
#v(0.35em)
== Wayta
The second Sun Empire delegation reached Oteclan a week after the battle, to find Chimil restored to her previous glory even as pyres of the dead burned. The River Heralds retreated to their underground ocean, the Brazen Coalition returned to the surface with the remaining vampire and her companion, and the Oltec began to clean up the mess everyone had made of their home.
Wayta idly scratched her eye beneath the patch as Steward Akal greeted the new arrivals, <NAME> just behind her. A few of the so-called diplomats were recognizable even to her—many of them warriors, some higher ranked than others. All loyal to the emperor.
Huatli struggled to hide a scowl.
Speeches followed, pretty words for now; there would be time for negotiations later. Long tables covered in food beckoned them to feast, gathering the people she had come to know and respect. She stayed near Quint and some of the soldiers who had survived the vampire and mycoid attacks, quietly celebrating. Remembering the fallen.
Caparocti sat at Steward Akal's left hand, having been appointed the emperor's voice in the proceedings. Wayta was too far away to hear their discussion, but the steward looked serious, concerned, while her sister at her other elbow gestured widely before jabbing a slice of fruit toward the sky. Huatli, next to Anim, sat up stiffly and nudged her plate forward, her food untouched. Behind her chair, Pantlaza attentively waited for scraps.
Quint gently elbowed Wayta, who nearly spilled her juice. "You know," he said, "I have an eavesdropping spell." When she didn't respond, he added, "If you don't use it, I will."
Wayta hesitated, then nodded. It wasn't as if the conversation could be private in such a public place.
Pulling a scroll from his pack, Quint cleared his throat. He unfurled the scroll and began to quietly read it, the words individually sharp and clear, yet somehow fading and blurring together so Wayta couldn't understand them.
"Did it work?" she asked.
Huatli's voice suddenly sounded as if it were right next to her ear. "Surely we have lost enough. Can we not rebuild and mourn instead of seeking out new battles?"
"Aclazotz threatens the entire surface," Caparocti retorted. "You saw what he did to the vampires here. Do you want to face an army of those in Ixalan?"
"We can fight Aclazotz without declaring war against the entire Legion of Dusk," Huatli said. "If we move quickly, with a smaller force, we should be able to stop him before he gathers more allies to—"
"You're going to fight a god with a small force?" Caparocti asked incredulously. "What will you do, bore him with poetry?"
Wayta frowned. That was uncalled for.
"You forget that I am a warrior as well as a poet," Huatli said coldly.
"And yet your title was stolen for you by your cousin Inti rather than granted by the late emperor."
Huatli stood, laying her hands flat on the table. "Keep Inti's name out of your mouth. He was a better man than you could ever dream of becoming, not even if you lived as long as the sun-cursed vampires themselves. You certainly share their thirst for blood." She began to move away, Pantlaza trailing after her, then paused to glare at Caparocti, dark eyes blazing with menace. "Do not look for me again, Champion, because you will find me."
Silence followed her departure, though Caparocti looked more pleased than embarrassed or cowed. Wayta had an urge to command a dinosaur to relieve itself on his head.
Anim leaned closer to her sister. "Whatever we decide, we cannot remain here and ignore what is happening on the surface. Not anymore."
<NAME> pressed her lips together. "Especially not if Aclazotz is amassing forces there. And if any remnants of the Mycotyrant have spread, we must continue our work to purge them, as the gardeners tend to crops."
"Will you supply us with warriors?" Caparocti asked. "Echoes? Cosmium?"
"We will coordinate an appropriate response," St<NAME> replied.
"The Thousand Moons stand ready to assist," Anim said.
"You stand ready to see the surface for yourself," Steward Akal said dryly. "We will do what must be done."
And what would that be? Wayta wondered. So many people had different definitions of "must" and were eager to apply them. We must defeat this enemy. We must hold this tunnel. We must break this line. Every must was a promise made, so many of them paid in blood.
Wayta clapped Quint on the shoulder. "Thank you for letting me hear that."
"What do you intend to do?" Quint asked.
"What I must." Wayta squared her shoulders and followed Huatli, who stood at the edge of a lake, a cool breeze teasing strands of hair from her braid. The seneschal's sword hung low on her hip, a cosmium crystal affixed to the pommel.
Huatli glanced at Wayta, then back at the water. They stood in silence for a few minutes, waves lapping at the shore, Pantlaza chasing insects that fluttered from flower to flower.
"I wanted to be a warrior-poet once," Wayta said. "When I was much younger. Before Orazca was found and claimed."
"How simple that time seems now," Huatli murmured. "The stone does not feel each drop of rain, but still it is worn away." She smiled weakly at Wayta. "Perhaps an even more important destiny awaits you."
Wayta shrugged. "Not everyone has to be a legendary hero. A candle isn't as bright as the Threefold Sun, but it still lights a room."
"True." Huatli's hand gripped the hilt of her cousin's sword. "Being the warrior-poet means I'm meant to lead. I would happily hunt down Aclazotz myself, but an invasion of <NAME>? It's too much. How can I find the words that will spark flame in the hearts of our people when I cannot commit myself to this cause?"
Wayta nudged a pebble with her boot, kicking it into the water. "A wise woman once told me: it is more important for poetry to be honest than good. Perhaps you need to find a quest you believe in, that also serves the empire?"
"Perhaps I do." Huatli fell into thought. Then, she untied the sword from her belt and offered it to Wayta.
"The seneschal's blade?" Wayta asked, bewildered. "You want me to have it? Why?"
"I think Inti would like it," Huatli replied. "You can ask him if you want. He's an Echo now. His spirit is here, in the gem." She tapped the cosmium crystal in the pommel.
Wayta hesitated, then reached for the hilt. "I am honored more than I can say. I will keep him safe."
"I hope he keeps you safe, too," Huatli said, a flicker of amusement lighting her face. "You're not dead yet. Stay strong, little sister." She took a step away from Wayta, then another, walking along the edge of the lake toward the still-frolicking Pantlaza.
"What will you do now?" Wayta called to her.
Huatli smiled. "I've received an invitation to Otepec from the emperor's sister. It was carefully worded, but I think I'm not the only one who isn't eager to kindle a new war while the embers of the last one are still hot."
Wayta had no notion of what <NAME> would do. If anyone could persuade her brother not to invade Torrezon, it would be her. And if he couldn't be persuaded? She shuddered to think what might happen.
Perhaps the Legion of Dusk wouldn't be the only ones facing a civil war soon.
#figure(image("006_Episode 6/05.png", width: 100%), caption: [Art by: <NAME>], supplement: none, numbering: none)
#v(0.35em)
#line(length: 100%, stroke: rgb(90%, 90%, 90%))
#v(0.35em)
== Malcolm
Climbing back out of the caverns had almost been worse than going in. On the way down, Malcolm had hoped to find survivors of whatever fate had befallen Downtown. On the way up, he knew better. The mystery was solved, but the underground city remained empty, and he had no idea when, if ever, new residents would move in to continue the work of the old.
He and Breeches arrived at Sunray Bay exhausted and grimy from travel, having said their goodbyes to Amalia and Kellan. Dreams of baths and soft beds taunted him; he'd make his report to Vance, the families of the lost would have to be notified, and then he would disappear into the bottom of a tankard of ale until he'd washed the taste of failure out of his mouth.
When will you learn, Malcolm told himself bitterly, stopping in the middle of a street to stare up into the storm-heavy sky.
Sunray Bay was as deserted as Downtown, with the same signs of the Mycotyrant's handiwork: Burnt-out buildings and magic-scorched walls, discarded items, spoiled food. Mushrooms sprouted from random cracks, clustered in dark corners, shook their spores into the air and glowed with the awful green color Malcolm knew he'd see in his nightmares forever.
At the docks, not a single ship waited. He hoped that meant their crews had escaped to safety before they were infected, but he feared the worst. All it would take was one pirate, one stowaway, and the problem would continue to spread.
"We need to get to High and Dry," Malcolm told Breeches. "We have to warn them or find out whether it's too late."
"Big boat? Little boat?" Breeches asked.
"Any boat that floats," Malcolm replied. "Come on, maybe we'll find something in the cove farther up the coast."
If not, he would—what? Keep going, he supposed. Beg a boat from the next port he reached. Fly to a Sun Empire village. Wander back to Orazca and pretend the plane wasn't falling apart again. But he wouldn't stop, not now, maybe not ever. If he did, the fungus would catch up.
The sky opened, pouring sheets of warm rain on the ruined town. Malcolm tipped his face up, letting the water wash through his feathers, wondering if he would ever truly feel clean again.
#v(0.35em)
#line(length: 100%, stroke: rgb(90%, 90%, 90%))
#v(0.35em)
== Amalia
Even by the standards of Ixalan, the island Amalia and Kellan found themselves on was lush, the jungle like a thick wall nearly to the shoreline. Soft sand shifted under Amalia's boots as she stepped out of the tender that brought them from the merchant vessel to land.
"Are you certain this is the right place?" Amalia asked.
"Mostly a feeling," Kellan said. "My luck hasn't failed me yet. Not when it really counted, anyway."
"We'll know soon," she said. "Either way, your search will continue."
"It will," Kel agreed. "Who would I be if I gave up now?"
Who indeed? Amalia wondered. Her own urge to explore had led her to this place, but she still harbored worries, doubts. She thought she'd expunged them at sea, but she had only succeeded in ignoring them for a time.
And now, her time was almost up.
They found a dirt path that wound through the jungle. Sun dappled the ground as branches and flower-studded vines formed a shadowy roof.
They used a massive fallen tree to cross a gulch, a waterfall beside it misting the air into rainbows. On the other side, at the center of a field covered in tall grass, they found what they were looking for.
A strange circle coruscated and swirled with lights. It was taller than a human and just as wide, and it floated above the ground without shifting or moving, as if it were a painting affixed to a wall.
Kel whispered, "That's it. An Omenpath."
"You're sure?" Amalia asked. "Where does it go?"
"I have no idea," Kel said. "The last one brought me here, but this one might not be so forgiving."
"You think this could lead to somewhere worse than a cavern full of angry goblins and jaguarfolk?"
Kel shrugged. "I wish it wouldn't, but if wishes grew in fields, we'd all farm."
They stared at the swirling portal in silence as the sun baked their heads.
Amalia looked to Kel, only to find him staring at her. "What?" she asked.
"Are you sure you want to come with me?" he asked quietly. "This is your world. Your family is here, your friends, everything you've ever known. Are you truly ready to leave it all behind?"
The question Amalia had been ignoring now loomed, immense and unavoidable. She had promised to look after Kel, yes, but surely her duty had long since been acquitted. He was a grown man and didn't require a guardian. His quest was his own, and she had no need to take it upon herself to accompany him.
But she had left home to explore, to find new places, to learn new things. She wanted to help her people, yes, and so she had sent word to her family and Queen Miralda through the remaining Queen's Bay Company members of the oncoming storm Aclazotz might bring. However, she found herself keen to avoid the discord between her god—former god?—and his wayward disciples. His gospel of blood and subjugation repelled her, and she would sooner leave than see it come to pass.
"I am ready," Amalia said firmly, pleased to find it was true. "Whenever you are."
Kellan took her hand, his skin pleasantly warm. She could feel his pulse through his thumb as it sped up slightly.
"Just so you know," he said, "this could lead anywhere. The next place may not be any better than this one."
"What could be worse?"
Kel shrugged and treated her to a dimpled smile. "Giant goose?"
Amalia laughed, her heart lighter than it had been for weeks. Without another word, they leaped through the Omenpath, and everything changed.
#v(0.35em)
#line(length: 100%, stroke: rgb(90%, 90%, 90%))
#v(0.35em)
== Quint
The place the Oltec called Colony's End jutted from the side of a mountain, a huge half-circular ruin seemingly cast from a single piece of metal, despite its layers and ridges. Quint shouldn't have been surprised at how large it was, given the size of the remains he'd seen at the Night War memorial in Oteclan. They matched the corpse found during the first tentative foray into the caverns beneath Orazca; he hoped someone had preserved that one for future study as this one had been.
#figure(image("006_Episode 6/06.png", width: 100%), caption: [Art by: <NAME>], supplement: none, numbering: none)
"Colonizers," the didacts told him. Their stories described giants whose great, dark vessels appeared in the sky, blotting out the light of Chimil and then caging her within a metal prison. Sometimes legends grew in the telling, but given that Quint had seen the prison himself, he was inclined to believe the Oltec weren't exaggerating.
They'd also warned him to stay away from Colony's End, because it was dangerous and hadn't been fully explored. He knew how to be careful, though. He'd survived his delve into Zantafar when Asterion hadn't because he'd taken better precautions. That he was essentially doing precisely what Asterion had done by coming here alone was a fact he was prepared to overlook in the interests of historical scholarship.
Tucking the loose end of his scarf back into his collar, Quint continued to climb. Soon, he reached the side of the ruin, the wall looming a dozen times his height or more. Before he could lose himself in contemplation of scale, he found the very thing that had brought him to Ixalan: bas-reliefs depicting the same coin motifs he'd discovered elsewhere. His excitement grew as he traced the pattern to an open doorway, sunlight slanting in to illuminate a room composed of the same metallic material as the exterior.
Quint retrieved a light globe from his pack and began to map the ruins. Unlike others he'd explored, these felt eerily lifeless, colder than the mountain weather should have made them. The further he delved, the less dirt and dust coated the floor beneath his echoing footsteps. No water intruded to cause rust, no mold sprouted in corners. The place was sealed up tighter than any tomb.
It was also empty of any signs of habitation. Tall oblong objects towered over Quint—furniture, perhaps, scaled to their makers. He considered climbing them, but decided to finish his map first.
On he went from room to room, pacing off the dimensions of the space and recording them on a scroll. Ramps led up and down to other levels; despite his curiosity, he finished his exploration of the current floor before proceeding to the next. Up or down? He pulled out the coin he'd been carrying with him and flipped it.
Down.
The lower level was much like the first, tall ceilings and more potential furniture, but otherwise nothing. How did these people live? Did they eat? Sleep? Had they taken all their personal effects when they left? It was as if he'd found the bones of some giant creature, long since picked clean, and was trying to determine the color of its eyes.
He turned a corner and stopped, blinking in astonishment. Unlike every other room, this one held a long row of massive tanks, their glass fronts shattered, shards littering the floor. Whatever fluid or gas they might have contained had long since drained away or evaporated, and any objects inside were missing—perhaps intentionally destroyed, perhaps taken by survivors.
Quint sighed. He'd found more questions than answers. As usual.
A glint of a reflection from his light caught his eye. At the end of the row, one of the tanks was intact. How had this one survived? Perhaps he should ask the didacts when he returned to Oteclan.
He ambled over, peering through the glass. The interior was cloudy, opaque; was there anything inside? With his handkerchief, he swiped at the surface, then cupped his hands to the sides of his eyes and pressed his face to the container to get a better look.
With a deep clang, the tank lit up.
Quint scooted backward nervously. What had he done? What was happening?
Inside the container, smoky air swirled, then slowly dissipated, revealing the body of an enormous creature. It was so tall, Quint couldn't see its head from where he stood, only thick, gray-skinned legs and hands that ended in claws.
What a discovery! This specimen was far more intact than the one in Oteclan. But how could he possibly transport it? He'd have to return to the others and bring a team back to—
The creature's fingers twitched. It flexed them, stretched its hand, and then curled it into a tight fist.
Or, Quint thought, perhaps I should go. Now. Right now.
#v(0.35em)
#line(length: 100%, stroke: rgb(90%, 90%, 90%))
#v(0.35em)
== Mycotyrant
One mind was all, and all minds were one.
Some bodies required direct attention to function, while others acquired sufficient autonomy to act on their own, nonetheless acquiescing to the will of their progenitor. Some were more stubborn and refused to obey. So be it. More bodies could always be formed or assimilated.
Temple ruins in a jungle on the surface swarmed with vampires, clearing vegetation and building a camp. One of them struck a swollen fungal sac with its blade, releasing a cloud of spores that settled on its skin like flies. Soon, it would join the body that watched from behind the trees. As would the others.
The pirates from Downtown who had escaped now wandered Sunray Bay, their faces covered. They passed from one body to the next, each giving a different point of view, a different influx of knowledge and sensory input. Their refusal to assimilate was puzzling, and frustrating, but so it went. They did not understand the efficiency to be gained.
The battle against the Oltec had taught them a valuable lesson: sometimes stealth succeeded where force failed. A new body stood on the deck of a ship—such useful things, ships—and watched as it approached High and Dry. This one retained its original form in most ways, except for its eyes, covered by dark lenses. Better to hide, and plan, and spread.
With enough time and care, everyone would succumb. Everything would be joined. Controlled. Already the light of the new sun warmed the molds and caps spreading across the surface.
For every stalk burned away, more would grow. Progress was inevitable. It only required time and patience. And more bodies.
#v(0.35em)
#line(length: 100%, stroke: rgb(90%, 90%, 90%))
#v(0.35em)
== Aclazotz
The ship's hold reeked of despair. Wide-eyed sacrifices awaited their doom in the dark, their spirits broken, hope lost. Soon, the faithful would descend to feast on their life-sustaining nectar, and more importantly, to offer the choicest morsels to their risen god.
Freedom after such long imprisonment was perhaps an even more delectable pleasure, despite the need for confinement in the salt-crusted, stagnant cargo hold.
Aclazotz longed to stretch his wings. To soar. To hunt.
Soon the ship would reach Torrezon, a land of sheep awaiting their promised shepherd to lead them to eternal life. Those who had survived the battle against the Oltec and their misbegotten surface brood would serve as the generals of his army. He would canonize the strongest among his children, forming them into more perfect images of himself.
One vampire he craved above all others: <NAME>, the Antifex. She had rejected the false teachings of his lesser creations and found the path to truth. Vito had fallen and would be forgotten, but Vona? He would set her at his right wing to see that his will be done.
And once he secured Torrezon, they would return to Chimil and obliterate her at last.
The ship creaked and rocked as Aclazotz opened his single, baleful eye, shrouding the hold in red light. The sacrifices shrieked and moaned in terror, blood pounding in their bodies like a syncopation of drums. Such sweet music they made for him. He would almost miss it when they were silenced.
|
|
https://github.com/seapat/markup-resume-lib | https://raw.githubusercontent.com/seapat/markup-resume-lib/main/cv_head.typ | typst | Apache License 2.0 | #import "@preview/fontawesome:0.1.0": *
// Address
#let address(info, render_settings) = {
if render_settings.show_address {
let order = if "address_order" in render_settings.keys() {render_settings.address_order} else {("street", ",", "city", ",", "postalCode", ",","country")}
for value in order {
if value in info.personal.location.keys() {
str(info.personal.location.at(value))
} else {
value
}
}
v(-4pt)
} else { none }
}
#let contact(info, render_settings) = [
// TODO: make configurable
#let dot_symbol = sym.refmark
// Contact Info
// Create a list of contact profiles
#let horizontal_space = h(1em)
#let profiles = (
fa-envelope(size: render_settings.font_size - 4pt) + horizontal_space + link("mailto:" + info.personal.email),
if render_settings.show_phone {
fa-phone(size: render_settings.font_size - 4pt) + horizontal_space + link("tel:" + info.personal.phone)
},
if "url" in info.personal.keys() {
fa-link(size: render_settings.font_size - 4pt) + horizontal_space + link(info.personal.url, info.personal.url.split("//").at(1))
},
)
// Remove any none elements from the list,
// needed in case a field in personal is empty
#if none in profiles {
profiles.remove(profiles.position(it => it == none))
}
// Add any social profiles
#if info.personal.profiles.len() > 0 {
for profile in info.personal.profiles {
// assertion so we can communicate to user that input is incorrect
assert("url" in profile.keys(), message: "url missing in {profile.name}")
// TODO format URL -> `domain`: `profile-name`
// handle trailing forward slashes
// handle presence or absence of `www.` / `https://`
// 1. slice url into array on `.` and `/`
// 2a. drop https, and www
// 2b. drop empty elements (trailing `/`)
// 3. grep element containing domain (0 [if dropped] else 3rd or 2nd)
// NOTE: we might not want to do this after all, what if the url name is not the username?
// let url = "https://linkedin.com/in/sean-patrick-klein"
// if url.ends-with("/") { url = url.trim("/") }
// let profile = url.match(regex("[^/]+($)")).text
// parbreak()
// let domain = url.match(
// regex("(?:(?:https|http)://(?:[a-z]{3,}\.)|(?:[a-z]{3,}\.)|)([a-z]+)\."),
// ).captures.at(0)
// grep last element for profile name (if trailing / droppedd successfully)
profiles.push(fa-link(size: render_settings.font_size - 3pt) + horizontal_space + link(
profile.url,
{ profile.url.trim("https://").trim("www.").trim("mail.") },
))
}
}
#if render_settings.show_photo {
for item in profiles {
list(marker: none, item)
}
} else [
#set par(justify: false)
#set text(
font: render_settings.font_body,
weight: "medium",
size: render_settings.font_size * 1,
)
#pad(x: 0em)[
#profiles.join([#sym.space.en])
]
]
]
// Create layout of the title + contact info
#let make_head(info, render_settings) = {
// set page(numbering:"1/1")
let content = [
= #info.personal.name
#address(info, render_settings)
#contact(info, render_settings)
]
if render_settings.show_photo {
grid(
columns: (auto, auto),
column-gutter: 10pt,
image(info.personal.photo, width: auto, height: render_settings.photo_height),
content,
)
} else {
align(center, content)
}
}
|
https://github.com/lxl66566/my-college-files | https://raw.githubusercontent.com/lxl66566/my-college-files/main/信息科学与工程学院/嵌入式系统/实验/readme.md | markdown | The Unlicense | # 嵌入式系统实验
实验内容基本是读源码然后修改,挺简单的。
## 开发环境安装
<!-- prettier-ignore -->
1. [下载资料](https://cs.e.ecust.edu.cn/download/5a403808a967b666b1e9ce9ac88429b5)并解压。
- 约 2GB,课前提前下载。
2. 前往 _软件资料 - 软件 - MDK5_,双击 `MDK521A.exe` 安装。注意安装路径不能有中文。
3. **双击** 同文件夹下的 `Keil.STM32F4xx_DFP.2.9.0.pack` 安装。
4. 返回 _软件_,选择 _ST LINK 驱动及教程 - ST-LINK 驱动 - dpinst\_amd64.exe_,双击安装。
5. 打开桌面上的 `Keil ...` 软件,选择左上角 `File - License Management`,复制右边的 CID。
6. 下载[破解软件](https://cs.e.ecust.edu.cn/download/3b4d80b99923984b0d52f1788b5359bc),解压运行(可能报毒,需要关闭 Windows Defender)。
7. 粘贴刚才复制的 CID,右边 Target 选择 ARM,点击 Generate,复制生成的代码。
8. 在 `Keil` 的 `License Management` 中,`New License ID code` 处粘贴代码,选择 _Add LIC_。
9. 回到 `1.` 中的资料,进入 _程序源码_,解压`1,标准例程-寄存器版本`,在 _实验 1 跑马灯实验 - USER_ 中打开 `TEST.uvprojx`。
10. 连接开发板,按 `F7` 编译,再按 `F8` download。
11. 此时应能看到开发板的 LED 闪烁。若无反应,可以按一下板子的 RESET 再观察。
### 工具使用
- 串口调试工具:_外部中断实验_ 中需要调试串口。
1. 烧录程序后,把 USB 线从 ST-LINK 上拔出,接到板子的 USB_232 上。
2. 打开 _软件资料\1,软件\串口调试助手\XCOM(正点原子推荐)_
3. 波特率选择 115200,_串口选择_ 中选中出现的串口,点击 _打开串口_ 即可看到消息。
- 引入外部库:_综合实验_ 中可能需要引入外部库。
1. 将库所在的文件夹复制到项目中的相同结构下。(例如将 `24CXX` 放到 `HARDWARE`下)
2. 在 Keil 中,右击放入的目录(`HARDWARE`),选择 _Add Existing Files to Group..._,选中库内的 `*.c` 文件。
3. 点开工具栏 `Options for Target`,选择 `C/C++`,在 `Include Paths` 中仿照例子添加库的路径。
## 代码介绍
> 不指明版本时,默认为 HAL 库版本
> Keil 使用的代码编码为 _GB2312_,而此处使用 _UTF-8_ 编码。
<!-- prettier-ignore -->
|代码名 | 代码介绍 |
|---|---|
|1.c|跑马灯实验(寄存器版本)|
|2.c|跑马灯实验 |
|3.c|按键输入实验 |
|4.c|外部中断实验 |
|5.c|电容触摸按键实验 |
|6.c|光照&接近传感器实验外部中断实验 |
|7.*.c|定时器中断实验 |
|8.c|PWM 输出实验 |
|9.c|IIC 实验 |
|10.c|SPI 实验 |
|11.*.c|网络通信实验 |
|12.*.c|综合实验 |
## 报告介绍
使用 [typst](https://github.com/typst/typst) v0.10.0 写成。只放源码,不放 pdf,请自行生成。
### 报告要求
每次实验做两个项目,写成一份报告,每两周交一次(两份)报告。(11,12 耗时更长一点)
修改后的代码需要注明“修改后”!修改前的代码可以放上去也可以不放。
理论上每份报告只需要一个心得体会,我从逻辑上考虑,将其分为两个,放到两个项目里。
|
https://github.com/Mc-Zen/quill | https://raw.githubusercontent.com/Mc-Zen/quill/main/examples/phase-estimation.typ | typst | MIT License | #import "../src/quill.typ": *
#quantum-circuit(
setwire(0), lstick(align(center)[First register\ $t$ qubits], n: 4, pad: 10.5pt),
lstick($|0〉$), setwire(1), $H$, 4, midstick($ dots $), ctrl(4), rstick($|0〉$), [\ ], 10pt,
setwire(0), phantom(width: 13pt), lstick($|0〉$), setwire(1), $H$, 2, ctrl(3), 1,
midstick($ dots $), 1, rstick($|0〉$), [\ ],
setwire(0), 1, lstick($|0〉$), setwire(1), $H$, 1, ctrl(2), 2,
midstick($ dots $), 1, rstick($|0〉$), [\ ],
setwire(0), 1, lstick($|0〉$), setwire(1), $H$, ctrl(1), 3, midstick($ dots $), 1,
rstick($|0〉$), [\ ],
setwire(0), lstick([Second register], n: 1, brace: "{", pad: 10.5pt), lstick($|u〉$),
setwire(4, wire-distance: 1.3pt), 1, $ U^2^0 $, $ U^2^1 $, $ U^2^2 $,
1, midstick($ dots $), $ U^2^(t-1) $, rstick($|u〉$)
) |
https://github.com/pedrofp4444/BD | https://raw.githubusercontent.com/pedrofp4444/BD/main/report/content/[5] Implementação Física/calculoEspaço.typ | typst | #let calculoEspaço = {
[
== Cálculo do espaço da base de dados (inicial e taxa de crescimento anual)
De forma a perceber o espaço que a base de dados pode vir a ocupar, calculamos inicialmente o mesmo quando existe apenas um registo por tabela e, numa fase final, estimou-se o espaço total necessário para armazenar toda a informação contida na base de dados, assim como a informação que surgirá com um determinado crescimento anual esperado.
Assim, representa-se, a seguir, uma tabela que evidencia os tipos de dados usados no sistema, acompanhados pelos seus tamanhos respetivos em bytes, de acordo com o manual de referência do MySQL 8.0 /*Falta aqui a referência que devem colocar na bibliografia*/.
#figure(
caption: "Tipos de dados utilizados e o seu respetivo tamanho em bytes.",
kind: table,
table(
columns: (0.3fr, 0.5fr),
stroke: (thickness: 0.5pt),
align: horizon,
fill: (x, y) => if y == 0 { gray.lighten(50%) },
table.header([*Tipo de dados*], [*Tamanho (bytes)*]),
[INT], [4],
/* - */
[DATE], [3],
/* - */
[TEXT], [L + 2 bytes, onde L < 2#super[16]],
/* - */
[VARCHAR(M)], [L + 1 bytes caso a coluna necessite 0 − 255 bytes],
/* - */
[ENUM('valor1','valor2',...)], [1 ou 2 bytes, dependendo no número de valores enumerados (máximo de 65,535 valores)]
)
)
\
Seguidamente, representam-se os espaços ocupados por cada tabela, em bytes, para quando existe apenas um registo na mesma.
#figure(
caption: "Espaço ocupado pela tabela Funcionário com um registo.",
kind: table,
table(
columns: (0.3fr, 0.9fr, 0.6fr, 1.2fr),
stroke: (thickness: 0.5pt),
align: horizon,
fill: (x, y) => if y == 0 { gray.lighten(50%) },
table.header([*Tabela*], [*Nome da coluna*], [*Tipo de dado*], [*Tamanho (bytes)*]),
table.cell(
rowspan: 7,
align: horizon,
rotate(-90deg, reflow: true)[
Funcionário
],
),
/* - */
["Funcionário_ID"], [INT], [4],
/* - */
["Nome"], [VARCHAR(75)], [76],
/* - */
[“Data_de_nascimento”], [DATE], [3],
/* - */
["Salário"], [INT], [4],
/* - */
["NIF"], [VARCHAR(10)], [11],
/* - */
["Fotografia"], [VARCHAR(150)], [151],
/* - */
["Função_ID"], [INT], [4],
/* - */
[*Total*], [-], [-], [*253*],
)
)
\
#figure(
caption: "Espaço ocupado pela tabela Número de Telemóvel com um registo.",
kind: table,
table(
columns: (0.3fr, 0.9fr, 0.6fr, 1.2fr),
stroke: (thickness: 0.5pt),
align: horizon,
fill: (x, y) => if y == 0 { gray.lighten(50%) },
table.header([*Tabela*], [*Nome da coluna*], [*Tipo de dado*], [*Tamanho (bytes)*]),
table.cell(
rowspan: 2,
align: horizon,
rotate(-90deg, reflow: true)[
Número de Telemóvel
],
),
/* - */
["Número_de_Telemóvel"], [INT], [4],
/* - */
["Funcionário_ID], [INT], [4],
/* - */
[*Total*], [-], [-], [*8*],
)
)
\
#figure(
caption: "Espaço ocupado pela tabela Função com um registo.",
kind: table,
table(
columns: (0.3fr, 0.9fr, 0.6fr, 1.2fr),
stroke: (thickness: 0.5pt),
align: horizon,
fill: (x, y) => if y == 0 { gray.lighten(50%) },
table.header([*Tabela*], [*Nome da coluna*], [*Tipo de dado*], [*Tamanho (bytes)*]),
table.cell(
rowspan: 2,
align: horizon,
rotate(-90deg, reflow: true)[
Função
],
),
/* - */
["Função_ID"], [INT], [4],
/* - */
["Designação"], [ENUM(“Representante”, “Detetive”, “Operacional”)], [1],
/* - */
[*Total*], [-], [-], [*5*],
)
)
\
#figure(
caption: "Espaço ocupado pela tabela Gere com um registo.",
kind: table,
table(
columns: (0.3fr, 0.9fr, 0.6fr, 1.2fr),
stroke: (thickness: 0.5pt),
align: horizon,
fill: (x, y) => if y == 0 { gray.lighten(50%) },
table.header([*Tabela*], [*Nome da coluna*], [*Tipo de dado*], [*Tamanho (bytes)*]),
table.cell(
rowspan: 2,
align: horizon,
rotate(-90deg, reflow: true)[
Gere
],
),
/* - */
["Funcionário_ID"], [INT], [4],
/* - */
["Funcionário_Gestor_ID"], [INT], [4],
/* - */
[*Total*], [-], [-], [*8*],
)
)
\
#figure(
caption: "Espaço ocupado pela tabela Terreno com um registo.",
kind: table,
table(
columns: (0.3fr, 0.9fr, 0.6fr, 1.2fr),
stroke: (thickness: 0.5pt),
align: horizon,
fill: (x, y) => if y == 0 { gray.lighten(50%) },
table.header([*Tabela*], [*Nome da coluna*], [*Tipo de dado*], [*Tamanho (bytes)*]),
table.cell(
rowspan: 3,
align: horizon,
rotate(-90deg, reflow: true)[
Terreno
],
),
/* - */
["Terreno_ID"], [INT], [4],
/* - */
["Minério_previsto"], [INT], [4],
/* - */
[“Minério_coletado”], [INT], [4],
/* - */
[*Total*], [-], [-], [*12*],
)
)
\
#figure(
caption: "Espaço ocupado pela tabela Caso com um registo.",
kind: table,
table(
columns: (0.3fr, 0.9fr, 0.6fr, 1.2fr),
stroke: (thickness: 0.5pt),
align: horizon,
fill: (x, y) => if y == 0 { gray.lighten(50%) },
table.header([*Tabela*], [*Nome da coluna*], [*Tipo de dado*], [*Tamanho (bytes)*]),
table.cell(
rowspan: 6,
align: horizon,
rotate(-90deg, reflow: true)[
Caso
],
),
/* - */
["Caso_ID"], [INT], [4],
/* - */
["Data_de_abertura"], [DATE], [3],
/* - */
[“Estado”], [ENUM(“Aberto”, “Fechado”)], [1],
/* - */
["Estimativa_de_roubo"], [INT], [4],
/* - */
["Data_de_encerramento"], [DATE], [3],
/* - */
["Terreno_ID"], [INT], [4],
/* - */
[*Total*], [-], [-], [*19*],
)
)
\
#figure(
caption: "Espaço ocupado pela tabela Trabalha com um registo.",
kind: table,
table(
columns: (0.3fr, 0.9fr, 0.6fr, 1.2fr),
stroke: (thickness: 0.5pt),
align: horizon,
fill: (x, y) => if y == 0 { gray.lighten(50%) },
table.header([*Tabela*], [*Nome da coluna*], [*Tipo de dado*], [*Tamanho (bytes)*]),
table.cell(
rowspan: 2,
align: horizon,
rotate(-90deg, reflow: true)[
Trabalha
],
),
/* - */
["Funcionário_ID"], [INT], [4],
/* - */
["Terreno_ID"], [INT], [4],
/* - */
[*Total*], [-], [-], [*8*],
)
)
\
#figure(
caption: "Espaço ocupado pela tabela Suspeito com um registo.",
kind: table,
table(
columns: (0.3fr, 0.9fr, 0.6fr, 1.2fr),
stroke: (thickness: 0.5pt),
align: horizon,
fill: (x, y) => if y == 0 { gray.lighten(50%) },
table.header([*Tabela*], [*Nome da coluna*], [*Tipo de dado*], [*Tamanho (bytes)*]),
table.cell(
rowspan: 5,
align: horizon,
rotate(-90deg, reflow: true)[
Suspeito
],
),
/* - */
["Funcionário_ID"], [INT], [4],
/* - */
["Caso_ID"], [INT], [4],
/* - */
[“Estado”], [ENUM(“Inocente”, “Em Investigação”, “Culpado”)], [1],
/* - */
["Envolvimento"], [INT], [4],
/* - */
["Notas"], [TEXT(256)], [258],
/* - */
[*Total*], [-], [-], [*271*],
)
)
Com esta configuração, o espaço total ocupado pelas tabelas, preenchidas com um registo cada, seria igual a 584 bytes.
\
Após o povoamento inicial, a base de dados conta com 100 funcionários registados, dos quais 3 são representantes e 10 são detetives. Cada funcionário tem, em média, 2 números de telemóvel e, geralmente, trabalha em 2 terrenos. Neste caso, existem 11 terrenos distintos e um total de 13 casos ativos, dos quais são suspeitos, em média, 18 funcionários. Para além disso, cada representante é responsável por gerir uma parte dos restantes 97 funcionários, neste caso, um dos representantes gere os 10 detetives e os outros dois gerem, respetivamente, 40 e 47 funcionários operacionais. Deste modo, é possível calcular o espaço total ocupado pelas tabelas na primeira implementação do sistema de gestão de base de dados.
\
#figure(
caption: "Espaço total ocupado pelas tabelas com o povoamento inicial.",
kind: table,
table(
columns: (0.3fr, 0.3fr, 0.3fr),
stroke: (thickness: 0.5pt),
align: horizon,
fill: (x, y) => if y == 0 { gray.lighten(50%) },
table.header([*Tabela*], [*Quantidade de registos*], [*Tamanho da tabela (bytes)*]),
/* - */
[Funcionário], [100], [25300],
/* - */
[Número de Telemóvel], [200], [1600],
/* - */
[Função], [100], [500],
/* - */
[Gere], [97], [776], /*Aqui é a parte que o Hélder comentou no discord.*/
/* - */
[Terreno], [11], [132],
/* - */
[Caso], [13], [247],
/* - */
[Trabalha], [200], [1600],
/* - */
[Suspeito], [234], [63414],
/* - */
[*Total*], [-], [*93569*],
)
)
\
Com base nas estatísticas anuais fornecidas pela empresa _Lusium_, é esperado que o número de funcionários e o número de terrenos aumente em 20% e 27%, respetivamente. Por outro lado, é expectável que surjam, em média, 7 novos casos por ano. Com isto, prevemos que no primeiro ano as tabelas vão ter, respetivamente, as seguintes variações:
#figure(
caption: "Variações do espaço ocupado pelas tabelas após um ano.",
kind: table,
table(
columns: (0.3fr, 0.3fr, 0.3fr),
stroke: (thickness: 0.5pt),
align: horizon,
fill: (x, y) => if y == 0 { gray.lighten(50%) },
table.header([*Tabela*], [*Quantidade de registos*], [*Diferença da tabela (bytes)*]),
/* - */
[Funcionário], [+20], [+5060],
/* - */
[Número de Telemóvel], [+40], [+320],
/* - */
[Função], [+20], [+100],
/* - */
[Gere], [+20], [+160], /*Aqui é a parte que o Hélder comentou no discord.*/
/* - */
[Terreno], [+3], [+36],
/* - */
[Caso], [+7], [+133],
/* - */
[Trabalha], [+40], [+320],
/* - */
[Suspeito], [+119], [+32249],
/* - */
[*Total*], [-], [*+38378*],
)
)
\
Como foi evidenciado nas tabelas, o espaço necessário mínimo para a primeira implementação da base de dados seria de *93.6 _KBytes_*, com um crescimento anual de *41%*, em que no primeiro ano é traduzido por um aumento de *38.4 _KBytes_*.
]
}
|
|
https://github.com/cric96/typst-slides-template | https://raw.githubusercontent.com/cric96/typst-slides-template/master/slides-template.typ | typst | Apache License 2.0 | #import "@preview/polylux:0.3.1": *
#import "@preview/fontawesome:0.1.0": *
#import themes.metropolis: *
#show: metropolis-theme.with(
aspect-ratio: "16-9",
footer: [Optional Footnote]
)
#set text(font: "Inter", weight: "light", size: 20pt)
#show math.equation: set text(font: "Fira Math")
#set strong(delta: 150)
#set par(justify: true)
#set raw(tab-size: 4)
#show raw.where(block: true): block.with(
fill: luma(240),
inset: 1em,
radius: 0.7em,
width: 100%,
)
#title-slide(
title: "Slide Title",
subtitle: "Subtitle",
author: "<NAME>",
date: datetime.today().display("[day] [month repr:long] [year]"),
)
#new-section-slide("Slide section 1")
#slide(title: "Slide")[
*Bold* and _italic_ text.
This is a citiation @nicolas_farabegoli_2024_10535841.
#alert[
This is an alert.
]
]
#slide(title: "Code slide")[
```kotlin
fun main() {
println("Hello, world!")
for (i in 0..9) {
println(i)
}
println("Goodbye, world!")
}
```
]
#slide[
= This is a title
#lorem(24)
== This is a subtitle
#lorem(34)
]
#slide[
== Icon in a title #fa-java()
#fa-icon("github", fa-set: "Brands") -- Github icon
#fa-icon("github", fa-set: "Brands", fill: blue) -- Github icon blue fill
]
#slide[
#bibliography("bibliography.bib")
]
|
https://github.com/alberto-lazari/computer-science | https://raw.githubusercontent.com/alberto-lazari/computer-science/main/advanced-topics-pl/presentation/sections/code-mode.typ | typst | #import "/common.typ": *
#new-section("Code mode")
#slide(title: "Type system")[
- Dynamic typing
- Few implicit conversions (`string` #sym.arrow `content`)
- No custom types
- No subtyping
]
#slide(title: "Types")[
- `content` $tilde.eq top$ #show: pause(2); ($eq.not$ `any`)
#line-by-line(start: 3)[
- `none` $=$ $bot$
- programming (`integer`, `boolean`, `string`, `function`, ...)
- data structures (`array`, `dictionary`)
- styling (`length`, `angle`, `color`, ...)
]
]
#slide(title: "Unique copies")[
No _reference_ types, only _value_ types
#align(center, block(width: 40%, example[
```typst
#let array = (1, 2, 3)
#let copy = array
#copy.push(4)
Array = #array \
Copy = #copy
```
]))
]
#slide(title: "Functions")[
#line-by-line[
- First class values
- Closures
- Pure (user-defined)
]
]
#slide(title: [Functions -- examples])[
#let example = example.with(size: .8em)
#align(center, grid(
columns: (1fr, 1fr, 1fr),
gutter: 1em,
example(caption: "Closure")[
```typst
#{
let var = 1
let f(x) = { x + var }
var = 10
f(1)
}
```
],
{
show: pause(2)
example(caption: "Pure", error: "variables from outside the function are read-only and cannot be modified")[
```typst
#{
let var = 1
let g() = { var += 1 }
g()
}
```
]
},
{
show: pause(3)
example(caption: "First class value")[
```typst
#{
let curried-map = f => (..l) => {
l.pos().map(f)
}
curried-map(x => x + 1)(0, 1, 2)
}
```
]
},
))
]
#slide(title: [Functions -- recursive let binding])[
#let example = example.with(size: .8em)
#align(center, grid(
columns: (1fr, 1fr),
gutter: 1.5em,
example[
```typst
#{
let map(f, ..items) = {
let list = items.pos()
if list.len() == 0 { return list }
let (x, ..rest) = list
( f(x), ..map(f, ..rest) )
}
map(x => x + 1, 0, 1, 2)
}
```
],
{
only(2)[
#example(error: "unknown variable: map")[
```typst
#{
let map = f => (..items) => {
let list = items.pos()
if list.len() == 0 { return list }
let (x, ..rest) = list
( f(x), ..map(f)(..rest) )
}
map(x => x + 1)(0, 1, 2)
}
```
]
]
only(3)[
#example[
```typst
#{
let map = {
let rec = map => f => (..items) => {
let list = items.pos()
if list.len() == 0 { return list }
let (x, ..rest) = list
( f(x), ..map(map)(f)(..rest) )
}
rec(rec)
}
map(x => x + 1)(0, 1, 2)
}
```
]
]
}
))
]
#slide(title: "Parameters")[
#line-by-line[
- Positional: ```typst #f(x, y)```
- Currying (not idiomatic): ```typst #g(x)(y)```
- Variadic: ```typst #let h(..args) = { ... }```
- Named: ```typst #text("hello", color: red)```
]
]
#slide(title: "Named parameters")[
#set text(size: .7em)
#grid(
columns: (3fr, 4fr),
[
= Typst
```typst
#text(color: red, "text")
// Order-independent
#text("text", color: red)
// Optional
#text("text")
```
],
uncover(2)[
= #latex
```latex
\inputminted[lineos, bgcolor=gray]{rust}{ex.rs}
% Order-independent
\inputminted[bgcolor=gray, lineos]{rust}{ex.rs}
% Optional
\inputminted{rust}{ex.rs}
```
]
)
]
#slide(title: [#latex -- optional parameters])[
#set text(size: .7em)
#grid(
columns: (2fr, 1fr, 2fr),
gutter: 1em,
[
#v(1.5em)
```latex
\newcommand{\mysum}[2][n]{
\sum_{i = 0}^#1 #2
}
$$
\mysum{x_i}
\mysum[\infty]{x_i}
$$
```
],
{ v(5em); align(center, $==>$) },
example[
```typst
#let mysum(exp, limit: $n$) = {
$sum_(i = 0)^limit exp$
}
$
#mysum($x_i$)
#mysum($x_i$, limit: $infinity$)
$
```
]
)
]
#slide(title: [#latex -- multiple optional parameters])[
#set text(size: .6em)
#grid(
columns: (3fr, 1fr, 5fr),
gutter: 1em,
[
#v(2em)
```latex
% Missing { inserted.
\newcommand{\mysum}[3][i][n]{
\sum_{#1 = 0}^#2 #3
}
$$
\mysum{x_i}
\mysum[j][\infty]{x_j}
$$
```
],
{ v(6em); align(center, $==>$) },
example[
```typst
#let mysum(exp, index: $i$, limit: $n$) = {
$sum_(index = 0)^limit exp$
}
$
#mysum($x_i$)
#mysum($x_j$, index: $j$, limit: $infinity$)
$
```
]
)
]
#slide(title: "Partial application")[
#let example = example.with(size: .8em)
#example[
```typst
#{
let mysum(exp, index: $i$, limit: $n$) = $sum_(index = 0)^limit exp$
mysum = mysum.with(limit: $infinity$)
$ #mysum($x_i$) $
let mysum = mysum.with(limit: $4$, index: $x$)
$ #mysum($x$) = 0 + 1 + ... + 4 = 10 $
}
```
]
]
|
|
https://github.com/han0126/MCM-test | https://raw.githubusercontent.com/han0126/MCM-test/main/2024亚太杯typst/main.typ | typst | #import "template/template.typ": *
#import "template/template.typ": template as APMCM
#show: APMCM.with(
abstract: [
洪水是全球造成重大经济损失和人员伤亡的自然灾害之一。有效预测和减轻其影响,本文综合分析了多项指标数据,并构建了*预测模型*。基于季风强度、地形排水等因素,通过数据清洗和相关性分析筛选出关键指标。运用各种神经网络模型,构建洪水预警模型,洪水概率预测模型。在数据分析部分,我们采用Python 软件的Seaborn 库,制作热力图、柱状图、折线图等*可视化*工具展示不同指标之间的相关性和分布特征。
针对问题一,基于`train.csv`数据集,分析20 个不同指标与洪水概率的相关性。通过*相关性分析*以及可视化,提出了一系列洪水提前预防的建议,包括加强降水量和河流流量的实时监测、土壤湿度监测与调节、气象预报与警报系统的优化、防洪基础设施建设以及公众教育和应急演练。这些措施将有助于提高洪水预警的准确性和及时性,减轻洪水灾害的影响。
对于问题二,我们将`train.csv`中的洪水发生概率进行聚类分析,以识别高、中、低风险的洪水事件。首先,使用K-means 聚类算法将数据分为三类,接着用XGBoost 算法构建预警模型。最后,通过交叉验证的方法,进行模型的灵敏度分析,得出验证出的模型准确率为96.515%。。
针对问题三,基于问题1 中的指标分析结果,我们从20 个指标中选取5 个关键指标,建立洪水概率的预测模型。本组采用MLP 神经网络模型来对选取的指标数据进行分析。通过利用测试集中的数据,*MLP 神经网络*使用反向传播算法来优化网络参数,以最小化预测输出与实际输出之间的误差。最终,我们验证模型的准确性,达到99.97%,证明其能够有效地预测洪水发生的概率,为实际防洪提供了科学依据。
对于问题四,基于问题3 中建立的洪水发生概率预测模型,我们对`test.csv`中的所有事件进行了洪水概率预测,并将预测结果填入`submit.csv`。进一步绘制了74 万件事件的洪水发生概率的直方图和折线图,我们根据Kolmogorov-Smirnov 方法检验预测值洪水概率是否服从正态分布。
本文的研究结果不仅揭示了影响洪水发生的主要因素,还提供了一种有效的洪水预测方法,对防灾减灾具有重要的指导意义。未来的工作将进一步优化模型,并结合实时监测数据,提高预测的实时性和精确度。
],
title: "基于机器学习的洪水灾害预测模型",
keywords: ("洪水灾害预测", "可视化", "相关性分析", "K-means聚类","MLP神经网络")
)
#include "chapter/chapter1.typ"
#include "chapter/chapter2.typ"
#include "chapter/chapter3.typ"
#include "chapter/chapter4.typ"
#include "chapter/chapter5.typ"
#include "chapter/chapter6.typ"
#include "chapter/chapter7.typ"
#include "chapter/chapter8.typ"
= 参考文献
#bibliography("refr.bib", title: none, style: "gb-7714-2015-numeric")\
#include "chapter/appendix.typ" |
|
https://github.com/DJmouton/Enseignement | https://raw.githubusercontent.com/DJmouton/Enseignement/main/SNT/Réseaux sociaux/Activité charactéristique et revenu des réseaux sociaux.typ | typst | #import "/Templates/layouts.typ": SNT, titre, sous_titre
#import "/Templates/utils.typ": pointillets
#show: doc => SNT(doc)
#sous_titre[SNT - Réseaux Sociaux - Activité 1]
#titre[Charactéristiques et revenus #linebreak() des réseaux sociaux]
En 2024, environ 50,7 millions de Français étaient actifs sur les réseaux sociaux. Un utilisateur y passe en moyenne 1h48 chaque jour ! Voici 9 réseaux sociaux parmi les plus utilisés en France.
=== 1. Compléter le tableau suivant en vérifiant les informations sur le web
#let fond_titre_table = luma(220)
#set table.cell(inset: (top: 8pt))
#table(
columns: (1fr, 2fr, 2fr, 2fr),
table.cell(fill: fond_titre_table, [*Nom du réseau social*]),
table.cell(fill: fond_titre_table, [*Contenu(s) échangé(s) sur le réseau entre ses utilisateurs*]),
table.cell(fill: fond_titre_table, [*Peut-on "noter", "liker" ou "aimer" les commentaires ?*]),
table.cell(fill: fond_titre_table, [*Membres du réseau: contacts, amis, followers ?*]),
[Facebook], "Messages, photos, vidéos", pointillets, pointillets,
[Youtube], pointillets, pointillets, pointillets,
[WhatsApp], pointillets, pointillets, pointillets,
[Instagram], pointillets, pointillets, pointillets,
[TikTok], pointillets, pointillets, pointillets,
[Snapchat], pointillets, pointillets, pointillets,
[X (Twitter)], pointillets, pointillets, [Followers, amis],
[Linkedin], pointillets, "Oui: bouton j'aime", pointillets,
[Pinterest], pointillets, pointillets, pointillets,
)
=== 2. Entourer, dans le tableau, le nom des réseaux sociaux que vous utilisez.
=== 3. Rechercher sur le Web trois sources de revenus des entreprises privées de réseaux sociaux.
#pointillets
#pointillets
=== 4. a. Choisir une des sept entreprises citées plus haut, puis rechercher sur le Web son chiffre d'affaires annuel et son nombre d'utilisateurs "actifs".
#v(1em)
#line(stroke: (dash: "dotted"), length: 100%)
=== b. Calculer le revenu moyen annuel par utilisateur en calculant le quotient $frac("chiffre d'affaires", "nombre d'inscrits actifs")$. Commentez ce chiffre : vous semble-t-il élevé ?
#pointillets
#pointillets
=== c. Comment expliquer la rentabilité de ces entreprises ?
#pointillets
#pointillets
=== 5. Commenter le slogan : "Quand c'est gratuit, c'est vous le produit !"
#pointillets
#pointillets |
|
https://github.com/KanarekLife/CV | https://raw.githubusercontent.com/KanarekLife/CV/main/cv.typ | typst | #set document(
title: "<NAME> CV",
author: "<NAME>"
)
#set page(
paper: "a4",
margin: .75cm,
)
#set text(
font: "Inter",
size: 10pt,
tracking: 0.2pt,
)
#let yearsOfExperience() = {
let today = datetime.today()
let startDate = datetime(year: 2022, month: 07, day: 01)
let days = (today - startDate).days()
let years = days / 365.5
return calc.floor(years * 2) / 2
}
#let header() = [
#let contact-item(icon, url, body) = [
#link(url)[
#stack(
dir: ltr,
image(icon, width: 12pt),
h(4pt),
align(horizon)[#text(size: 11pt)[#body]]
)
]
]
#let spacing = 10pt
#stack(
dir: ttb,
stack(
dir: ltr,
text(size: 20pt, weight: "bold")[= <NAME>],
h(1fr),
align(center, stack(
dir: ltr,
image("icons/map-pin.svg", width: 12pt),
h(4pt),
align(horizon)[#text(size: 11pt)[Gdańsk, Poland]]
))
),
v(17.5pt),
text(size: 11pt)[*Full-Stack Software Engineer* with #yearsOfExperience() years of experience in *.NET Backend Development*.]
)
#v(-7.5pt)
#stack(
dir: ltr,
contact-item("icons/github.svg", "https://github.com/KanarekLife")[KanarekLife],
h(spacing),
contact-item("icons/linkedin.svg", "https://linkedin.com/in/stanislaw-nieradko")[<NAME>],
h(spacing),
contact-item("icons/globe.svg", "https://nieradko.com")[nieradko.com],
h(spacing),
contact-item("icons/mail.svg", "mailto:<EMAIL>")[<EMAIL>],
h(spacing),
contact-item("icons/phone.svg", "tel:+48506257727")[506 257 727]
)
#v(10pt)
]
#let experience() = [
== Experience
#list(
[
#stack(
dir: ltr,
text(size: 12pt, weight: "semibold")[Aspire Systems],
h(1fr),
align(bottom, "Gdańsk, Poland")
)
#grid(
columns: (auto, 1fr, auto),
row-gutter: 7pt,
[#text(size: 10pt, weight: "bold")[Engineer]], [], [01.2024 -- now],
[#text(size: 10pt, weight: "bold")[Associate Engineer]], [], [10.2022 -- 12.2023],
[#text(size: 10pt, weight: "bold")[Trainee]], [], [07.2022 -- 09.2022],
)
#v(7.5pt)
- Worked on the backend for a complex enterprise back-office and client-facing booking application for a client in the beauty sector. The older system was based on .NET Framework 4.8 and hosted on Azure Web Apps, whereas the new system was based on .NET 6 and hosted on Kubernetes. Both systems were tightly integrated with Azure services for database hosting, storage, and messaging.
- Excluding backend I contributed to both the frontend and the infrastructure sides of the project. This included being responsible for the older Angular frontend, occasionally assisting with the newer Angular frontend, as well as managing the Docker and Kubernetes infrastructure.
- Refactored and improved the existing codebase, making it more maintainable and easier to work with. This involved fixing numerous bugs, improving performance, updating dependencies, and enhancing the development experience.
- Assisted and advised other developers (both from my team and others) in their work. This included conducting code reviews, engaging in pair programming sessions, and helping them with analysis of their tasks.
]
)
]
#let achievements() = [
== Achievements
#list(
tight: false,
spacing: 8pt,
[
#stack(
dir: ttb,
text(size: 12pt, weight: "semibold")[Aspire Systems Rookie of the Year 2023],
v(7.5pt),
["Award for the best performance among all new employees in 2023."]
)
I received the 'Rookie of the Year 2023' award for my performance in 2023. The reasons for receiving the award included my technical skills, assistance to others, and my ability to consistently deliver high-quality work in a timely manner.
],
[
#stack(
dir: ttb,
text(size: 12pt, weight: "semibold")[HackHeroes 2020],
v(7.5pt),
["$2^op("nd")$ place in Poland-wide hackathon for high school students."]
)
I coordinated a team of four people in building the JedzenioPlanner project for a HackHeroes 2020 hackathon. During the project, I assembled the team, divided tasks, and co-developed its back-end. The project secured second place, despite facing a record number of competitors from all over Poland.
]
)
]
#let certifications() = [
== Certifications
#list(
tight: false,
spacing: 10pt,
[
#stack(
dir: ttb,
text(size: 12pt, weight: "semibold")[Microsoft Certified: Azure Fundamentals (AZ-900)],
v(5pt),
[Microsoft, May 2024]
)
],
[
#stack(
dir: ttb,
text(size: 12pt, weight: "semibold")[FCE (First Certificate in English) - C1],
v(5pt),
[Cambridge Assessment, June 2021]
)
]
)
]
#let education() = [
== Education
#list(
[
#stack(
dir: ttb,
text(size: 12pt, weight: "semibold")[BSc in Computer Science],
v(5pt),
[Gdańsk University of Technology],
v(5pt),
[2022 -- now]
)
]
)
]
#let skills() = [
== Skills
#list(
tight: false,
spacing: 10pt,
[
#text(size: 10pt, weight: "bold")[.NET Backend Development]
- C\# (.NET Framework 4.8 and .NET 8)
- ASP.NET and ASP.NET Core
- Entity Framework and Entity Framework Core
- T-SQL and MSSQL Server
- Good knowledge of architectural patterns, best practices and design principles
- Experience in integrating with Azure services
],
[
#text(size: 10pt, weight: "bold")[Frontend Development]
- HTML, CSS, TailwindCSS
- TypeScript for both NodeJS and browser environments
- Working knowledge of Angular and AngularJS
- Hobbyist experience with SvelteJS and Astro.build
],
[
#text(size: 10pt, weight: "bold")[DevOps]
- Docker
- Kubernetes
- Azure Cloud Services (Web Apps, Blob Storage, Service Bus, etc.)
- Azure DevOps and its CI/CD pipelines
- Linux Server Administration
- Scripting in Bash, Python and PowerShell
],
[
#text(size: 10pt, weight: "bold")[Languages]
#v(-5pt)
#grid(
columns: (auto, auto),
row-gutter: 5pt,
column-gutter: 10pt,
[- Polish], [(Native)],
[- English], [(C1)],
[- German], [(Basic)]
)
]
)
]
#let interests() = [
== Interests
Cloud Computing, Software Architecture, Computer Games, TV Series
]
#let footer() = [
#v(1fr)
#align(center, text(size: 8pt, weight: "light")[I hereby give consent for my personal data included in my application to be processed for the purposes of the recruitment process.])
]
#header()
#grid(
columns: (2fr, 1fr),
column-gutter: 30pt,
[
#experience()
#achievements()
#certifications()
],
[
#education()
#skills()
#interests()
]
)
#footer() |
|
https://github.com/MilanR312/ugent_typst_template | https://raw.githubusercontent.com/MilanR312/ugent_typst_template/main/template/methods/glos.typ | typst | MIT License | #import "@preview/glossarium:0.4.0": make-glossary, print-glossary, gls, glspl
// from glossary github
// https://github.com/ENIB-Community/glossarium/tree/master/examples/import-terms-from-yaml-file
#let glossary(files, title: "Glossary", full: false) = {
let read-glossary-entries(file) = {
let entries = yaml("../../" + file)
assert(
type(entries) == dictionary,
message: "The glossary at `" + file + "` is not a dictionary",
)
for (k, v) in entries.pairs() {
assert(
type(v) == dictionary,
message: "The glossary entry `" + k + "` in `" + file + "` is not a dictionary",
)
for key in v.keys() {
assert(
key in ("short", "long", "description", "group"),
message: "Found unexpected key `" + key + "` in glossary entry `" + k + "` in `" + file + "`",
)
}
assert(
type(v.short) == str,
message: "The short form of glossary entry `" + k + "` in `" + file + "` is not a string",
)
if "long" in v {
assert(
type(v.long) == str,
message: "The long form of glossary entry `" + k + "` in `" + file + "` is not a string",
)
}
if "description" in v {
assert(
type(v.description) == str,
message: "The description of glossary entry `" + k + "` in `" + file + "` is not a string",
)
}
if "group" in v {
assert(
type(v.group) == str,
message: "The optional group of glossary entry `" + k + "` in `" + file + "` is not a string",
)
}
}
return entries.pairs().map(((key, entry)) => (
key: key,
short: eval(entry.short, mode: "markup"),
long: eval(entry.at("long", default: ""), mode: "markup"),
desc: eval(entry.at("description", default: ""), mode: "markup"),
group: entry.at("group", default: ""),
file: file,
))
}
let entries = ()
if type(files) != array {
files = (files,)
}
for file in files {
let new = read-glossary-entries(file)
for entry in new {
let duplicate = entries.find((e) => e.key == entry.key)
if duplicate != none {
panic("Found duplicate key `" + entry.key + "` in files `" + entry.file + "` and `" + duplicate.file + "`")
}
}
entries += new
}
[= #title]
print-glossary(entries, show-all: full, disable-back-references: true)
} |
https://github.com/janlauber/bachelor-thesis | https://raw.githubusercontent.com/janlauber/bachelor-thesis/main/thesis.typ | typst | Creative Commons Zero v1.0 Universal | #import "thesis_template.typ": *
#import "common/titlepage.typ": *
#import "thesis_typ/disclaimer.typ": *
#import "thesis_typ/acknowledgement.typ": *
#import "thesis_typ/abstract_en.typ": *
#import "common/metadata.typ": *
#import "@preview/glossarium:0.4.1": *
#titlepage(
title: titleEnglish,
subtitle: subTitleEnglish,
degree: degree,
program: program,
advisor: advisor,
expert: expert,
author: author,
projectPartner: projectPartner,
submissionDate: submissionDate
)
#disclaimer(
title: titleEnglish,
degree: degree,
author: author,
submissionDate: submissionDate
)
#acknowledgement()
#abstract_en()
#show: project.with(
title: titleEnglish,
degree: degree,
program: program,
advisor: advisor,
expert: expert,
author: author,
submissionDate: submissionDate
)
#include("chapters/introduction.typ")
#pagebreak()
#include("chapters/literature_review.typ")
#pagebreak()
#include("chapters/methodology.typ")
#pagebreak()
#include("chapters/system_architecture_and_design.typ")
#pagebreak()
#include("chapters/implementation.typ")
#pagebreak()
#include("chapters/evaluation.typ")
#pagebreak()
#include("chapters/customer_use_cases.typ")
#pagebreak()
#include("chapters/discussion.typ")
#pagebreak()
#include("chapters/conclusion.typ")
|
https://github.com/Kasci/LiturgicalBooks | https://raw.githubusercontent.com/Kasci/LiturgicalBooks/master/GR_old/oktoich/Hlas1/1_Pondelok.typ | typst | #let V_Po = (
"HV": (
("", "Πανεύφημοι Μάρτυρες", "Τά πάντα παρήγαγες, τώ σώ, Λόγω καί τώ Πνεύματι, δι' αγαθότητα Κύριε, είτα πεποίηκας, λογικόν με ζώον, ίνα σου τό άγιον, δοξάζω Παντοδύναμε όνομα, εγώ δέ μάλιστα, τοίς αισχροίς μου έργοις πάντοτε, ατιμάζω, αλλά φείσαι δέομαι."),
("", "", "Γνώθί σου, ταλαίπωρε, ψυχή, τήν θείαν ευγένειαν, καί τήν Πατρίδα τήν άφθαρτον, καί σπεύδε πάντοτε, αγαθοεργίαις, ταύτην καταλήψασθαι, Μηδέν σε τών φθαρτών προσηλώσειε, τής άνω μοίρας εί, τό δέ σώμα γή, καί φθείρεται, μή νικήση τό χείρον τήν κρείττονα."),
("", "", "Δεύρο παναθλία μου ψυχή, πρός τόν υπεράγαθον, θερμοίς τοίς δάκρυσι πρόσελθε, τά πεπραγμένα σοι, πρό τής κρίσεώς σου, πάντα εξαγόρευσον, καί ίλεων τόν Κτίστην ταλαίπωρε, σαυτή απέργασαι, καί συγχώρησιν εξαίτησαι, πρίν τήν θύραν κλείση σοι ο Κύριος."),
("", "", "Ασώματοι Άγγελοι Θεού, θρόνω, παριστάμενοι, καί ταίς εκείθεν ελλάμψεσιν καταστραπτόμενοι, καί φωτοχυσίαις αιωνίως λάμποντες, καί φώτα χρηματίζοντες δεύτερα, Χριστώ πρεσβεύσατε, δωρηθήναι ταίς ψυχαίς ημών, τήν ειρήνην καί τό μέγα έλεος."),
("", "", "Αθάνατοι Άγγελοι ζωήν, όντως τήν ανώλεθρον, παρά τής πρώτης δεξάμενοι, ζωής πανόλβιοι, αϊδίου δόξης, καί σεπτοί θεάμονες, σοφίας αϊδίου γεγόνατε, φωτός πληρούμενοι καί λαμπάδες συστρεφόμεναι, αρμοζόντως, επαναδεικνύμενοι."),
("", "", "Αρχάγγελοι, Άγγελοι, Αρχαί, θρόνοι, Κυριότητες, τά Σεραφείμ εξαπτέρυγα, καί πολυόμματα, Χερουβείμ τά θεία, τής σοφίας όργανα, Δυνάμεις, Εξουσίαι θειόταται, Χριστώ πρεσβεύσατε, δωρηθήναι ταίς ψυχαίς ημών, τήν ειρήνην καί τό μέγα έλεος."),
("Θεοτοκίον", "", "Μαρία τό άμωμον καί νούν, πάντα υπερκείμενον, τής καθαρότητος όχημα, περικρατούμενον, πολλαίς αμαρτίαις, καί στενοχωρούμενον, πρός πλάτος μετανοίας με ίθυνον, πανσθενεστάτη σου προστασία, καί γάρ δύνασαι, οία Μήτηρ, τού πάντα ισχύοντος."),
),
"S": (
("", "", "Ότι τό πέλαγος πολύ, τών παραπτωμάτων μου Σωτήρ, καί δεινώς βεβύθισμαι ταίς πλημμελείαις μου, δός μοι χείρα σώσόν με, ως τώ Πέτρω ο Θεός καί ελέησόν με."),
("", "", "Ότι εννοίαις πονηραίς, καί έργοις καταδεδίκασμαι Σωτήρ, λογισμόν μοι δώρησαι, επιστροφής ο Θεός, ίνα κράζω, Σώσόν με, Ευεργέτα αγαθέ, καί ελέησόν με."),
("", "", "Τή πρεσβεία Κύριε, πάντων τών Αγίων, καί τής Θεοτόκου, τήν σήν ειρήνην δός ημίν, καί ελέησον ημάς, ως μόνος οικτίρμων."),
("Θεοτοκίον", "", "Τών ουρανίων Ταγμάτων τό αγαλλίαμα, τών επί γής ανθρώπων, κραταιά προστασία, άχραντε Παρθένε, σώσον ημάς, τούς εις σέ καταφεύγοντας, ότι εν σοί τάς ελπίδας μετά Θεόν, Θεοτόκε ανεθέμεθα."),
),
)
#let U_Po = (
"S1": (
("", "", "Ἐν ἀνομίαις συλληφθεὶς ἐγὼ ὁ ἄσωτος, οὐ τολμῶ ἀτενίσαι εἰς τὸ ὕψος τοῦ οὐρανοῦ, ἀλλὰ θαρρῶν εἰς τὴν φιλανθρωπίαν σου, κράζω, ὁ Θεὸς ἱλάσθητί μοι, καὶ σῶσόν με."),
("", "", "Εἰ ὁ δίκαιος μόλις σῴζεται, ἐγὼ ποῦ φανοῦμαι ὁ ἁμαρτωλός; τὸ βάρος καὶ τὸν καύσωνα τῆς ἡμέρας οὐκ ἐβάστασα· τοῖς περὶ τὴν ἑνδεκάτην ὥραν, συναρίθμησόν με, ὁ Θεός, καὶ σῶσόν με."),
("Θεοτοκίον", "", "Ἄχραντε Θεοτόκε, ἡ ἐν οὐρανοῖς εὐλογημένη, καὶ ἐπὶ γῆς δοξολογουμένη, χαῖρε Νύμφη ἀνύμφευτε."),
),
"S2": (
("", "Τὸν τάφον σου Σωτὴρ", "Ἀγκάλας πατρικάς, διανοῖξαί μοι σπεῦσον· ἀσώτως τὸν ἐμόν, κατηνάλωσα βίον· εἰς πλοῦτον ἀδαπάνητον, ἀφορῶν των οἰκτιρμῶν σου Σωτήρ, νῦν πτωχεύουσαν, μὴ ὑπερίδῃς καρδίαν· σοὶ γάρ,Κύριε, ἐν κατανύξει κραυγάζω· Ἥμαρτόν σοι σῶσόν με."),
("", "", "Τὸ βῆμά σου φρικτόν, καὶ ἡ κρίσις δικαία, τὰ ἔργα μου δεινά, ἀλλ’ αὐτὸς Ἐλεῆμον, προφθάσας με διάσωσον, καὶ κολάσεως λύτρωσαι· ῥῦσαι Δέσποτα, τῆς τῶν ἐρίφων μερίδος, καὶ ἀξίωσον, ἐκ δεξιῶν σου με στῆναι, Κριτὰ δικαιότατε."),
("Θεοτοκίον", "", "Κυβέρνησον Ἁγνή, τὴν ἀθλίαν ψυχήν μου, καὶ οἴκτειρον αὐτήν, ὑπὸ πλήθους πταισμάτων, βυθῷ ὀλισθαίνουσαν, ἀπωλείας Πανάμωμε, καὶ ἐν ὥρᾳ με, τῇ φοβερᾷ τοῦ θανάτου, ἐλευθέρωσον, κατηγορούντων δαιμόνων, φρικτῆς ἀποφάσεως."),
("Θεοτοκίον", "", ""),
),
"S3": (
("", "Τὸν τάφον σου Σωτὴρ", "Ἀφρόνως ἀπὸ σοῦ, μακρυνθεὶς Πανοικτίρμον, ἀσώτως τὸν ἐμόν, ἐδαπάνησα βίον, δουλεύων τοῖς πάθεσι, τοῖς ἀλόγοις ἑκάστοτε· ἀλλὰ δέξαι με, ταῖς τῶν Ἀγγέλων πρεσβείαις, Πάτερ εὔσπλαγχνε, ὥσπερ τὸν ἄσωτον παῖδα, καὶ σῶσόν με δέομαι."),
("Μαρτυρικὸν", "", "Ἀθλήσεως καύχημα, καὶ στεφάνων ἀξίωμα, οἱ ἔνδοξοι Ἀθλοφόροι, περιβέβληνταί σε Κύριε· καρτερίᾳ γὰρ αἰκισμῶν, τοὺς ἀνόμους ἐτροπώσαντο, καὶ δυνάμει θεϊκῇ, ἐξ οὐρανοῦ τὴν νίκην ἐδέξαντο. Αὐτῶν ταῖς ἱκεσίαις, ἐλευθέρωσον τοῦ ἀοράτου ἐχθροῦ Σωτήρ, καὶ σῶσόν με."),
("Θεοτοκίον", "Τὸν τάφον σου Σωτὴρ", "Ἀΰλων στρατιῶν, ὑπερέχουσα Κόρη, καὶ τάξεις οὐρανῶν, ὑπερβαίνουσα μόνη, ἐπάξιον τὴν αἴνεσιν, παρ’ αὐτῶν δέχῃ Πάναγνε· ἀλλὰ πρέσβευε, τῷ σῷ Υἱῷ σὺν Ἀγγέλοις, τοῦ ῥυσθῆναί με, τῆς τῶν παθῶν τυραννίδος, τὸν μόνον κατάκριτον."),
),
"K": (
"P1": (
"1": (
("", "", "Ὁ μόνος εἰδὼς τῆς τῶν βροτῶν, οὐσίας τὴν ἀσθένειαν, καὶ συμπαθῶς αὐτὴν μορφωσάμενος, περίζωσόν με ἐξ ὕψους δύναμιν, τοῦ βοᾷν σοι, Ἅγιος, ὁ ναὸς ὁ ἔμψυχος, τῆς ἀφράστου σου δόξης Φιλάνθρωπε."),
("", "", "Ἀνάνηψον δεῦρο, ὦ ψυχή, καὶ βόησον ἥμαρτον, τῷ τὰ κρυπτά σου πάντα γινώσκοντι, καὶ μετανοίας καρποὺς ἐπίδειξαι, ὅπως ἐλεήσῃ σε, ὁ οἰκτίρμων Κύριος, καὶ πυρὸς αἰωνίου λυτρώσηται."),
("", "", "Ἱλάσθητι μόνε Ἀγαθέ, ἱλάσθητι καὶ σῶσόν με, ὡς ὁ Τελώνης φόβῳ κραυγάζω σοι, ἐσμὸν πταισμάτων ἐπισυρόμενος, καὶ κατακαμπτόμενος, βάρει παραπτώσεων, καὶ αἰσχύνης ἀμέτρου πληρούμενος."),
("Μαρτυρικὰ", "", "Σοφίᾳ καὶ γνώσει ἀληθεῖ, οἱ Μάρτυρες πληρούμενοι, Ἑλληνικὴν σοφίαν ἐμώραναν, τὸν σοφιστήν τε κακίας ὤλεσαν, καὶ στερρῶς ἀθλήσαντες, ἐπαξίως ἔλαβον, τούς τῆς νίκης στεφάνους γηθόμενοι."),
("Μαρτυρικὰ", "", "Μονάδα μὲν φύσει ἀθληταί, Τριάδα τοῖς προσώποις δέ, ὁμολογοῦντες, πλάνην πολύθεον, ἐνθέῳ πίστει ἐξηφανίσατε, καὶ φωστῆρες ὤφθητε, πάντων καταυγάζοντες, τὰς καρδίας ἀκτῖσι τῆς χάριτος."),
("Θεοτοκίον", "", "Ἁγία Θεόνυμφε ἁγνή, ἁγίως ἀπεκύησας, τὸν ἐν Ἁγίοις ἀναπαυόμενον, Υἱὸν καὶ Λόγον, Πατρὶ συνάναρχον, τὸν καθαγιάζοντα ἐν Ἁγίῳ Πνεύματι, τοὺς αὐτὸν εὐσεβῶς ἁγιάζοντας."),
),
"2": (
("", "", "Σοῦ ἡ τροπαιοῦχος δεξιά"),
("", "", "Θρόνῳ παριστάμενοι φαιδρῶς, τῷ τοῦ Δεσπότου, πανάγιοι Ἄγγελοι, τὸν Πατρὶ συνάναρχον, καὶ τῆς αὐτοῦ μεγάλης βουλῆς Ἄγγελον, λόγον μοι ἐμπνεῦσαι, ὑμᾶς ὑμνοῦντι, πρεσβεύσατε."),
("", "", "Ἔσοπτρα φωτὸς θεαρχικοῦ, καὶ τρισηλίου λαμπάδος τὴν ἔλλαμψιν, πᾶσαν εἰσδεχόμενα, ὡς ἐφικτόν, τὰ τῶν Ἀγγέλων τάγματα, πρῶτον ἐννοήσας, ὁ Νοῦς ὁ θεῖος ὑπέστησεν."),
("Θεοτοκίον", "", "Ὁ διακοσμήσας ὡς Θεός, ταξιαρχίας τῶν ἄνω δυνάμεων, μήτραν ἀπειρόγαμον, τῶν Σεραφεὶμ ὑψηλοτέραν ᾤκησε, τὴν σὴν Θεοτόκε, καὶ σάρξ ἀτρέπτως ἐγένετο."),
),
),
"P3": (
"1": (
("", "", "Ὁ μόνος εἰδὼς τῆς τῶν βροτῶν, οὐσίας τὴν ἀσθένειαν, καὶ συμπαθῶς αὐτὴν μορφωσάμενος, περίζωσόν με ἐξ ὕψους δύναμιν, τοῦ βοᾷν σοι, Ἅγιος, ὁ ναὸς ὁ ἔμψυχος, τῆς ἀφράστου σου δόξης Φιλάνθρωπε."),
("", "", "Ἀνάνηψον δεῦρο, ὦ ψυχή, καὶ βόησον ἥμαρτον, τῷ τὰ κρυπτά σου πάντα γινώσκοντι, καὶ μετανοίας καρποὺς ἐπίδειξαι, ὅπως ἐλεήσῃ σε, ὁ οἰκτίρμων Κύριος, καὶ πυρὸς αἰωνίου λυτρώσηται."),
("", "", "Ἱλάσθητι μόνε Ἀγαθέ, ἱλάσθητι καὶ σῶσόν με, ὡς ὁ Τελώνης φόβῳ κραυγάζω σοι, ἐσμὸν πταισμάτων ἐπισυρόμενος, καὶ κατακαμπτόμενος, βάρει παραπτώσεων, καὶ αἰσχύνης ἀμέτρου πληρούμενος."),
("Μαρτυρικὰ", "", "Σοφίᾳ καὶ γνώσει ἀληθεῖ, οἱ Μάρτυρες πληρούμενοι, Ἑλληνικὴν σοφίαν ἐμώραναν, τὸν σοφιστήν τε κακίας ὤλεσαν, καὶ στερρῶς ἀθλήσαντες, ἐπαξίως ἔλαβον, τούς τῆς νίκης στεφάνους γηθόμενοι."),
("Μαρτυρικὰ", "", "Μονάδα μὲν φύσει ἀθληταί, Τριάδα τοῖς προσώποις δέ, ὁμολογοῦντες, πλάνην πολύθεον, ἐνθέῳ πίστει ἐξηφανίσατε, καὶ φωστῆρες ὤφθητε, πάντων καταυγάζοντες, τὰς καρδίας ἀκτῖσι τῆς χάριτος."),
("Θεοτοκίον", "", "Ἁγία Θεόνυμφε ἁγνή, ἁγίως ἀπεκύησας, τὸν ἐν Ἁγίοις ἀναπαυόμενον, Υἱὸν καὶ Λόγον, Πατρὶ συνάναρχον, τὸν καθαγιάζοντα ἐν Ἁγίῳ Πνεύματι, τοὺς αὐτὸν εὐσεβῶς ἁγιάζοντας."),
),
"2": (
("", "", "Ὁ μόνος εἰδὼς τῆς τῶν βροτῶν, οὐσίας τὴν ἀσθένειαν, καὶ συμπαθῶς αὐτὴν μορφωσάμενος, περίζωσόν με ἐξ ὕψους δύναμιν, τοῦ βοᾷν σοι, Ἅγιος, ὁ ναὸς ὁ ἔμψυχος, τῆς ἀφράστου σου δόξης Φιλάνθρωπε."),
("", "", "Φωτὶ θεουργῷ τὰ Σεραφείμ, ἀμέσως πλησιάζοντα, καὶ πολλαχῶς αὐτοῦ ἐμπιπλάμενα, ταῖς πρωτοδότοις σαφῶς ἐλλάμψεσι, πρωτουργῶς λαμπρύνονται, καὶ ὡς φῶτα δεύτερα, χρηματίζουσι θέσει θεούμενα."),
("", "", "Ἀγγέλων λαμπρότητας ὑμνεῖν, προθύμως ἐφιέμενοι, τὴν δι’ αὐτῶν θεόθεν βοήθειαν, χορηγουμένην πιστοί, αἰτήσωμεν, νοὸς καθαρότητι, καὶ πανάγνοις στόμασι, καὶ τευξόμεθα τούτων ἐλλάμψεως."),
("Θεοτοκίον", "", "Νοῦν τὸν ὑπερούσιον ἰδεῖν, ὡς θέμις ἀξιούμενος, ὁ Γαβριήλ, Παρθένε πανάμωμε, περιχαρῆ σοι φωνὴν ἐκόμισε, τὴν τοῦ Λόγου σύλληψιν, ἐμφανῶς μηνύων σοι, καὶ τὸν ἄφραστον τόκον κηρύττων σου."),
),
),
"P4": (
"1": (
("", "", "Ὄρος σε τῇ χάριτι, τῇ θείᾳ κατάσκιον, προβλεπτικοῖς ὁ Ἀββακούμ, κατανοήσας ὀφθαλμοῖς, ἐκ σοῦ ἐξελεύσεσθαι, τοῦ Ἰσραὴλ προανεφώνει τὸν Ἅγιον,εἰς σωτηρίαν ἡμῶν καὶ ἀνάπλασιν."),
("", "", "Τίνι σε, ψυχή μου, ὁμοιώσω ταλαίπωρε, ἐργαζομένην τὰ δεινά, καὶ μὴ ποιοῦσαν τὰ καλά; ἐπίστρεψον βόησον, τῷ διὰ σὲ ἐθελουσίως πτωχεύσαντι· Καρδιογνῶστα οἰκτείρησον σῶσόν με."),
("", "", "Ὥρισας μετάνοιαν, Σωτὴρ ἐπιστρέφουσιν, ἥν μοι παράσχου ἀγαθέ, πρὸ τῆς τοῦ βίου τελευτῆς, διδούς μοι κατάνυξιν καὶ στεναγμόν, ὥσπερ τῇ πόρνῃ τὸ πρότερον, καταφιλούσῃ τὰ ἴχνη σου Δέσποτα."),
("Μαρτυρικὰ", "", "Ναμάτων τοῦ Πνεύματος, πλησθέντες οἱ Μάρτυρες, ὕδατος ζῶντος ποταμοί, ὤφθησαν νεύσει θεϊκῇ, καὶ πλάνης ἐξήραναν, τοὺς θολεροὺς Χριστὲ χειμάρρους ἐν Πνεύματι, καὶ τῶν πιστῶν διανοίας κατήρδευσαν."),
("Μαρτυρικὰ", "", "Μεγάλως οἱ θεῖοι, ἠγωνίσαντο Μάρτυρες· πῦρ γὰρ καὶ ξίφος καὶ δεινήν, πᾶσαν ὑπήνεγκαν ποινήν. Αὐτῶν παρακλήσεσι, Λόγε Θεοῦ, μεγίστης ῥῦσαι κολάσεως, καὶ αἰωνίου τοὺς πίστει ὑμνοῦντάς σε."),
("Θεοτοκίον", "", "Ὁ πάλαι Πατρὸς ἐξ ἀγεννήτου, Υἱὸς γεννηθείς, γέννησιν ἔσχε χρονικήν, ἐκ σοῦ Παρθένε γεννηθείς, τὸν χρόνιον πόλεμον τῶν γηγενῶν, ἐξᾶραι θέλων ὡς εὔσπλαγχνος, ὁ ἡμερῶν τε καὶ χρόνων ἐπέκεινα."),
),
"2": (
("", "", "Ὄρος σε τῇ χάριτι"),
("", "", "Οἱ θρόνοι τὸν πρῶτον συμπληροῦντες διάκοσμον, καὶ Χερουβεὶμ καὶ Σεραφείμ, ταῖς τῆς Θεότητος αὐγαῖς, ἀμέσως ἐλλάμπονται, θεουργικαῖς ἱεραρχίαις δεχόμενοι, καὶ μελῳδοῦσι· Δόξα τῇ δυνάμει σου Κύριε."),
("", "", "Ὑμνοῦσι τρισάριθμον μονάδα Θεότητος, τριαδικοῖς ἁγιασμοῖς, ἀκαταπαύστοις ἐν φωναῖς, τρανοῦντα τὸ ἄχραντον, τὰ Σεραφεὶμ θεολογίας μυστήριον, καὶ τὴν ὀρθόδοξον πίστιν διδάσκοντα."),
("", "", "Σοφίας τὴν χύσιν, καὶ τὸ πλάτος τῆς γνώσεως, τῆς ἑνιαίας καὶ ἁπλῆς, αὐτοσοφίας εὐλαβῶς, Χερουβεὶμ δεχόμενα, τοῖς ἐφεξῆς θεομιμήτως παρέχουσι, διαπορθμεύοντα, τούτοις τὴν ἔλλαμψιν."),
("Θεοτοκίον", "", "Ὁ πάσης ἐπέκεινα, νοούμενος κτίσεως, τῆς ὑπὲρ νοῦν ζωαρχικῆς, ζωοπλαστίας ἀληθῶς, ἐκτελῶν τεράστια, παρθενικαῖς ἠγλαϊσμένην φαιδρότησι, τὴν σὴν γαστέρα κατῴκησεν Ἄχραντε."),
),
),
"P5": (
"1": (
("", "", "Ὁ φωτίσας τῇ ἐλλάμψει, τῆς σῆς παρουσίας Χριστέ, καὶ φαιδρύνας τῷ Σταυρῷ σου, τοῦ κόσμου τὰ πέρατα, τάς καρδίας φώτισον, φωτὶ τῆς σῆς θεογνωσίας, τῶν ὀρθοδόξως ὑμνούντων σε."),
("", "", "Ὑπέπεσα, τῶν παθῶν τῇ φθορᾷ, καὶ πτοοῦμαί σου τὸ δίκαιον δικαστήριον, δίκαιε Κύριε· διὸ ἱκετεύω σε, ἐνίσχυσόν με τοῦ ποιῆσαι, πράξεις καλὰς δικαιούσας με."),
("", "", "Τὰ ἄδηλα, καὶ τὰ κρύφια, σὺ τῆς καρδίας μου ἐπίστασαι, ὁ Θεός μου καὶ Πλάστης καὶ Κύριος· μὴ οὖν κατακρίνῃς με ἐν ὥρα κρίσεως, ἡνίκα ἔρχῃ τοῦ κρῖναι τὰ σύμπαντα."),
("Μαρτυρικὰ", "", "Οἱ Ἅγιοι, ὁμιλοῦντες πυρί, τὸ διάπυρον ἐδείκνυον, τῆς ἐνθέου αὐτῶν ἀγαπήσεως· ὅθεν δροσιζόμενοι, τῇ προσδοκίᾳ τῶν μελλόντων, οἱ θεοφόροι ἠγάλλοντο."),
("Μαρτυρικὰ", "", "Νευρούμενοι, ἀγαθῶν τῇ ἐλπίδι οἱ Μάρτυρες, ὑπέφερον σπαραγμοὺς τῶν μελῶν καρτερώτατα, καὶ τὸν πολυμήχανον νευραῖς, τῆς τούτων ἀνενδότου ὑπομονῆς ἐναπέπνιξαν."),
("Θεοτοκίον", "", "Ῥητορεῦον, οὐ δυνήσεται στόμα τοῦ τόκου σου, τὸ ἄρρητον διηγήσασθαι θαῦμα, Θεόνυμφε· τὸν γὰρ ἀνερμήνευτον τίκτεις, καὶ φέρεις ἐν ἀγκάλαις, χειρὶ κρατοῦντα τὰ σύμπαντα."),
),
"2": (
("", "", "Ὁ φωτίσας, τῇ ἐλλάμψει"),
("", "", "Πόθῳ θείῳ, πυρπολούμεναι αἱ Κυριότητες, Ἐξουσίαι, αἱ Δυνάμεις, αἱ τάξεις αἱ δεύτεραι, ἀσιγήτοις στόμασι, θεαρχικὴν ὑμνολογοῦσι, μίαν οὐσίαν καὶ δύναμιν."),
("", "", "Ῥυθμίζονται, Ἀρχαγγέλων αἱ τάξεις τῷ Πνεύματι, καὶ Ἀγγέλων, καὶ Ἀρχῶν σὺν ἀπείροις στρατεύμασι, μίαν τρισυπόστατον, φωτιστικὴν οὐσίαν σέβειν, περιφανῶς διδασκόμεναι."),
("Θεοτοκίον", "", "Ὡραιώθης, ὑπὲρ πᾶσαν Ἀγγέλων εὐπρέπειαν· τὸν γὰρ τούτων Ποιητήν, συλλαβοῦσα καὶ Κύριον, Θεομῆτορ ἄχραντε, σωματωθέντα ἀπορρήτως, ἐκ σῶν αἱμάτων ἐκύησας."),
),
),
"P6": (
"1": (
("", "", "Ἐκύκλωσεν ἡμᾶς ἐσχάτη ἄβυσσος, οὔκ ἐστιν ὁ ῥυόμενος, ἐλογίσθημεν ὡς πρόβατα σφαγῆς, σῶσον τὸν λαόν σου ὁ Θεὸς ἡμῶν· σὺ γὰρ ἰσχύς, τῶν ἀσθενούντων καὶ ἐπανόρθωσις."),
("", "", "Ὑπάρχων ἰατρὸς Χριστὲ ἰάτρευσον, τὰ πάθη τῆς καρδίας μου, καὶ ἀπόπλυνον παντός με μολυσμοῦ, ῥείθροις Ἰησοῦ μου κατανύξεως, ἵνα ὑμνῶ καὶ μεγαλύνω τὴν εὐσπλαγχνίαν σου."),
("", "", "Πλανώμενον ὁδοῖς τῆς ἀπωλείας με, καὶ βόθροις παραπτώσεων, περιπίπτοντα ἐπίστρεψον Χριστέ, καὶ πρὸς ἀπλανεῖς τρίβους εἰσάγαγε, σοῦ τῶν σεπτῶν δικαιωμάτων, ἵνα δοξάζω σε."),
("Μαρτυρικὰ", "", "Οἱ λίθοι ἀληθῶς οἱ πολυτίμητοι, τοῖς λίθοις συγχωννύμενοι, οὐκ ἠρνήσαντο τὴν πέτραν τῆς ζωῆς, οὐδὲ τοῖς γλυπτοῖς λίθοις ἐπέθυσαν, οἱ εὐκλεεῖς καὶ στεφηφόροι Κυρίου Μάρτυρες."),
("Μαρτυρικὰ", "", "Νεώσαντες ψυχὰς ἀρότρῳ Πίστεως, τὸν ἄσταχυν οἱ Μάρτυρες τῆς ἀθλήσεως, ἐν Πνεύματι Θεοῦ, τὸν ἑκατοστεύοντα ἐξήνθησαν, καὶ τῆς τρυφῆς τῆς μακαρίας κατηξιώθησαν."),
("Θεοτοκίον", "", "Πυρίνων Λειτουργῶν τὸ πῦρ κυήσασα, ἐφάνης παναμώμητος, καὶ τῆς κτίσεως ἀπάσης πρωτουργός, πάναγνε Παρθένε, ὑπερέχουσα, ἐν γυναιξὶν εὐλογημένη Θεοχαρίτωτε."),
),
"2": (
("", "", "Ἐκύκλωσεν ἡμᾶς ἐσχάτη"),
("", "", "Τὰ τάγματα, τῶν Ἀσωμάτων Κύριε, τῷ θρόνῳ παριστάμενα τῷ τῆς δόξης σου, φωναῖς ἀγγελικαῖς, ταῖς ἀκαταπαύστοις σὲ γεραίρουσι· σὺ γὰρ ἰσχὺς τούτων ὑπάρχεις, Χριστέ, καὶ ὕμνησις."),
("", "", "Οἱ πρόσωπον τὸ σὸν ὁρῶντες Ἄγγελοι, τὸ κάλλος τὸ ἀμήχανον, τὴν ὑπέρθεον εὐπρέπειαν τῆς σῆς, θείας ἀγλαΐας, ἐκλαμπρύνονται· σὺ γὰρ αὐτῶν καὶ φῶς ὑπάρχεις, καὶ ἀγαλλίαμα."),
("Θεοτοκίον", "", "Σεσάρκωται ὁ πρὶν ὑπάρχων ἄσαρκος, ὁ Λόγος ἐκ σοῦ Πάναγνε, ὁ τὰ σύμπαντα θελήματι ποιῶν, ὁ τῶν Ἀσωμάτων τὰ στρατεύματα, παραγαγὼν ἐκ του μὴ ὄντος, ὡς παντοδύναμος."),
),
),
"P7": (
"1": (
("", "", "Σὲ νοητήν, Θεοτόκε κάμινον, κατανοοῦμεν οἱ πιστοὶ ὡς γὰρ Παῖδας ἔσωσε τρεῖς, ὁ ὑπερυψούμενος, ὅλον με τὸν ἄνθρωπον, ἐν τῇ γαστρί σου ἀνέπλασεν, ὁ αἰνετὸς τῶν Πατέρων, Θεὸς καὶ ὑπερένδοξος."),
("", "", "Λέοντας πρίν, Δανιὴλ ἐφίμωσε, σύνοικον ἔχων ἀρετήν, τοῦτον ζήλωσον, ὧ ψυχή, καὶ τὸν ὠρυόμενον πάντοτε ὡς λέοντα, καὶ συλλαβεῖν σε βουλόμενον, τῇ πρὸς Θεόν ἀνανεύσει ἀεί, ἄπρακτον ποίησον."),
("", "", "Ὑπερβολῇ, ἀσωτείας, Κύριε, ψυχὴν ἐρρύπωσα δεινῶς, ὑπερβάλλουσαν οὖν Χριστέ, ἔχων ἀγαθότητα, δέξαι, ὡς τὸν Ἄσωτον, καὶ μελῳδοῦντα με οἴκτειρον, ὁ αἰνετός τῶν Πατέρων Θεός, καὶ ὑπερένδοξος."),
("Μαρτυρικὰ", "", "Νόμῳ Χριστοῦ, εὐσθενῶς ῥωννύμενοι, τῶν ἀνομούντων τὰς βουλάς, ἐξηφάνισαν ἀνδρικῶς, οἱ ἀκαταγώνιστοι Μάρτυρες, νομίμως τε, τελειωθέντες δὲ ἔμελπον, ὁ αἰνετός τῶν Πατέρων Θεός, καὶ ὑπερένδοξος."),
("Μαρτυρικὰ", "", "Οἱ θεαυγεῖς, τοῦ Κυρίου Μάρτυρες, πεπυρσευμένοι τῷ φωτὶ τῆς Τριάδος περιφανῶς, σκότος τῶν κολάσεων, πλάνης τὴν ὁμίχλην τε, διεληλύθατε μέλποντες, ὁ αἰνετός τῶν Πατέρων Θεός, καὶ ὑπερένδοξος."),
("Θεοτοκίον", "", "Νόμοι ἐν σοί, φύσεως καινίζονται· τὸν νομοδότην γὰρ Χριστόν, δίχα νόμων τῶν σαρκικῶν τίκτεις, Παναμώμητε, πᾶσιν ἀπολύτρωσιν, νομοθετοῦντα τοῖς μέλπουσιν, ὁ αἰνετὸς τῶν Πατέρων Θεός, καὶ ὑπερένδοξος."),
),
"2": (
("", "", "Σὲ νοητήν"),
("", "", "Ἄναρχον φῶς, σὺ ὑπάρχεις Δέσποτα, φωτὸς ἐκλάμψας ἐκ Πατρός, τῶν Ἀγγέλων τὰς στρατιάς, φῶτα κατεσκεύασας, ἔσοπτρα δεχόμενα, τὴν ἀστραπήν σου τὴν ἄδυτον, ὁ αἰνετὸς τῶν Πατέρων Θεός, καὶ ὑπερένδοξος."),
("", "", "Γένος βροτῶν, ὁ τῶν ὅλων Κύριος, ἐπιστασίαις ἐμφανῶς, περισῴζεις ἀγγελικαῖς· τούτους γὰρ ἐπέστησας πᾶσι τοῖς πιστεύουσι, καὶ ὀρθοδόξως ὑμνοῦσί σε, τὸν αἰνετόν τῶν Πατέρων Θεόν, καὶ ὑπερένδοξον."),
("", "", "Γλῶσσα καὶ νοῦς, οὐκ ἰσχύει Δέσποτα, τῶν σῶν θαυμάτων ἐξειπεῖν, καὶ τῶν ἔργων τὸ εὐπρεπές· σὺ γὰρ κατηγλάϊσας, πᾶσαν διακόσμησιν τῶν οὐρανίων Δυνάμεων, ὁ αἰνετὸς τῶν Πατέρων Θεός, καὶ ὑπερένδοξος."),
("Θεοτοκίον", "", ""), //TODO: missing Θεοτοκίον
),
),
"P8": (
"1": (
("", "", "Ἐν καμίνῳ Παῖδες Ἰσραήλ, ὡς ἐν χωνευτηρίῳ, τῷ κάλλει τῆς εὐσεβείας, καθαρώτερον χρυσοῦ, ἀπέστιλβον λέγοντες· Εὐλογεῖτε πάντα τὰ ἔργα Κυρίου, τὸν Κύριον ὑμνεῖτε, καὶ ὑπερυψοῦτε, εἰς πάντας τοὺς αἰῶνας."),
("", "", "Λυτρωτά μου εὔσπλαγχνε Χριστέ, τῆς νῦν με κατεχούσης ὁμίχλης ἁμαρτιῶν τε, καὶ παντοίων πειρασμῶν, λύτρωσαι κραυγάζοντα· Εὐλογεῖτε πάντα τὰ ἔργα, τὸν Κύριον ὑμνεῖτε, καὶ ὑπερυψοῦτε εἰς πάντας τοὺς αἰῶνας."),
("", "", "Ὅταν μέλλῃς ἔρχεσθαι Χριστέ, ἐν δόξῃ κρῖναι κόσμον, τῇ στάσει τῶν ἐκλεκτῶν σου συναρίθμησον κᾀμέ, βοῶντα καὶ λέγοντα· Εὐλογεῖτε πάντα τὰ ἔργα, τὸν Κύριον ὑμνεῖτε, καὶ ὑπερυψοῦτε εἰς πάντας τοὺς αἰῶνας."),
("Μαρτυρικὰ", "", "Γῆς ἁγίας Μάρτυρες σοφοί, ἐπέβητε· ἐν γῇ γὰρ μεγάλως ἀγωνισάμενοι, οὐρανίαν ζωὴν εἰλήφατε μέλποντες· Εὐλογεῖτε πάντα τὰ ἔργα, τὸν Κύριον ὑμνεῖτε, καὶ ὑπερυψοῦτε εἰς πάντας τοὺς αἰῶνας."),
("Μαρτυρικὰ", "", "Ἐκδυθέντες σῶμα τὸ φθαρτόν, στολὴν ἀθανασίας, ὡς Μάρτυρες νικηφόροι ἐπενδύσασθε Χριστῷ, ἐξ ὕψους κραυγάζοντες· Εὐλογεῖτε πάντα τὰ ἔργα, τὸν Κύριον ὑμνεῖτε, καὶ ὑπερυψοῦτε εἰς πάντας τοὺς αἰῶνας."),
("Θεοτοκίον", "", "Ἱεραί σε πόρρωθεν φωναί, γενήσεσθαι Μητέρα τοῦ πάντα τεκτηναμένου, προκατήγγειλαν Θεοῦ, ᾧ μέλπομεν Ἄχραντε· Εὐλογεῖτε πάντα τὰ ἔργα, τὸν Κύριον ὑμνεῖτε, καὶ ὑπερυψοῦτε εἰς πάντας τοὺς αἰῶνας."),
),
"2": (
("", "", "Ἐν καμίνῳ Παῖδες"),
("", "", "Λαμπομένας καὶ πλησιφαεῖς, Ἀγγέλων στρατηγίας, ἀκτῖσι τῆς τρισηλίου ὡραιότητος πιστοί, μιμούμενοι μέλψωμεν· Εὐλογεῖτε πάντα τὰ ἔργα, τὸν Κύριον ὑμνεῖτε, καὶ ὑπερυψοῦτε εἰς πάντας τοὺς αἰῶνας."),
("", "", "Ὡς πηγαία πάντων τῶν καλῶν, ἡ θεαρχικωτάτη, παράγει θείᾳ δυνάμει, φῶτα δεύτερα τὸ φῶς, τὸ πρῶτον δεχόμενα, καὶ βοῶντα· Πάντα τὰ ἔργα, τὸν Κύριον ὑμνεῖτε, καὶ ὑπερυψοῦτε εἰς πάντας τοὺς αἰῶνας."),
("", "", "Νοῦς ὁ πρῶτος καὶ δημιουργός, ὑπερκοσμίους νόας, Ἀγγέλων ὑπερουσίως ὑπεστήσατο αὐτῷ, σαφῶς πλησιάζοντας καὶ βοῶντας· Πάντα τὰ ἔργα, τὸν Κύριον ὑμνεῖτε, καὶ ὑπερυψοῦτε εἰς πάντας τοὺς αἰῶνας."),
("Θεοτοκίον", "", "Ὑπὲρ λόγον τὸν ἐκ τοῦ Πατρός, τεχθέντα πρὸ αἰώνων, ἀφράστως σεσαρκωμένον, ἀπεγέννησας ἡμῖν, Παρθένε πανάμωμε, ᾧ βοῶμεν· Πάντα τὰ ἔργα, τὸν Κύριον ὑμνεῖτε, καὶ ὑπερυψοῦτε εἰς πάντας τοὺς αἰῶνας."),
),
),
"P9": (
"1": (
("", "", "Τύπον τῆς ἁγνῆς λοχείας σου, πυρπολουμένη βάτος ἔδειξεν ἄφλεκτος, καὶ νῦν καθ' ἡμῶν, τῶν πειρασμῶν ἀγριαίνουσαν, κατασβέσαι αἰτοῦμεν τὴν κάμινον, ἵνα σε Θεοτόκε, ἀκαταπαύστως μεγαλύνωμεν."),
("", "", "Ὥσπερ Χαναναία κράζω σοι· Ἐλέησόν με Λόγε· ψυχὴν γὰρ κέκτημαι, ταῖς δαιμονικαῖς ἐπιφοραῖς κινδυνεύουσαν, καὶ ἀφρόνως τὰ ἄθεσμα πράττουσαν, καὶ μὴ αἰσθανομένην, τοῦ θείου φόβου σου, Μακρόθυμε."),
("", "", "Στῆσον ἐπὶ πέτραν Κύριε, τὰς τῆς ψυχῆς μου βάσεις, τῶν προσταγμάτων σου, καὶ τὸν ἀναιδῶς ὑποσκελίζειν με θέλοντα, ὑποσκέλισον ὄφιν καὶ ῥῦσαί με, τῆς τούτου κακουργίας, ὡς ἀγαθὸς καὶ πολυέλεος."),
("Μαρτυρικὰ", "", "Ἤδη παρελθόντες Μάρτυρες, τῶν πειρασμῶν τὸ ὕδωρ τὸ ἀνυπόστατον, καὶ τῶν αἰκισμῶν τῶν χαλεπῶν τὸ κλυδώνιον, πρὸς λιμένα σαφῶς κατηντήσατε, τῆς ἄνω Βασιλείας, θείας γαλήνης ἀπολαύοντες."),
("Μαρτυρικὰ", "", "Φέγγους ἀνεσπέρου, Μάρτυρες, φωτοειδεῖς γενόμενοι ἠξιώθητε, καὶ ἐν Ἐκκλησίᾳ πρωτοτόκων εὐφραίνεσθαι καὶ Ἀγγέλων χοροῖς συναγάλλεσθαι, μεθ΄ὧν τὸν Ζωοδότην, ὑπὲρ ἡμῶν καθικετεύσατε."),
("Θεοτοκίον", "", "Φέρεις τὸν τὰ πάντα φέροντα, καὶ γαλουχεῖς τὸν πᾶσι τροφὴν παρέχοντα, μέγα καὶ φρικτόν, τὸ ὑπὲρ νοῦν σου μυστήριον, κιβωτὲ τοῦ σεπτοῦ ἁγιάσματος, Παρθένε Θεοτόκε· ὅθεν σε πίστει μακαρίζομεν."),
),
"2": (
("", "", "Τύπον τῆς ἁγνῆς"),
("", "", "Μύστας τῆς ἀρρήτου δόξης σου, τοὺς ἀσωμάτους Νόας, Σῶτερ ὑπέστησας, καὶ νῦν δι' αὐτῶν, τὸν σὸν λαὸν διαφύλαξον, τόν πίστει σοι καὶ πόθῳ προσφεύγοντα, ἵνα σε τὸν Δεσπότην, ἀκαταπαύστως μεγαλύνωμεν."),
("", "", "Νέμεις τῆς εἰρήνης Ἄγγελον, περιφρουροῦντα, Παντοκράτορ, τὴν ποίμνην σου· τῆς εἰρήνης γὰρ καὶ τῆς ἀγάπης σὺ αἴτιος, καὶ τὴν ἔμφρονα πίστιν φυλάττοντα, καὶ πάσας τὰς αἱρέσεις, τῇ σῇ δυνάμει καταλύοντα."),
("", "", "Ὅλος γλυκασμὸς ὑμνούμενος, τῶν οὐρανίων τὴν γλυκεῖαν φαιδρότητα καταφύτευσον, ἐν Ἐκκλησίαις σου, Δέσποτα, καὶ τὴν εὔτακτον δίδου κατάστασιν, ἵνα σε τόν Σωτῆρα ἀκαταπαύστως μεγαλύνωμεν."),
("Θεοτοκίον", "", "Στίφη τῶν Ἀγγέλων, Πάναγνε, νῦν ἀσιγήτως τὸν σὸν τόκον γεραίρουσι· ταῖς γὰρ τάξεσιν ἐπιστατοῦντα θεώμενοι, ταῖς αὐτῶν θυμηδίαις ἐμπίπλανται, καὶ σὲ τήν Θεοτόκον ἀκαταπαύστως μεγαλύνουσιν."),
),
),
),
"ST": (
("", "", "Ἄλλος σε κόσμος, ψυχή, ἀναμένει καὶ Κριτής, τὰ σὰ μέλλων δημοσιεύειν κρυπτὰ καὶ δεινά· μὴ οὖν ἐμμείνῃς τοῖς ᾧδε, ἀλλὰ πρόφθασον βοῶσα τῷ Κριτῇ, ὁ Θεός ἱλάσθητί μοι, καὶ σῶσόν με."),
("", "", "Μὴ ἀποδοκιμάσῃς με Σωτήρ μου, τῇ ῥαθυμίᾳ τῆς ἁμαρτίας συνεχόμενον, διέγειρόν μου τὸν λογισμὸν πρὸς μετάνοιαν, καὶ τοῦ σοῦ ἀμπελῶνος ἐργάτην δόκιμον ἀνάδειξόν με, δωρούμενός μοι τῆς ἑνδεκάτης ὥρας τὸν μισθόν, καὶ τὸ μέγα ἔλεος."),
("Μαρτυρικὸν", "", "Τοὺς Ἀθλοφόρους τοῦ Χριστοῦ, δεῦτε λαοὶ ἅπαντες τιμήσωμεν, ὕμνοις καὶ ᾠδαῖς πνευματικαῖς, τοὺς φωστῆρας τοῦ κόσμου, καὶ κήρυκας τῆς πίστεως, τὴν πηγὴν τήν ἀέναον, ἐξ ἧς ἀναβλύζει τοῖς πιστοῖς τὰ ἰάματα. Αὐτῶν ταῖς ἱκεσίαις, Χριστὲ ὁ Θεὸς ἡμῶν, τὴν εἰρήνην δώρησαι τῷ κόσμῳ σου, καὶ ταῖς ψυχαῖς ἡμῶν τὸ μέγα ἔλεος."),
("Θεοτοκίον", "Τῶν οὐρανίων ταγμάτων", "Ἁγιωτέρα ἁγίων πασῶν Δυνάμεων, τιμιωτέρα πάσης κτίσεως, Θεοτόκε, Δέσποινα τοῦ κόσμου, σῶσον ἡμᾶς, τὸν Σωτῆρα κυήσασα, ἀπὸ πταισμάτων μυρίων, ὡς ἀγαθή, καὶ κινδύνων ταῖς πρεσβείαις σου."),
)
)
#let L_Po = (
"B": (
("", "", "Διὰ βρώσεως ἐξήγαγε, τοῦ Παραδείσου ὁ ἐχθρὸς τὸν Ἀδάμ, διὰ Σταυροῦ δὲ τὸν λῃστήν, ἀντεισήγαγε Χριστὸς ἐν αὐτῷ· Μνήσθητί μου κράζοντα, ὅταν ἔλθῃς ἐν τῇ βασιλείᾳ σου."),
("", "", "Κατανύξεως πηγήν μοι δώρησαι, τῇ εὐσπλαγχνίᾳ σου, Χριστὲ ὁ Θεός, παντός με ῥύπου τῶν κακῶν, τῶν ἀμέτρων ἐκκαθαίρουσαν, καὶ τῆς βασιλείας σου, εὐεργέτα, μέτοχόν με ποίησον."),
("", "", "Τῶν Ἀγγέλων σου τὰ τάγματα, εἰς ἱκεσίαν σοι κινοῦμεν Χριστέ, σῶσον οἰκτείρησον ἡμᾶς, δι' αὐτῶν ὡς ὑπεράγαθος, πάντα παρορῶν ἡμῶν, τὰ ἐν γνώσει, καὶ ἀγνοίᾳ πταίσματα."),
("Μαρτυρικὸν", "", "Τῶν αἱμάτων ὑμῶν, Ἅγιοι, τοῖς ὀχετοῖς τὸν νοητὸν Φαραώ, ἐναπεπνίξατε σαφῶς, νῦν δὲ βλύζετε θαυμάτων κρουνούς, πέλαγος ξηραίνοντας νοσημάτων· ὅθεν μακαρίζεσθε."),
("", "", "Τὸν Πατέρα προσκυνήσωμεν, καὶ τὸν Υἱὸν δοξολογήσωμεν, καὶ τὸ Πανάγιον πιστοί, πάντες Πνεῦμα ἀνυμνήσωμεν, κράζοντες καὶ λέγοντες· Παναγία Τριάς, σῶσον πάντας ἡμᾶς."),
("Θεοτοκίον", "", "Ἡ τεκοῦσα φῶς τὸ ἄχρονον, ἐσκοτισμένην τὴν ψυχήν μου ἀεί, ταῖς τῶν δαιμόνων προσβολαῖς, φωταγώγησον, Πανάμωμε, καὶ πυρὸς τοῦ μέλλοντος, μεσιτείαις θείαις ἐλευθέρωσον."),
)
) |
|
https://github.com/dashuai009/dashuai009.github.io | https://raw.githubusercontent.com/dashuai009/dashuai009.github.io/main/src/content/blog/038.typ | typst |
#let date = datetime(
year: 2022,
month: 11,
day: 4,
)
#metadata((
title: "windows cmd切换盘符",
subtitle: [cmd],
author: "dashuai009",
description: "在windwos里,cmd命令行中,直接输入D:回车,就可以切换盘符。",
pubDate: date.display(),
))<frontmatter>
#import "../__template/style.typ": conf
#show: conf
在windwos里,cmd命令行中,直接输入D:回车,就可以切换盘符。
之前在win10里死活cd不进D盘,powershell应该没有这种问题。win11没试过。
注意别忘了D后边的冒号。
|
|
https://github.com/freundTech/typst-matryoshka | https://raw.githubusercontent.com/freundTech/typst-matryoshka/main/tests/features/filesystem/test.typ | typst | MIT License | #import "/lib.typ": compile
#set page(fill: gray)
#compile("#include \"file.typ\"", filesystem: ("file.typ": "Hello World"))
|
https://github.com/denkspuren/typst_programming | https://raw.githubusercontent.com/denkspuren/typst_programming/main/Packages.typ | typst | = Interesting Packages
== Codly: simple and beautiful code blocks for Typst
Dieses Paket setzt Codezeilen:
https://github.com/Dherse/codly
Was aber durch `@Zheoni`
signifikant #link("https://discord.com/channels/1054443721975922748/1057632212671025162/1172278048524083271")[verbessert] wurde. Hier der Code
https://discord.com/channels/1054443721975922748/1172278048524083271/1172278634149580850
Ein PR steht aus.
== Pin It
"Pin things as you like, especially useful for creating slides."
https://github.com/typst/packages/tree/main/packages/preview/pinit |
|
https://github.com/Caellian/UNIRI_voxels_doc | https://raw.githubusercontent.com/Caellian/UNIRI_voxels_doc/trunk/content/animacije.typ | typst | = Animacije
- Ona metoda gdje se generira AABB za segmente koji međusobno ne colideaju i koristi skeleton
- Metoda sa deformacijom voksela
- Nije "pravi" voxel renderer
- Metoda gdje se u compute shaderu samplea animirani triangle mesh svaki frame
- Izgleda meh i relativno je zahtjevno
- Metoda gdje je definirana funkcija koja mapira deltatime na konfiguraciju voksela
- Opisati kako je DAG neprikladan za animiranje - ili spor ili jako potrošan glede memorije
#pagebreak()
|
|
https://github.com/Marmare314/typst-presentation | https://raw.githubusercontent.com/Marmare314/typst-presentation/main/slides.typ | typst | MIT License | #let _get-current-slide(content) = {
let start-next = content.children.slice(1).position(c => c.func() == heading and c.level == 1)
if start-next != none {
(content.children.slice(0, start-next), content.children.slice(start-next).sum())
} else {
(content.children, [])
}
}
#let _split-by-headings(content) = {
let result = ()
while content.len() > 0 {
let current-heading = content.first()
assert(current-heading.func() == heading)
content = content.slice(1)
let next-heading = content.position(c => c.func() == heading and (c.level == 1 or c.level == 2))
if next-heading == none {
next-heading = content.len()
}
let current-body = content.slice(0, next-heading)
content = content.slice(next-heading)
result.push((current-heading, current-body))
}
result
}
#let _split-current-slide(content) = {
let sections = _split-by-headings(content)
(sections.first().first(), sections.slice(1))
}
#let _remove-internal(h) = {
if h.has("label") {
panic("labels are not supported")
} else {
heading(
level: h.level,
h.body.children.filter(c => not (c.func() == text and c.text.starts-with("slide-internal:"))).sum(),
)
}
}
#let _get-slide-info(sections) = {
let result = ()
for (h, body) in sections {
if h.body.has("children") {
let infos = h.body.children.filter(c => c.func() == text and c.text.starts-with("slide-internal:"))
assert(infos.len() == 1)
result.push((_remove-internal(h), body, eval(infos.first().text.trim("slide-internal:"))))
} else {
result.push((h, body, ()))
}
}
result
}
#let _array-to-set(arr) = {
let result = ()
let last = none
for i in arr.sorted() {
if i != last {
result.push(i)
last = i
}
}
result
}
#let dynamic-slide(content) = {
let (current, remaining-content) = _get-current-slide(content)
let (heading, sections) = _split-current-slide(current)
let sections_with_info = _get-slide-info(sections)
let indices = _array-to-set(sections_with_info.map(((a, b, c)) => c).flatten())
for i in indices + (indices.last() + 1,) {
heading
for (header, body, info) in sections_with_info {
if info.contains(i) {
hide(
header + body.sum()
)
} else {
header
body.sum()
}
}
}
remaining-content
}
#let hide-slide(slides) = {
slides = (slides,).flatten()
text("slide-internal:" + repr(slides))
}
#let presentation(
title: none,
author: none,
title-text: none,
fg-color: blue,
bg-color: white,
size: "presentation-4-3",
content
) = {
set page(paper: size)
set text(size: 23pt)
align(horizon)[
#if title != none {
align(center, text(fg-color, title))
}
#if author != none {
align(center, author)
}
#if title-text != none {
align(center, title-text)
}
]
show page: it => {
align(horizon, it)
}
set page(header: {
locate(loc => {
let headings = query(heading.where(level: 1).after(loc), loc)
if headings.len() > 0 {
let slide-title = headings.first().body
if not (slide-title.has("children") and slide-title.children.len() == 0) {
rect(
fill: fg-color,
width: 100%,
height: 100%,
align(horizon, text(bg-color, slide-title))
)
}
}
})
})
show heading.where(level: 1): it => {
pagebreak(weak: true)
place(hide(it))
}
show heading.where(level: 2): it => block(text(fg-color, it.body))
content
}
|
https://github.com/satwanjyu/typst-cv-template | https://raw.githubusercontent.com/satwanjyu/typst-cv-template/main/README.md | markdown | MIT License | LaTeX-esque minimalistic [typst](https://typst.app) CV template.
[PDF](./example.pdf)
|
https://github.com/DashieTM/ost-5semester | https://raw.githubusercontent.com/DashieTM/ost-5semester/main/blockchain/weeks/week8.typ | typst | #import "../../utils.typ": *
#section("Fully Distributed Systems")
#subsection("Principles")
- location transparency
- user should not know they are interacting with a distributed system
- access transparency
- users should access resources in a single uniform way, no matter what server
they are connecting to
- replication transparency
- users should not be aware about replicas -> must seem like this is the regular
data
- concurrent transparency
- users should not be aware that other users are also accessing this right
now(unless needed for collaboration)
#subsection("Distributed data")
How can users access the same data from different locations -> aka on different
servers?
- central server -> no distribution
- flooding search -> layer 2 broadcasting, wireless mesh networks, bitcoin
- distributed indexing -> tor, bittorrent, cassandra, dynamo
#subsubsection("Comparison")
#align(
center,
[#image("../../Screenshots/2023_11_06_02_04_12.png", width: 100%)],
)
#subsubsection("Central Server")
#align(
center,
[#image("../../Screenshots/2023_11_06_02_00_21.png", width: 100%)],
)
#columns(2, [
#text(green)[Benefits]
- simple and fast
- complex and fuzzy queries are possible
- search complexity is O(1) -> just one server!
#colbreak()
#text(red)[Liabilities]
- no scalability -> problem starting with a certain amount of users
- n users -> O(N) calls to server
- O(N) node state in server
- single point of failure
])
#align(
center,
[#image("../../Screenshots/2023_11_06_02_03_09.png", width: 30%)],
)
#subsubsection("Flooding")
- fully distributed
- opposite approach of central server -> no server
- retrieval of data:
- no routing information for content
- necessity to ask as many systems as possible/necessary
- approach1: high degree search -> quick search trhough large areas
- approach2: random walk
- high traffic load on network, scalability issues -> spam
- *no guarantee to reach all nodes*
#align(
center,
[#image("../../Screenshots/2023_11_06_02_06_53.png", width: 100%)],
)
#subsubsection("Distributed Indexing")
#align(
center,
[#image("../../Screenshots/2023_11_06_02_07_34.png", width: 100%)],
)
Essentially a middle ground between the 2, you have a certain amount of servers
that handle the data, but it isn't thousands, aka no spam, but also no DDOS...
#align(
center,
[#image("../../Screenshots/2023_11_06_02_08_25.png", width: 100%)],
)
- Approach of distributed indexing schemes
- Data and nodes are mapped into same address space
- Nodes maintain routing information to other nodes
- Definitive statement of existence of content
- Problems
- Maintenance of routing information required
- Fuzzy queries not primarily supported (e.g., wildcard searches)
#subsubsubsection("Distributed Hash Tables")
- Consistent hashing → nodes responsible for hash value intervals
- More peers = smaller responsible intervals
- Hash Table [link]
- Modulo hashing
- Bucket = hash(x) mod n
- If n changes, remapping / bucket changes
- N changes if capacity is reached
- Remapping is expensive in DHT!
- DHTs reassign responsibility
#align(
center,
[#image("../../Screenshots/2023_11_06_02_15_15.png", width: 100%)],
)
+ Mapping of nodes and data into same address space
- Peers and content are addressed using flat identifiers (IDs)
- E.g., Address is public key (256bit) or SHA256 of public key. Content ID =
SHA256(content)
- Common address space for data and nodes
- Nodes are responsible for data in certain parts of the address space
- Association of data to nodes may change since nodes may disappear
+ Storing / Looking up data in the DHT
- Store data = first, search for responsible node
- Not necessarily known in advance
- Search data = first, search for responsible node
#align(
center,
[#image("../../Screenshots/2023_11_06_02_15_38.png", width: 100%)],
)
#align(
center,
[#image("../../Screenshots/2023_11_06_02_17_29.png", width: 100%)],
)
- direct storage
- small values
- H("mydata") = 3107
- indirect storage
- distributed
- more steps than direct storage
- mapped as tuple -> (key,value)
#align(
center,
[#image("../../Screenshots/2023_11_06_02_28_31.png", width: 100%)],
)
#subsubsubsection("Kademlia")
- Several approaches to build DHT
- Distance metric as key difference
- Chord, Pastry: numerical closeness
- CAN: multidimensional numerical closeness
- Parallel queries
- For one query, α (alpha) concurrent lookups are sent
- More traffic load, but lower response times
- Preference towards old contacts
- Study has shown that the longer a node has been up, the more likely it is to
remain up another hour
- Resistance against DoS attacks by flooding the network with new nodes
- Network maintenance
- In Chord: active fixing of fingers
- In Kademlia: active maintenance
- DHT-based overlay network using the XOR distance metric
- Symmetrical routing paths(A → B == B → A)
- due to XOR(A,B) == XOR (B,A)
#align(
center,
[#image("../../Screenshots/2023_11_06_02_41_42.png", width: 100%)],
)
#text(
teal,
)[Note, the sha1 was used in 2002 when it was created, please for the love of
pones, don't use this anymore, use sha-whateverelse -> sha256]
#align(
center,
[#image("../../Screenshots/2023_11_06_02_32_43.png", width: 100%)],
)
#text(
teal,
)[Note, the numbers in the tables are actually the binary numbers on the right,
just converted to the conventional 10digit number system.]
#subsection("TomP2P")
- TomP2P is a P2P framework/library
- Unmaintained ☹
- Implements DHT (structured), broadcasts ([un]structured), direct messages (can
implement super-peers)
- NAT handling: UPNP, NATPMP, relays, hole punching (work in progress)
- Direct / indirect (tracker / mesh) storage
- Direct / indirect replication (churn prediction and ~rsync)
#subsection("Sybil attacks")
Creation of malicious/fake nodes -> if more fake nodes than real ones, they
control the network.\
Prevention:
- make node creation costly
- Always assume data from other nodes may be missing
- Bitcoin – chain of block, if block is missing, you notice
- Chain of trust / reputation
#align(
center,
[#image("../../Screenshots/2023_11_06_02_35_57.png", width: 50%)],
)
#align(
center,
[#image("../../Screenshots/2023_11_06_02_56_04.png", width: 80%)],
)
#subsection("Redundancy")
#subsubsection("Replication")
- one originator and responsible node
- periodically update peers
- all others are peers
- main nodes goes offline -> TTL then value dropped and no longer available
- example usage: tracker that announces data
#align(
center,
[#image("../../Screenshots/2023_11_06_02_37_43.png", width: 100%)],
)
#subsubsection("Indirect Replication")
- one originator
- all others peers and responsible nodes -> hierarchical, responsible for parent
node
- Periodically checks if enough replicas exist
- Detects if responsibility changes
- Requires cooperation between responsible peer and originator
- Multiple peers may think they are responsible for different versions →
eventually solved
#align(
center,
[#image("../../Screenshots/2023_11_06_02_39_56.png", width: 100%)],
)
#subsubsection("Replication and Consistency")
- DHTs have weak consistency
- Peer A put X.1
- Peer B gets X.1
- Peer B modifies it puts B.2
- Same time (time in distributed systems):
- Peer C gets X.1
- Peer C modifies it puts C.2
- last to modify wins -> inconsistency -> see database module
- Replication makes it worse
- Consistency: generic issue in distributed systems,requires typically coordinator
- Multi-Paxos, Raft, ZooKeeper → Leader Election
#subsubsection("Solution for light churn")
#align(
center,
[#image("../../Screenshots/2023_11_06_02_45_47.png", width: 50%)],
)
|
|
https://github.com/Nrosa01/TFG-2023-2024-UCM | https://raw.githubusercontent.com/Nrosa01/TFG-2023-2024-UCM/main/Memoria%20Typst/capitulos/Agradecimientos.typ | typst | #set align(right)
#text(15pt)[Nicolás]
#set align(left)
Quiero dar las gracias a mis padres, por su paciencia y comprensión cuando estaba agobiado, y a mi hermano, por su apoyo y ánimos. A mis amigos, por su apoyo y por estar siempre ahí cuando los necesito. A mi compañero de proyecto, por su colaboración y esfuerzo. A mi tutor, por su ayuda y orientación. A todos ellos, gracias.
#set align(right)
#text(15pt)[Jonathan]
#set align(left)
Quiero dar las gracias, de igual manera, a mis padres por su incondicional apoyo, a mis amigos, por estar ahí para lo bueno y lo malo, a Marta, por haberme dado fuerzas incluso cuando no las tenía ella, a mi compañero de proyecto por ser una inspiración como desarrollador de software y por su gran trabajo y, por último y no menos importante, a mi tutor por su orientación y por todas los momentos y reuniones que hemos tenido durante el TFG y durante la carrera.
|
|
https://github.com/Myriad-Dreamin/typst.ts | https://raw.githubusercontent.com/Myriad-Dreamin/typst.ts/main/fuzzers/corpora/visualize/shape-fill-stroke_02.typ | typst | Apache License 2.0 |
#import "/contrib/templates/std-tests/preset.typ": *
#show: test-page
// Test stroke composition.
#set square(stroke: 4pt)
#set text(font: "Roboto")
#stack(
dir: ltr,
square(
stroke: (left: red, top: yellow, right: green, bottom: blue),
radius: 50%, align(center+horizon)[*G*],
inset: 8pt
),
h(0.5cm),
square(
stroke: (left: red, top: yellow + 8pt, right: green, bottom: blue + 2pt),
radius: 50%, align(center+horizon)[*G*],
inset: 8pt
),
h(0.5cm),
square(
stroke: (left: red, top: yellow, right: green, bottom: blue),
radius: 100%, align(center+horizon)[*G*],
inset: 8pt
),
)
// Join between different solid strokes
#set square(size: 20pt, stroke: 2pt)
#set square(stroke: (left: green + 4pt, top: black + 2pt, right: blue, bottom: black + 2pt))
#stack(
dir: ltr,
square(),
h(0.2cm),
square(radius: (top-left: 0pt, rest: 1pt)),
h(0.2cm),
square(radius: (top-left: 0pt, rest: 8pt)),
h(0.2cm),
square(radius: (top-left: 0pt, rest: 100pt)),
)
// Join between solid and dotted strokes
#set square(stroke: (left: green + 4pt, top: black + 2pt, right: (paint: blue, dash: "dotted"), bottom: (paint: black, dash: "dotted")))
#stack(
dir: ltr,
square(),
h(0.2cm),
square(radius: (top-left: 0pt, rest: 1pt)),
h(0.2cm),
square(radius: (top-left: 0pt, rest: 8pt)),
h(0.2cm),
square(radius: (top-left: 0pt, rest: 100pt)),
)
|
https://github.com/frectonz/the-pg-book | https://raw.githubusercontent.com/frectonz/the-pg-book/main/book/176.%20pow.html.typ | typst | pow.html
Charisma / Power
January 2017People who are powerful but uncharismatic will tend to be disliked.
Their power makes them a target for criticism that they don't have
the charisma to disarm. That was <NAME>'s problem. It also
tends to be a problem for any CEO who is more of a builder than a
schmoozer. And yet the builder-type CEO is (like Hillary) probably
the best person for the job.I don't think there is any solution to this problem. It's human
nature. The best we can do is to recognize that it's happening, and
to understand that being a magnet for criticism is sometimes a sign
not that someone is the wrong person for a job, but that they're
the right one.
|
|
https://github.com/kicre/note | https://raw.githubusercontent.com/kicre/note/main/tem/main.typ | typst | #import "./beamer.typ": beamer
#show: beamer.with(
title: "",
author: "王恺",
date: ""
)
= 一级标题
== 二级标题
=== 三级标题
= 一级标题
== 二级标题 |
|
https://github.com/LDemetrios/ProgLectures | https://raw.githubusercontent.com/LDemetrios/ProgLectures/main/04-kotlin-generics.typ | typst | #import "kotlinheader.typ" : *
#show : kt-paper-rule
= Generics
== Мотивация
#kt-par[
Давайте рассмотрим `ArrayIntList`, который писали в ондой из прошлых лекций.
Оставим в нём только существенные методы, остальное по аналогии:
]
#kt-eval(
```
import java.util.*
class ArrayIntList {
private var arr = IntArray(16)
private var size: Int = 0
fun getSize() : Int = size
operator fun get(index: Int): Int {
if (index >= size || index < 0) {
throw ArrayIndexOutOfBoundsException("$index is out of bounds 0..<$size")
}
return arr[index]
}
fun add(element: Int) {
if (size == arr.size) {
arr = Arrays.copyOf(arr, arr.size + arr.size / 2 + 1)
}
arr[size] = element
size++
}
fun clear() {
size = 0
}
operator fun set(index: Int, element: Int) {
if (index >= size || index < 0) {
throw ArrayIndexOutOfBoundsException("$index is out of bounds 0..<$size")
}
arr[index] = element
}
override fun toString(): String = "[" + arr.joinToString() + "]"
}
```,
)
#kt-par[
... да и "значение по умолчанию" тоже уберём. В общем, получим практически такой
`List<`Int`>`, как в стандартной библиотеке.
]
#kt-par[
Но вот допустим, нам понадобилось то же самое, но для Long. Что теперь,
копировать целиком весь код, заменяя в нём "Int" на "Long"? Выглядит как _не очень_ идея.
]
#comment[
В C++, например, есть template: ```cpp
template<typename T>
class vector {
int _size;
int _capacity
T* _arr;
// ...
}
``` Фактически, при необходимости создаются копии этого кода, где `T` заменено
на то, на что надо (`int`, `long` и т.д.).
]
#kt-par[
И у нас есть механизм обобщения! Он называется generics. В объявлении класса
пишем
]
#kt(```
class ArrayList<ElementType> {
```)
#kt-par[
И теперь внутри пользуемся `ElementType`, как будто это какой-то конкретный тип:
]
#kt-eval(
```
class ArrayList<ElementType> {
private var arr : Array<Any?> = arrayOf()
private var size: Int = 0
fun getSize(): Int = size
operator fun get(index: Int): ElementType {
if (index >= size || index < 0) {
throw ArrayIndexOutOfBoundsException("$index is out of bounds 0..<$size")
}
return arr[index] as ElementType
}
fun add(element: ElementType) {
if (size == arr.size) {
arr = Arrays.copyOf(arr, arr.size + arr.size / 2 + 1)
}
arr[size] = element
size++
}
fun clear() {
size = 0
}
operator fun set(index: Int, element: ElementType) {
if (index >= size || index < 0) {
throw ArrayIndexOutOfBoundsException("$index is out of bounds 0..<$size")
}
arr[index] = element
}
override fun toString(): String = "[" + arr.joinToString() + "]"
}
```,
)
#kt-par[
Есть один нюанс: создать массив элементов неизвестного заранее типа нам не
позволят --- это связано с некоторыми особенностями внутреннего устройства JVM.
Поэтому создаём #box[массив Any?], которые, как мы знаем, есть наиболее общий
тип, и складываем всё туда. Ну и по схожим причинам начальный размер массива
делаем `0`, а не `16`, как в случае с Int.
]
#kt-par[
Из-за того, что массив теперь хранит Any?, нам приходится явно приводить его
элементы (as `ElementType`), когда мы их возвращаем. Это не проблема, так как
мы-то туда клали только `ElementType`, а значит, только они там и лежат!
]
#nobreak[
#kt-par[
Проверим, что работает:
]
#kt-eval-append(```
val intlist = ArrayList<Int>()
intlist.add(1)
intlist.add(2)
intlist.add(3)
intlist
```)
#kt-res(`[1, 2, 3]`, `ArrayList<Int>`)
]
#nobreak[
#kt-eval-append(`intlist[1]`)
#kt-res(`2`, KtInt)
]
#nobreak[
#kt-eval-append(```
intlist[1] = 4
intlist```)
#kt-res(`[1, 4, 3]`, `ArrayList<Int>`)
]
#nobreak[
#kt-eval-append(`intlist.add("abc")`)
#kt-comp-err(`Type mismatch. Required: Int. Found: String.`)
]
#kt-par[
А вот добавить строку в лист чисел у нас не выйдет, что логично: функция требует
на вход `ElementType`, который в данном случае Int.
]
#nobreak[
#kt-par[И наоборот,]
#kt-eval-append(```
val strlist = ArrayList<String>()
strlist.add("abc")
strlist
```)
#kt-res(`[abc]`, `ArrayList<String>`)
#kt-eval-append(`strlist[0] = 1`)
#kt-comp-err(`Type mismatch. Required: String. Found: Int.`)
#kt-par[..., в лист строк положить число не выйдет.]
]
#kt-par[
Удобно? А как это работает?
А очень просто. Параметры типов (те самые, написанные в треугольных скобках)
существуют только в момент компиляции. Компилятор знает, что в
`ArrayList<`String`>` класть Int и наоборот запрещено. А вот в момент исполнения
они все заменяются на Any?. То есть, у нас есть фактически одна реализация листа
--- `ArrayList<`Any?`>`, но за счёт подсказок компилятору мы избегаем лишних
приведений типов и проверок.
]
#kt-par[
Собственно, как вы могли догадаться, встроенные `List`, `MutableList` и `Array`
используют ровно этот же механизм.
]
#nobreak[
== Pair
#kt-par[
Мы умеем создавать структуры из нескольких элементов с помощью data class. Но
это имеет смысл, если это не просто набор элементов, а набор, несущий совокупный
смысл. Например, это не просто тройка чисел --- это вектор. Или это не просто
пара чисел --- это границы промежутка. А что если мы просто хотим временно
похранить пару чего-нибудь? Создавать под каждую отдельный класс? Нет, ведь мы
уже умеем сделать вот так:
]
]
#kt-eval(```
data class Pair<F, S>(val first: F, val second: S) {
override fun toString() = "($first, $second)"
}
```)
#kt-par[
... собственно, на этом содержательная часть пары заканчивается. Единственное,
что появилось нового --- здесь два параметра типов. Ну и обычно их называют, всё
же, одной заглавной буквой --- чтобы легко в коде отличать от содержательных
типов.
]
== Сортировка
#kt-par[
Теперь допустим, мы хотим написать функцию, которая сортирует элементы
изменяемого листа. Теперь нам нужно параметризовать функцию... и это тоже можно
делать!
]
#kt-eval(```
fun <T> sort(list: MutableList<T>) {
// Code here
}
```)
#kt-par[
Но с элементами неизвестного типа мы мало что можем сделать. На самом деле,
только то же, что с элементами Any? --- сравнивать на равенство, преобразовывать
в строку и считать хэшкод. Сравнивать их мы не умеем... Но, если помните,
однажды упоминалось, что у Int и String есть общий тип --- `Comparable`, что
означает, что их можно сравнивать. Давайте ограничим все возможные `T`
сравнимыми:
]
#kt-eval(```
fun <T : Comparable<T>> sort(list: MutableList<T>) {
// Code here
}
```)
#kt-par[
Тип Comparable здесь тоже параметризованный: его параметром является то, _с чем_ можно
сравнивать. Например, Int является `Comparable<`Int`>`, String является
`Comparable<`String`>`.
]
#comment[
#kt-par[
Вообще говоря, не обязательно реализовывать интерфейс `Comparable`, чтобы иметь
возможность сравниваться --- для этого достаточно operator fun` compareTo`.
`Comparable<T>` как раз один этот метод и содержит: поэтому хорошим тоном
является реализовать этот интерфейс, если возможно сравнение элементов типа.
]
]
#kt-par[
Давайте допишем сортировку и проверим.
]
#kt-eval(```
fun <T : Comparable<T>> isSorted(list: MutableList<T>): Boolean {
for (i in 1 until list.size) if (list[i - 1] > list[i]) return false
return true
}
fun <T : Comparable<T>> sort(list: MutableList<T>) {
while (!isSorted(list)) {
list.shuffle()
}
}
```)
#nobreak[
#kt-eval-append(```
val list = mutableListOf(10, 9, 8, 7, 6, 5, 4, 3, 2, 1)
sort(list)
list
```)
#kt-res(`[1, 2, 3, 4, 5, 6, 7, 8, 9, 10]`, `MutableList<Int>`)
#kt-par[
Отличнейшим образом работает.
]
]
== Either
#kt-par[
Ещё одно распространённое применение генериков. Допустим, в какой-то переменной
мы хотим хранить _либо_ Int, _либо_ String, и ничего больше. Мы можем назначить
ей тип `Comparable<*>`, конечно, но это не предохранит нас от того, чтобы туда
положили Double, например. Так давайте напишем специальный тип, который
традиционно называется `Either` (в Kotlin stdlib его нет, но его довольно часто
реализуют в своих проектах разработчики. В C++ есть такой тип, это
`std::variant`).
]
#kt-eval(
```
class Either<L, R> private constructor(
val isLeft: Boolean, private val value: Any?
) {
fun asLeft(): L = if (isLeft) value as L else throw IllegalStateException()
fun asRight(): R = if (!isLeft) value as R else throw IllegalStateException()
}
```,
)
#kt-par[
Осталось решить с конструированием. Оставить публичным конструктор мы не можем
--- мало ли что туда положат. Попробуем объявить два конструктора, от L и от R
]
#kt-eval(
```
class Either<L, R> private constructor(
val isLeft: Boolean, private val value: Any?
) {
constructor(l: L) : this(true, l)
constructor(r: R) : this(false, r)
fun asLeft(): L = if (isLeft) value as L else throw IllegalStateException()
fun asRight(): R = if (!isLeft) value as R else throw IllegalStateException()
}```,
)
#kt-comp-err(```
Conflicting overloads:
public constructor Either<L, R>(l: L) defined in generics.Either,
public constructor Either<L, R>(r: R) defined in generics.Either```)
#kt-par[
Почему конфликт? Ведь наборы аргументов разные? Во-первых, это оправдано
логически: а что, если вы захотите создать `Either<`Int`, `Int`>`? Тогда они
совпадут. Во-вторых, это оправдано со стороны JVM --- ведь для неё, как мы
помним, нет параметров типов --- происходит так называемое `type erasure`. С
точки зрения JVM есть два конструктора с единственным параметром типа Any? (на
самом деле для JVM наиболее общий тип --- `Object`, но не суть).
]
#nobreak[
#kt-par[
Так что нам понадобятся функции с разными именами.
]
#kt-eval(
```
class Either<L, R> private constructor(
val isLeft: Boolean, private val value: Any?
) {
constructor(l: L) : this(true, l)
constructor(r: R) : this(false, r)
fun asLeft(): L = if (isLeft) value as L else throw IllegalStateException()
fun asRight(): R = if (!isLeft) value as R else throw IllegalStateException()
companion object {
fun <L, R> fromLeft(value: L): Either<L, R> = Either(true, value)
fun <L, R> fromRight(value: R): Either<L, R> = Either(false, value)
}
}```,
)
]
#kt-par[
На самом деле, можно использовать генерики для довольно умных вещей. Например, мы хотим получить содержимое `Either`, не обращая внимания на то, "левое" оно или "правое". Если мы просто возьмём `value`, то получим тип Any?... а мы хотели умное. Давайте введём ещё один параметр типа:
]
#kt-eval(```
fun <C, L : C, R : C> Either<L, R>.content(): C = if(isLeft) asLeft() else asRight()
```)
#kt-par[
Что только что произошло? Мы сказали, что мы возвращаем не что-нибудь, а общий тип `L` и `R`. Обычно типы `L` и `R` компилятору известны --- они следуют из того, на чём вызывается метод. А дальше он просто выводит `C` как наиболее узкий подходящий тип.
... Мы ещё вернёмся к `Either`, когда побольше узнаем про лямбды...
] |
|
https://github.com/Functional-Bus-Description-Language/Specification | https://raw.githubusercontent.com/Functional-Bus-Description-Language/Specification/master/src/cover.typ | typst | #import "vars.typ"
#v(4cm)
#set align(center)
#text(18pt)[
*Functional Bus Description Language*
]
#text(11pt)[
Revision #vars.rev
#datetime.today().display("[day padding:none] [month repr:long] [year]")
]
#v(3cm)
#text(12pt)[
_Abstract_
]
#set align(left)
#par(justify: true)[
This document is the official specification of the Functional Bus Description Language.
Its primary purpose is to define the syntax and semantics of the language.
Functional Bus Description Language is a domain-specific language for bus and register management.
Its main characteristic is the paradigm shift from the register-centric approach to the functionality-centric approach.
In the register-centric approach, the user defines registers and then manually lays out the data into the registers.
In the functionality-centric approach, the user defines the functionality of the data, and the registers, module hierarchy, and access codes are later automatically inferred.
By defining the functionality of the data placed in the registers, it is possible to generate more code, increase code robustness, improve system design readability, and shorten the implementation process.
]
#v(4cm)
#par(justify: true)[
*keywords*:
bus interface,
code maintenance, computer languages, control interface,
design automation, design verification, documentation generation,
electronic design automation, EDA, electronic systems,
Functional Bus Description Language, FBDL,
hardware design, hardware description language, HDL, hierarchical register description,
memory,
programming,
register addressing, register synthesis,
software generation, system management
]
#pagebreak()
|
|
https://github.com/polarkac/MTG-Stories | https://raw.githubusercontent.com/polarkac/MTG-Stories/master/stories/046%20-%20Streets%20of%20New%20Capenna/005_The%20Side%20of%20Freedom.typ | typst | #import "@local/mtgstory:0.2.0": conf
#show: doc => conf(
"The Side of Freedom",
set_name: "Streets of New Capenna",
story_date: datetime(day: 30, month: 03, year: 2022),
author: "<NAME>",
doc
)
= Depth of the Caldaia
#emph[The side of freedom] , Vivien silently repeated Tezzeret's words.
That could mean a whole lot of things, especially coming from a man like Tezzeret. They'd fought each other on opposite sides during the War of the Spark, and while she'd never known him personally, she'd heard enough stories to get a general sense of the man.
Tezzeret had been known to look after himself foremost, which meant that there were innate risks to following him when they'd only just met.
Vivien adjusted her grip on her bow, holding it out for balance as they dropped down onto a lower girder suspended across the seemingly endless abyss of red smoke and industry that was the underbelly of New Capenna. Tezzeret glanced back as she landed lightly behind him, silent compared to the heavy metallic clang every time he fell to a lower rung. His long coat concealed most of his body, but given the noises, Vivien suspected a good portion of him was encased in metal of some kind. She was already trying to figure out the best place to shoot him if it came to that.
#figure(image("005_The Side of Freedom/01.jpg", width: 100%), caption: [Art by: <NAME>urray], supplement: none, numbering: none)
"Do you want to tell me where you're taking me?" As they retreated from even the farthest reaches of the city, the more curious Vivien became—and the more keenly aware of just how far away they now were from any other soul. #emph[Could this be a trap?]
"You'll see soon enough." He continued down along a long girder, his gray braided hair swaying behind him.
"Are you always this chatty?"
"Do I seem like the type who engages in small talk?" No, he didn't. "And I didn't think you were either."
"What do you know about me?" She didn't even bother trying to sound casual.
"I make it my job to know things about people, especially fellow planeswalkers. Why don't we say I know #emph[enough] ?" And that was too much.
She was still wary, but not on alert: despite his brevity, she didn't feel animosity or danger coming from him. Her senses were hard-won and honed by time and experience—Vivien trusted her gut and followed him deeper into the underbelly of this strange, new plane.
A steel web of titanic girders tightened around them, slowing their pace. Rebar, easily four times thicker than her thigh crossed between them, coated with dirt and grime that had collected into mountains over what must have been centuries. The filtered light turned faint and rusty, casting everything in an ominous hue.
#figure(image("005_The Side of Freedom/02.jpg", width: 100%), caption: [Art by: <NAME>], supplement: none, numbering: none)
Eventually, the metal buildings and their supports gave way to rock. The city of New Capenna did have a bottom, and it seemed they had finally, at long last, reached it. This deep, there was only the whisper of light buzzing through long-forgotten bulbs that flickered like the determined ghosts of the city's forefathers. The girders that supported New Capenna had been plunged through ruins and attached by rivet and screw to the rocky top of what appeared to be some giant plateau.
These ruins must have been the first Capenna. Its humble and early days were buried by the "progress" that pushed its people toward the skies. The way a wall had crumbled, claw marks still gouged into the stone, caught Vivien's eye. Perhaps it hadn't all been progress. Perhaps it had been recovery following some other devastation.
Vivien paused at the edge of a girder where it met a pile of rubble. Kneeling, she touched the dirt. It was packed hard, dry, and dead.
It had been a long time since the people of this city had connected with the earth that still strained to support them.
Tezzeret said nothing and led her deeper still. Down a winding path that cut into the plateau itself, he led her through crag and cave. Just when all light vanished, Tezzeret shrugged off his coat and crimson bloomed against the rough walls that surrounded them. The glow came from before him—within him—outlining his form in an ominous red. It turned his pale skin almost the same shade. Vivien drew an arrow from her quiver. Its green haze mingled with Tezzeret's vermilion as he turned.
"What is that?" she demanded.
"A show of trust and good faith." He motioned to the source of the light in his chest. It oozed between breaks in the metal plating that covered his body like haphazard bandages, replacing flesh entirely in some places. The plasma that took the place of bone and sinew was barely contained by the strips of metal. "The Planar Bridge."
"It's true; it wasn't destroyed." She'd only ever heard rumors.
Tezzeret smirked. "I see my reputation precedes me."
"More than you know." She kept her arrow nocked.
"It's harmless to you." Tezzeret shrugged. "But it looks quite ominous, doesn't it, the way it glows?" He inspected his arm as if it were someone else's, stitched to his body. "It changed after transporting #emph[them] across planes. Corrupted, perhaps~The process has become quite unpleasant for any other than myself," he mused.
"Them?"
Tezzeret returned to the present. "The praetors."
"Who?" She'd not heard the title before.
"The leaders of New Phyrexia"
The tiny hairs on the back of Vivien's neck stood on end. "You're working for New Phyrexia?" Kaya had fought one of them on Kaldheim, and word of their presence on Kamigawa had found its way to Vivien. They were a virus, a threat, and Tezzeret their main vector.
"I was," Tezzeret said. "I am. I'm saddled with the architect of the undoing of the Multiverse, the one being who would see all life bow to and become Phyrexia by force—<NAME>."
The bowstring was at her cheek in a breath, her opposite arm outstretched. Tezzeret had the audacity to grin down the edge of her arrow.
"Such sudden hostility. How will you ever make friends, Vivien?"
"I'm not sure if I want to be friends with my enemies." The words were rough. There was no greater crime against the whole Multiverse than aiding the horrors Phyrexia was unleashing.
"It's a regrettable necessity."
She took the bait. "In what way could working with <NAME> ever be a 'necessity?'"
"I don't yet have what was promised."
"Nothing <NAME> promised you justifies or excuses occupying, violating, or destroying life." Vivien's grip tightened further.
"I completely agree." That was the only thing he could've said to keep her from loosing her arrow and a whole menagerie of beasts with it. As if to make himself seem even more harmless, Tezzeret folded his hands behind his back. "I can't rightly use what Norn has promised me if life as we know it ceases to exist, or if I'm transformed. But I still need it all the same."
He was playing both sides. The tension in her shoulders relaxed some. He might not be an outright ally, but he wasn't solely an enemy, either. She could work with this, she hoped.
"My accomplice isn't far now; Urabrask will be able to tell you more." Tezzeret took a half step back. "I'm afraid I don't have the time to explain it all. I can't afford to linger. Norn will wonder where I am if I'm gone for too long."
Vivien took a full step forward and demanded, "Tell me more about Urabrask?"
"I'll tell you what you need to know: he's of no threat to you. In his current state, you could likely kill him with your bare hands." Tezzeret's eyes shone with the same shade as the magic swirling within him. "Are you going to kill me, or will you carry on, <NAME>?"
Her name on his tongue ran a chill down her spine. His eyes were full of power—full of knowing. Nothing about him could be trusted. Vivien knew it, and yet~
"Lead on." She'd come this far. She'd see it through.
They continued their descent through the tunnels. At once, the space opened to a massive cavern. At the far end was a wounded beast, large even as it huddled and fought for every breath it drew through its glistening beak. In the crimson light of Tezzeret's Planar Bridge, the beast's body looked all the more brutalized. Its flesh had been seared off from its inorganic components with horrifying precision. Vivien could imagine that the beast had been imposing, deadly, once. An apex predator. A pang of pity shot through her for its lost magnificence.
"Vivien, meet Urabrask," Tezzeret said. "Praetor of the Quiet Furnace."
#figure(image("005_The Side of Freedom/03.jpg", width: 100%), caption: [Art by: <NAME>], supplement: none, numbering: none)
Despite Urabrask's state, Vivien kept her distance. In part to make a quick escape. But also because her muscles had locked with shock. The wounded beast before her was a Phyrexian#emph[.]
"You betrayed me," Urabrask hissed to Tezzeret. It looked like Vivien wasn't the only one who didn't trust Tezzeret.
"Calm down, Urabrask," Tezzeret sighed. The sight of a mostly metal man shaking his head at a barely alive Phyrexian, as if the latter was a small child to be scolded, had Vivien reeling from the sheer oddity of it all. She had seen many marvelous and horrible things in her travels, but this might just be the strangest. "Quite the opposite. I brought us a new ally."
"I've promised nothing of the like." Vivien glanced between Tezzeret and Urabrask, running her fingertips over the fletching of her arrows. If she had to shoot, she'd shoot between them, sending spectral wolves to both.
"You consider New Phyrexia your enemy, don't you?" Tezzeret said.
That was putting it mildly. "You're not the only one who thinks the Phyrexians seizing control of the Multiverse is a bad idea, Tezzeret. In fact, welcome to the majority opinion."
"Then we're all on the same side. The enemy of my enemy is my friend."
"Why would #emph[you] be working against New Phyrexia?" Vivien focused on Urabrask. She could understand why Tezzeret, an underling, a non-Phyrexian auxiliary, might work against Elesh Norn. But a Phyrexian praetor?
Urabrask struggled to sit more upright, as if trying to gain some of the height and ferocity lost from whatever cruelty had been so clearly suffered. Just what happened to wound a Phyrexian so badly?
"Ele<NAME> has dominated all of New Phyrexia. Jin-Gitaxias, Vorinclex, and many of the Black Thanes have pledged themselves and their spheres to her grand vision. But I serve no one, and those I lead wish to be left alone. We do not share Norn's vision." Urabrask's claws raked softly against the stony ground in a movement that Vivien assumed was frustration. "Norn wants the Multiverse to be one singularity, for all life to be Phyrexian, and all Phyrexians to be under Norn. We do not consider that progress. I will not give her the Quiet Furnace."
Vivien slowly returned her arrow to its quiver as Urabrask spoke. Her better sense would have her firing on them. #emph[Kill them both while you can.] Phyrexia was the antithesis to all she stood for—a twisted parody of her arkbow's fusion of nature and artifice.
But~another instinct told her differently. Or, perhaps it was dangerous curiosity blooming.
Urabrask might be a praetor, and acting in Urabrask's sole benefit, just as Tezzeret was. But if Urabrask was telling the truth, then this praetor was also the enemy of her enemy. And, perhaps, there was an opportunity for some good here. It never hurt to have allies on the inside. Even better that Urabrask was uninterested in seeking out expansion at all costs.
"Do you really think you can stop Norn?" Vivien asked.
"Yes. I will lead a necessary challenge to Norn's control." #emph[A revolution, in not so many words] , Vivien thought. She did find it interesting that the Phyrexian didn't phrase it as such.
"How will you win?"
"Perhaps I will tell you when I know you can be trusted." Urabrask slowly slid back into a slouched position, as if sitting upright had become too much effort.
The irony of #emph[her] being the one out of the three who was considered untrustworthy was not lost on Vivien. "Very well. How can I prove myself?"
"You'll do a favor for us, of course," Tezzeret said. "I am limited in where I can go and what I can do without arousing suspicion. Moreover, Norn is still demanding I ferry Phyrexian troops and praetors; I can't risk being away for too long. Thus, I cannot stay with Urabrask throughout recovery from the tolls of the journey here."
#emph[The Planar Bridge did this to Urabrask?] Vivien appraised the Phyrexian from head to toe. It appeared the Planar Bridge was a fearsome power with all the finesse of a hatchet.
"What do you need?" she asked Urabrask directly.
"Time to heal and Halo. The latter is a magic substance of this plane that I need to study. Bring me Halo, be patient, and I will tell you how we will bring Norn down from the throne," Urabrask answered.
A simple agreement. Vivien could walk away at any point with what she already knew and relay Urabrask's revelations to the others. But if Urabrask wasn't lying, if there was more to know for want of a vial or two of Halo~
"You have a deal." Vivien turned, ready to begin the long climb back to the city proper.
"One more thing," Urabrask said, stopping her in her tracks. "While you hunt for Halo, there's someone else I need. Even if I had the strength to look for her, I can't move freely on this plane without suspicion."
"Who?"
"Elspeth, one of your kind. A planeswalker. Tezzeret spotted her on the surface but wouldn't risk approaching her due to their history."
"Elspeth," Vivien repeated, committing the name to memory. "What do you want with her?"
"Norn fears her. That is all I know."
And an enemy of Elesh Norn was someone Vivien wanted to know.
= THE STREETS OF NEW CAPENNA
Of the three levels of New Capenna, the Mezzio was Vivien's least favorite.
The depths of the Caldaia were laden with the haze and chorus of industry, but the constant thrumming made the city sound alive. There was a heartbeat. Those were the groaning, wrenching, exhausted noises of growth—even if it was of the industrial sort. And, of course, deep below was the earth itself, the closest connection New Capenna had to the natural.
Park Heights was all forced growth and carefully manicured nature. But there were parks containing real trees worthy of strolling whenever she found herself aching for something green and alive.
Sandwiched between them, she might have thought the Mezzio would find the balance of both worlds. But it had neither. It had all the commotion of the Caldaia, but none of the soul. Indulgence and overconsumption of others' labors reigned supreme. And everyone moved far too fast to stop and appreciate a dandelion springing, as determined as hope, from a sidewalk crack.
#figure(image("005_The Side of Freedom/04.jpg", width: 100%), caption: [Art by: <NAME>], supplement: none, numbering: none)
However, a benefit of all that movement was that no one ever paid her any mind. She could put her tracking and hunting skills to use to hear and see things. One moment she would be present, and the next she was gone, no one else the wiser. That skill was how she had ended up as an informant for an Obscura spy.
Vivien leaned against a shuttered storefront in a more subdued section of the Mezzio. It was busy enough that loitering didn't seem suspicious. Quiet enough that two could talk without raising voices.
Footsteps approached.
"Arrow," a shorter woman with russet skin and a navy bowler hat settled atop cropped, silken, black tresses murmured softly.
"Navy," Vivien replied without looking.
Their names for each other were intentionally unoriginal and inspired by their outfits so they couldn't be traced. Vivien had found a striking gold and hunter green coat that offset nicely against her dark brown skin. It opened to reveal a crisp white shirt and necktie that was reminiscent of an arrowhead.
"Tell me something good." Navy leaned against the railing opposite Vivien and pulled out a small notebook from her breast pocket. Vivien had seen it many times—a book of secrets, she'd surmised.
"I've heard a lot of talk about the Cabaretti moving the Font around regularly." Vivien had taken an interest in the Font initially as a possible source of Halo for Urabrask. But the Cabaretti kept it too guarded to make trying to steal it worthwhile and, moreover, #emph[everyone] in New Capenna was hunting for information about the Font. Which put their focus elsewhere and made it easier for Vivien to skim a little bit of Halo off the top, here and there, without being noticed. Fortunately, Urabrask didn't want large quantities of the substance.
"How regularly?"
"Daily."
The woman hummed thoughtfully. "Anything else?"
"There's talk of a lounge run by the Adversary. He uses it as his base of operations." This Adversary had also caught Vivien's attention early on. The Obscura said they ruled the shadows, governing the secrets of the city. But as far as Vivien could tell, it was the Adversary who held the real control.
"You know where?"
"Not yet, but I'll find out," Vivien lied. She'd absolutely uncovered where the Adversary's lounge was. But she wasn't going to share #emph[everything] she'd found, just enough to get the information she needed in return. Becoming too entrenched with the Obscura family—or #emph[any] family here in New Capenna—was where Vivien drew the line. She was a visitor and a bystander on this plane. She had no interest in further meddling.
"Let me know if you do."
"Of course." Vivien pushed away from the storefront. "You have anything for me?"
"No solid avenues for any substantial amount of Halo. I'd be a rich and powerful woman if I had that kind of information. I did hear that a little spot called Angel's Breath on the lower west side of town was getting a restock from the Cabaretti later today, might be able to lift a bottle, if you're careful." Navy still scribbled furiously in her notebook as Vivien went to leave.
"Oh, I got a lead on your Elspeth character, however." Vivien halted. "I hear there's been a woman taking odd jobs throughout the Mezzio, mostly on the main street by the station. Seems to favor construction, cleaners, or kitchens—simple manual labor, day jobs—nothing steady and keeps to herself. Hard to pin down. I'd say she's likely the one you're looking for. Not too many people with that name anymore. Good lu—"
Vivien didn't hear the rest. She was already off, racing through the now familiar back alleys and bridgeways of the industrial forest. She stopped by every construction site she knew of, cleaners, and kitchens. Just when she thought she'd lost the only possible lead she'd had, however slim it was, magic exploded, followed by shouts and screams.
She burst into a main artery of the city. People rushed into her, packing toward the edges of the street as a woman darted into a side alley, some Maestro enforcers on her heels. Fights weren't unheard of in the Mezzio. But the way the woman moved~pivoting, dodging their blows, keeping them at bay, even unarmed and outnumbered, all while avoiding the citizenry. The woman was better than every street brawler Vivien had ever seen.
#emph[It couldn't be, could it?]
Vivien gave chase. She scrambled up the side of a building with the ease of climbing a tree and perched herself on a lower rooftop. By the time she had a vantage to see that a fight had broken out, the woman had already rendered her attackers harmless.
She now spoke with an eager-looking vampire. But Vivien couldn't make out their conversation from the rooftop. Shifting onto her side, Vivien drew an arrow and fired toward the opposite side of the rooftop, where they couldn't see. A spectral squirrel shot out and promptly went skittering down the gutters, lurking just out of sight from the two. Through the magical creature, Vivien could hear their words as though she was right next to them.
"~You'll be jazzed to know that all young family members start in the museum up in Park Heights." The vampire came to a stop, holding out his hand. "Wait, where are my manners? Forgive me. I'm Anhelo." Vivien had heard the name whispered and had seen the museum—he was part of the Maestros.
The woman ignored the gesture, continuing to walk before she said, "Elspeth."
Vivien had found her; she was certain of it. But now she had a choice. Would she run right back to Urabrask? Or, would she first learn more about who this planeswalker was?
Urabrask still was nowhere close to being healed enough to be transported by way of Planar Bridge again. Which meant that Vivien would still be waiting and gathering Halo for him for at least a few weeks yet. She had time to get her own read on this Elspeth character before bringing her to the praetor.
Vivien wanted to find out for herself just what made Elspeth so special.
= A SHADY LOUNGE
Vivien hadn't managed to find a moment with Elspeth yet. Anhelo had taken her right to the Maestros' museum after Elspeth had agreed to join the family—which Vivien found to be a curious decision for a planeswalker. Vivien had stalked the museum, lurking as best she could and leveraging Navy's information to try and find a way in. But the Maestros were good at keeping their new recruits under lock and key until they were deemed "ready" to take on family business.
But, with any luck, Elspeth was finally ready, allowing Vivien to finally catch her alone for a word.
Navy's latest piece of information said that the Adversary was holding a gathering tonight and a Maestro would be in attendance. She'd also hinted the Obscura had recently seen Elspeth on the move for the Maestros. Vivien hoped against hope that the Maestro tonight would be Elspeth—it seemed a good enough mission for a new Maestro to cut their teeth on—and she could think of no better location for the Adversary to meet than the lounge Vivien had uncovered as one of the Adversary's bases of operations.
And if Elspeth didn't come, Vivien could at least find some additional Halo for Urabrask to study. The praetor had begun to look better as the weeks progressed. But he was still far from well.
Vivien sat at the counter, a sickening purple glow turning everything plum colored, her drink included. They had offered her Halo—an overt display of power to have so casually on the menu—but Vivien had refused. She'd tried Halo once for her own curiosity and information gathering, and after it went straight to her head with a rush of wild magic, she didn't need any more. It was a false strength that risked making her overconfident. A surplus of confidence led to mistakes, and Vivien needed her better senses about her.
#figure(image("005_The Side of Freedom/05.jpg", width: 100%), caption: [Art by: <NAME>], supplement: none, numbering: none)
The substance was potent and powerful, indeed. She could see why it held New Capenna in its grip. But she didn't yet know why Urabrask wanted it. Just holding it seemed to cause him to wince. Or, well, she assumed the expression shift was a wince. It wasn't always easy to gauge his emotions, given the beak and hollow eyes.
So, Vivien nursed a glass of something far less~exciting. The man behind the counter had given her a side-eye when she'd ordered water. But water was a very fine drink as far as Vivien was concerned, essential even.
The door to the lounge opened, and a young woman slipped in. Not Elspeth. But the woman was a Maestro without doubt—she had the steely eyes of a vampire.
Vivien set her drink down, cursing under her breath. Well, Elspeth wasn't the Maestro coming tonight. Time for Vivien to engage the backup plan.
"I've changed my mind, but I need to run. Could I have some of that Halo for the road?" Vivien asked the man serving patrons.
He snorted at the audacity of the question. "All drinks stay in house, boss's rules. He likes to be where the party is."
"Can't blame him for that." She flashed a coy grin. The man chuckled; he didn't seem to be too suspicious of her unconventional request. "I'll take one here, then." He reached for a bottle of Halo and a glass. "The boss is here tonight?"
"If you don't know the answer then that's not your business." The levity vanished.
Vivien eased away from the counter, holding her hands up. "I just hear things is all."
"This is a city of open ears and loose tongues if you ask me. Busy yours with Halo before I have to ask you to leave." He handed her a glass that swirled with a living rainbow.
"Cheers," Vivien murmured, watching him cross to the opposite end of the counter to speak with some other patrons. She shifted so her back was to them, pulling a small vial from the leather pouch at her hip. With a steady hand and a careful pour, Vivien could sneak some of the Halo out of the lounge and back to Urabrask without arousing suspicion. She'd done this movement enough times now that it was second nature.
It was because of her angle that she saw the Maestro slip out the back. In the brief crack of the door, she saw a familiar bowler hat. What was Navy doing here?
Vivien eased away from the counter, leaving the rest of the Halo behind. She couldn't take more without looking suspicious, and her internal alarm bells were already ringing loud and true. Navy had made it sound like she had no idea about this place when Vivien had brought it up. Glancing around, and trying to look as inconspicuous as possible, Vivien slinked into the shadows and approached the back door, still ajar.
"—everything is all set then?" Navy whispered.
"Yes, the Maestros loyal to the boss will be ready at the Crescendo."
"Good, he will reward you handsomely for your assistance. I'll pass along what you've told me." Navy was a double agent. Vivien wondered who held her true loyalty—the Obscura? The Adversary? Or was she like Tezzeret and only loyal to herself?
Movement at Vivien's left distracted her. A back wall opened, revealing a hidden door. Men and women spilled from the room. She heard a deep chuckle echo from the back somewhere. The sound was vaguely familiar. Menacing. Wrenching.
#emph[She'd heard that laughter somewhere before. ] But where?
Her curiosity would have to wait. The lounge was filling. Too many eyes to notice she didn't quite fit in.
Vivien made a hasty decision and slipped out the back door.
A sharp #emph[whizzing] noise had her dropping to a crouch. A flash of silver accompanied the movement of a person lunging for her. Then the reverberation of a #emph[thud] as the dagger sunk into the door where her neck had just been.
Navy loomed over her, panting softly, hand still on the dagger. The woman's eyes were wide with rage at being discovered. Vivien could almost smell the Halo on her—it was no doubt making Navy feel powerful enough to attack a clearly trained fighter like Vivien.
"I knew you would come if I waited long enough. You're so curious about the Adversary and the Maestros. Once you mentioned this place, I knew all I had to do was wait."
Vivien slowly reached toward the belts cinched at her waist. She hadn't brought her bow and quiver—they were much too conspicuous—but she hadn't come completely unarmed.
"Why are you after me?" They certainly weren't friends, but Vivien hadn't thought there was any animosity brewing between them.
"You're getting a bit too good at your job," Navy freed the dagger. "And the boss doesn't like people sniffing this close to his doorstep." She brought the dagger down toward Vivien's head.
Vivien sprung up; with one hand she caught Navy by her forearm. With the other, she drew her own dagger and, in a fluid motion, plunged it into the woman's gut. It was horribly easy. Navy wasn't a fighter.
A clatter rang out as Navy's knife hit the ground; she went limp in Vivien's arms. Vivien eased her down and against the alleyway wall.
"If you pull out this knife, you'll bleed out," Vivien said softly. "Leave it in, and you have about ten minutes to find help." She met Navy's eyes and held her gaze. The woman was younger than Vivien had thought. Young enough for Vivien to watch as Navy's own mortality dawned on her for the first time. "Go to your Obscura. Tell them the Adversary's goons did this; the Adversary is #emph[not] your family, and he #emph[will] let you die. The choice is yours."
Navy's body trembled from pain and shock. But she managed a nod.
As Vivien released the dagger, she noticed the notebook she'd seen scribbled in many times tucked in Navy's pocket. Without a second thought, she took it. Whatever an Obscura thought was important enough to write down must be very important indeed to be worth the risk.
"The price of your life." Vivien held up the notebook. Everything had a balance. Everything had a cost.
Growing noise from inside the lounge had Vivien on her feet, retreating into the night.
= PARK HEIGHTS
It was harder to move freely following the incident at the lounge. The Adversary's roots ran deep in the hearts and minds of the people of New Capenna.
None of her previous haunts were as safe as they once were. She couldn't even enjoy the trees of Park Heights. Not when there were enemies lurking in the shadows. Keeping her head low, Vivien consulted the note she'd taken from Navy's pocket.
#figure(image("005_The Side of Freedom/06.jpg", width: 100%), caption: [Art by: <NAME>], supplement: none, numbering: none)
This was the drop off point for Halo, and the bag was waiting just as the memo said it would be. Now, all she had to do was wait. Either the Maestro that came would be Elspeth, or they would be no one, and Vivien could strong-arm the substance away and be lost to the night.
A figure emerged from the gloom, stepping into the lamplight. Vivien instantly recognized her dark hair, khaki skin, bright brown eyes, and jaw set with determination. There was no doubt.
Elspeth.
Tonight was going better than Vivien could've hoped. She moved at the same time as Elspeth did for the bag, emerging from her cover in a few long strides to grab Elspeth's wrist.
"I was wondering who would come to collect." Vivien kept her voice low. There were others in the park, drawing near. It wouldn't serve her well to alert them too quickly.
"I forgot this earlier," Elspeth said. She was an awful liar.
"Don't lie. You don't seem cut out for it," Vivien said with a slight smile as she looked at the woman for the first time, close up, trying to determine what was so special about her by sight alone and coming up empty-handed. "You also don't seem cut out to work for one of these families, either."
Elspeth chuckled softly. "I have my reasons."
#emph[What could those be?] Whatever they were, they must be important for a planeswalker to meddle with local affairs. "I'm sure you do."
"I'm trying to learn more about the history of this plane," Elspeth admitted.
"Why?"
"It might be my home." A pang of surprise—and loss—shot through Vivien at Elspeth's soft sentiment. A lost home. She knew what that felt like all too well. Elspeth went on. "But more importantly, I think a threat is looming and I'm trying to get information on it."
"One most certainly is," Vivien said. "And we share motivations." She was surprised to learn Elspeth didn't seem to have any inkling of Urabrask's presence. But, without running into Tezzeret, neither would Vivien. And Urabrask had said Tezzeret had avoided approaching Elspeth due to some kind of "history" between them. "I'm Vivien, by the way."
"Elspeth."
Vivien refrained from telling her that she'd long since committed Elspeth's name to memory. That didn't seem like a good way to endear herself. "Who are you gathering information for?"
Elspeth hesitated.
Vivien was confident the woman as a planeswalker had a greater purpose than being a pawn for one of New Capenna's warring families. But she clearly also wasn't working for Urabrask. That left~"Let me guess, the Gatewatch?"
"Ajani sent me. Are you here on their behalf as well?"
"Originally no. But you know how these things happen. We might be able to—" Vivien jerked her head to the right. Her eyes narrowed slightly. Their time was running short. "The goons following you are catching up. I should go before they ask questions about me." Vivien released Elspeth's wrist. "But I might have some pertinent information for you on this threat."
"You do?" Elspeth took a step forward, voice falling to a whisper.
"I have a lead that could prove interesting. You could come with me and—"
"I can't," Elspeth said hastily. "I have a chance to learn how the New Capennans beat the threat before." #emph[Before?] What threat before? The ruins deep below with the claw marks flashed through Vivien's mind. There was more to New Capenna than what was on the surface, and secrets rarely stayed buried for eternity. "I can't leave until I have that information."
"Very well." They were indeed aligned. Moreover, Vivien was pleased that Elspeth seemed like a genuine person worthy of trust. "I'll look further into these matters also and contact you when I have more information."
"Why are you helping me?" Elspeth asked before Vivien could leave.
"Before you become too entrenched in this plane's affairs, you should have all the details of them," she said with a grave note. She needed to find more of her own information before she said too much. "Until we meet again."
"When?"
"When I have something worthwhile." Vivien gave a small nod. She wasn't going to bring Elspeth to Urabrask just yet. She had to earn the woman's trust first and gain more of her own information. "It's been a pleasure to meet you."
Vivien retreated into the underbrush. She looked back once at the woman and then down at the hand she'd used to grab Elspeth's wrist. Phantom pins pricked the flesh of her palm. That woman~She looked back to the bench to find Elspeth gone.
There was something special about her, indeed.
= THE UNDER-CAVERNS OF THE CALDAIA
"I found Elspeth," Vivien announced the moment she entered Urabrask's cavern deep below the city.
"You did?" Urabrask went still. "Why is she not with you?"
"She's not ready to leave yet~" Vivien said, recounting her interaction with Elspeth for him.
"Can we not make her 'ready'?"
"I doubt it," Vivien said plainly. Elspeth didn't seem the sort to be easily swayed when her mind was made up.
"Then we will wait," Urabrask said. "She is the key to our success. I will not depart without her—her spark will ignite my people and the Mirrans both."
"This city is nearly at its breaking point." Vivien had felt the balance shifting for some time, and the movements of the Adversary were only speeding up the process. "I suspect that when it does, Elspeth will know if she's found what she's looking for or not."
"Then break it faster."
Vivien bit back a snort. The Phyrexian clearly wasn't intending to be comical. Urabrask only spoke in a matter-of-fact way that held no sarcasm or levity.
"I will be ready when Elspeth is. We won't delay," Vivien said with a note that emphasized all this was still her choice. She was not blindly taking orders from a praetor. "Plus, I know just where to find her when the time comes."
The Maestro had told Navy that there would be those who had infiltrated the upcoming Crescendo, and the notebook Navy held had notes that further corroborated the revelation. Either Elspeth would be among them, which Vivien doubted, considering she didn't seem like the sort who would align herself with the Adversary. Or, she would be fighting against them. No matter what, Vivien would bet Elspeth would be at the Crescendo and that would be the start of the end of New Capenna as it was.
"The Adversary won't be the only one laying traps at the upcoming Crescendo," Vivien vowed.
"I advise caution toward him," Urabrask said. "Tezzeret mentioned he is a planeswalker, too."
Vivien had growing suspicion. "Did he say who?"
"The demon," he said unhelpfully.
"Demon? Lovely." She grabbed up her bow and quiver, already wracking her brain for who it might be. That laughter still haunted her. "I'll be needing these then. When I'm done and return with Elspeth, we will finalize just how you're helping the Gatewatch, and how we're helping you with this revolution of yours."
Urabrask dipped his long head. "The Planar Bridge will destroy my body when I return to New Phyrexia. It has taken me weeks to recover here, and I suspect it shall take just as long on my return. But the time is almost right for me to make the journey."
"Good." Vivien started back out of the caverns, running her fingertips along the fletching of her arrows in thought. #emph[There could actually be a path toward containing the relentless expansion of New Phyrexia] , it seemed almost too impossible to fathom.
But, first thing's first, she needed to get to Elspeth, and the Crescendo would be her best shot~and Vivien never missed her mark.
#figure(image("005_The Side of Freedom/07.jpg", width: 100%), caption: [Art by: <NAME>], supplement: none, numbering: none)
|
|
https://github.com/Student-Smart-Printing-Service-HCMUT/ssps-docs | https://raw.githubusercontent.com/Student-Smart-Printing-Service-HCMUT/ssps-docs/main/contents/categories/task2/2.2.typ | typst | Apache License 2.0 | #pagebreak()
== Sequence diagram
_Draw an Sequence diagram to capture the business process between systems and the stakeholders in Task
Assignment module_\
#figure(caption: "Sequence diagram of Upload file",
image("../../images/Upload_Sequence_Diagram.png")
)
*Mô tả về quá trình upload file của sinh viên lên hệ thống.*
#block(inset:(left:1cm))[
- Sau khi sinh viên lựa chọn file cần in và chỉnh sửa các thông số in, sinh viên sẽ click vào button "Confirm" để tiến hành đặt in.
- Object PrintingOrderPage sẽ gọi method Route(Upload) của Object FileRouter để xử lý.
- Object FileRouter sẽ gọi method Handler(Request) của Object FileHandler để xử lý.
- Object FileHandler sẽ gọi method Store(File) của Object FileStorage để xử lý.
+ Nếu file được lưu thành công, Object FileHandler sẽ gọi method Store(Metadata) của Object FileModel để xử lý.
+ Nếu file được lưu không thành công, Object FileStorage sẽ trả về kết quả thất bại cho Object FileRouter và các Object còn lại lần lượt trả về kết quả thất bại.
- Nếu model được tạo thành công, Object FileMOdel sẽ gọi method Save(File) của Object FileDatabase để xử lý.
- Nếu model được tạo không thành công, Object FileModel sẽ trả về kết quả thất bại cho Object FileHandler và các Object còn lại lần lượt trả về kết quả thất bại.
]
#figure(caption: "Sequence diagram of Preview and Remove file",
image("../../images/Preview_Sequence_Diagram.png")
)
*Mô tả về quá trình preview file của sinh viên lên hệ thống.*
#block(inset:(left:1cm))[
- Sau khi sinh viên upload file lên hệ thống, sinh viên sẽ được chuyển đến trang List of uploads & configured document.
- Object PrintingOrderPage sẽ gọi method Route(Preview) của Object FileRouter để xử lý.
- Object FileRouter sẽ gọi method Handler(Request) của Object FileHandler để xử lý.
- Object FileHandler sẽ gọi method Find(Model) của Object FileModel để xử lý.
- Object FileModel sẽ gọi method Find(Metadata) của Object FileDatabase để xử lý.
- Object FileDatabase sẽ trả về kết quả thành công cho Object FileModel.
- Object FileModel sẽ trả về kết quả thành công cho Object FileHandler.
- Object FileHandler sẽ trả về kết quả thành công cho Object FileRouter.
- Object FileRouter sẽ trả về kết quả thành công cho Object PrintingOrderPage.
- Object PrintingOrderPage sẽ hiển thị thông tin của file cho người dùng.
]
*Mô tả về quá trình remove file của sinh viên lên hệ thống.*
#block(inset:(left:1cm))[
- Sau khi sinh viên upload file lên hệ thống, sinh viên sẽ được chuyển đến trang List of uploads & configured document.
- Object PrintingOrderPage sẽ gọi method Route(Remove) của Object FileRouter để xử lý.
- Object FileRouter sẽ gọi method Handler(Request) của Object FileHandler để xử lý.
- Object FileHandler sẽ gọi method Find(Model) của Object FileModel để xử lý.
- Object FileModel sẽ gọi method Find(Metadata) của Object FileDatabase để xử lý.
- Object FileDatabase sẽ trả về Metadata của file cho Object FileModel.
- Object FileStorage sẽ tự gọi method Delete(File) của mình để xóa file ra khỏi cloud storage.
- Object FileModel sẽ trả về kết quả thành công cho Object FileHandler.
- Object FileHandler sẽ gọi method Delete(Model) của Object FileModel để xử lý.
- Object FileModel sẽ gọi method Delete(Metadata) của Object FileDatabase để xử lý.
- Object FileDatabase sẽ trả về kết quả thành công cho Object FileModel.
- Object FileModel sẽ trả về kết quả thành công cho Object FileHandler.
- Object FileHandler sẽ trả về kết quả thành công cho Object FileRouter.
- Object FileRouter sẽ trả về kết quả thành công cho Object PrintingOrderPage.
- Object PrintingOrderPage sẽ hiển thị thông báo thành công cho người dùng.
]
#figure(caption: "Sequence diagram of Checkout",
image("../../images/Checkout_Sequence_Diagram.png")
)
*Mô tả về quá trình Confirm Order của sinh viên lên hệ thống.*
#block(inset:(left:1cm))[
- Sau khi sinh viên lựa chọn file cần in và chỉnh sửa các thông số in (lịch in, vị trí phòng in, phương thức thanh toán), sinh viên sẽ click vào button "Confirm" để tiến hành đặt in.
- Object PrintingOrderPage sẽ gọi method Route(Checkout) của Object OrderRouter để xử lý.
- Object OrderRouter sẽ gọi method Handler(Request) của Object OrderHandler để xử lý.
- Object OrderHandler sẽ gọi method Get_User(User) của Object UserModel để lấy ra model của sinh viên.
- Object UserModel sẽ gọi method Get_Coins(User) của Object UserDatabase để lấy ra số coins của sinh viên.
- Object UserDatabase sẽ trả về số coins của sinh viên cho Object UserModel.
- Object UserModel sẽ trả về kết quả thành công cho Object OrderHandler.
+ Nếu số coins của sinh viên không đủ để thanh toán, Object OrderHandler sẽ trả về kết quả thất bại cho Object OrderRouter và các Object còn lại lần lượt trả về kết quả thất bại.
+ Nếu số coins của sinh viên đủ để thanh toán, Object OrderHandler sẽ tiến hành cập nhật lại số coins của sinh viên thông qua method Update(User) của Object UserModel.
- Object OrderHandler sẽ gọi method Create(Model) của Object OrderModel để tạo model của order.
- Object OrderModel sẽ gọi method Create(Order) của Object OrderDatabase để tạo order.
+ Nếu order được tạo thành công, Object OrderModel sẽ gọi method Save(Order) của Object OrderDatabase để lưu order.
+ Nếu order được tạo không thành công, Object OrderDatabase sẽ trả về kết quả thất bại cho Object OrderModel và các Object còn lại lần lượt trả về kết quả thất bại.
] |
https://github.com/Midbin/cades | https://raw.githubusercontent.com/Midbin/cades/main/README.md | markdown | MIT License | # [Cades](https://github.com/Midbin/cades)
Draw QR codes in typst.
```typ
#import "@preview/cades:0.3.0": qr-code
= QR Code for `typst.app`:
#qr-code("https://typst.app", width: 3cm)
```
## Documentation
### `qr-code`
Draw a qr code to an image.
#### Arguments
* `content`: `str` - the content of the qr code
* `width`: `length`|`auto` - the width of the qr code, default is `auto`
* `height`: `length`|`auto` - the height of the qr code, default is `auto`
* `color`: `color` - the color of the qrcode, default is `black`
* `background`: `color` - the background color behind the qrcode, default is `white`
* `error-correction`: `"L"`|`"M"`|`"Q"`|`"H"` - the error correction level for the qr code, default is `"M"`
#### Returns
The image, of type `content`.
## Acknowledgements
This package uses [Jogs](https://github.com/Enter-tainer/jogs) by [<NAME>](https://github.com/Enter-tainer) and the qr code rendering code is based on [qrcode-svg](https://github.com/papnkukn/qrcode-svg/) by [papnkukn](https://github.com/papnkukn). |
https://github.com/bojohnson5/iu_dissertation | https://raw.githubusercontent.com/bojohnson5/iu_dissertation/main/iu_dissertation.typ | typst | MIT License | #let thesis(
title: none,
author: none,
dept: none,
year: none,
month: none,
day: none,
committee: (),
dedication: none,
acknowledgement: [],
abstract: [],
doc,
) = {
set text(font: "Linux Libertine", size: 12pt)
show par: set block(spacing: 1.5em)
set par(leading: 1.5em, first-line-indent: 1em)
set page(numbering: "i", margin: (x: 1in, y: 1in),
paper: "us-letter",
footer: locate(loc => {
if counter(page).at(loc).first() > 1 [
#align(center)[#counter(page).display("i")]
]
})
)
show heading.where(level: 1): it => {
counter(math.equation).update(0)
it
}
show math.equation: it => {
if it.has("label") {
math.equation(block: true,
numbering: it1 => {
locate(loc => {
let count = counter(heading.where(level: 1)).at(loc).last()
numbering("(1.1)", count, it1)
})
}, it)
}
else {
it
}
}
show ref: it => {
let el = it.element
if el != none and el.func() == math.equation {
link(el.location(),
locate(loc => {
let count = counter(heading.where(level: 1)).at(loc).last()
numbering("(1.1)", count, counter(math.equation).at(el.location()).at(0) + 1)
})
)
}
else {
it
}
}
grid(
columns: (1fr),
rows: (1fr, 1fr, 1fr),
align(center + horizon, text(16pt)[#smallcaps([#title])]),
align(center + horizon)[#author],
align(center + horizon)[Submitted to the Faculty of the Gradute School \ in partial fulfillment of the requirements \ for the degree \ Doctor of Philosophy \ in the Department of #dept, \ Indiana University \ #month #year],
)
pagebreak()
align(center)[Accepted by the Graduate Faculty, Indiana University, in partial fulfillment of the requirements for the degree of Doctor of Philosophy.]
v(2em)
[Doctoral Committee]
v(3em)
for member in committee {
[
#align(right)[#line(length: 50%, stroke: 0.5pt)]
#v(-0.75em)
#align(right)[#member.name, #member.title]
#v(3em)
]
}
v(1fr)
align(left)[#day #month #year]
pagebreak()
align(center + horizon)[Copyright \u{00a9} #year \ #author]
pagebreak()
if dedication != none {
sym.zws
v(-2em)
align(center + horizon)[#emph[#dedication]]
pagebreak()
}
text(15pt)[#align(center)[
*Acknowlegements*
]]
v(1em)
[#acknowledgement]
pagebreak()
align(center)[#author]
v(1em)
align(center, text(16pt)[#smallcaps([#title])])
v(1em)
[#abstract]
pagebreak()
show outline: set par(leading: 0.65em)
show outline.entry.where(
level: 1
): it => {
v(12pt, weak: true)
it
}
outline(indent: auto)
pagebreak()
outline(target: figure.where(kind: image),
indent: auto,
title: [List of Figures]
)
pagebreak()
outline(target: figure.where(kind: table),
indent: auto,
title: [List of Tables]
)
pagebreak()
set page(numbering: "1",
footer: align(center)[#counter(page).display("1")]
)
set heading(numbering: "1.1.1.")
show heading: it => [
#v(12pt)
#it
#v(12pt)
]
show heading.where(level: 1): it => {
set par(leading: 0.65em)
pagebreak(weak: true)
align(center)[Chapter
#locate(loc => counter(heading).at(loc).first())\
#it.body
#v(12pt)
]
}
doc
}
#let iuquote(body) = {
set par(leading: 0.65em)
pad(x: 30pt, y: 15pt, body)
}
|
https://github.com/erictapen/typst-invoice | https://raw.githubusercontent.com/erictapen/typst-invoice/main/lib.typ | typst | MIT No Attribution | #import "@preview/tablex:0.0.8": gridx, hlinex
#import "@preview/cades:0.3.0": qr-code
#import "@preview/ibanator:0.1.0": iban
// Generates an invoice
#let invoice(
// The invoice number
invoice-nr,
// The date on which the invoice was created
invoice-date,
// A list of items
items,
// Name and postal address of the author
author,
// Name and postal address of the recipient
recipient,
// Name and bank account details of the entity receiving the money
bank-account,
// Optional VAT
vat: 0.19,
// Check if the german § 19 UStG applies
kleinunternehmer: false,
) = {
set text(lang: "de", region: "DE")
set page(paper: "a4", margin: (x: 20%, y: 20%, top: 20%, bottom: 20%))
// Typst can't format numbers yet, so we use this from here:
// https://github.com/typst/typst/issues/180#issuecomment-1484069775
let format_currency(number, locale: "de") = {
let precision = 2
assert(precision > 0)
let s = str(calc.round(number, digits: precision))
let after_dot = s.find(regex("\..*"))
if after_dot == none {
s = s + "."
after_dot = "."
}
for i in range(precision - after_dot.len() + 1){
s = s + "0"
}
// fake de locale
if locale == "de" {
s.replace(".", ",")
} else {
s
}
}
set text(number-type: "old-style")
smallcaps[
*#author.name* •
#author.street •
#author.zip #author.city
]
v(1em)
[
#set par(leading: 0.40em)
#set text(size: 1.2em)
#recipient.name \
#recipient.street \
#recipient.zip
#recipient.city
]
v(4em)
grid(columns: (1fr, 1fr), align: bottom, heading[
Rechnung \##invoice-nr
], [
#set align(right)
#author.city, *#invoice-date.display("[day].[month].[year]")*
])
let total = items.map((item) => item.price).sum()
let items = items.enumerate().map(
((id, item)) => ([#str(id + 1).], [#item.description], [#format_currency(item.price)€],),
).flatten()
[
#set text(number-type: "lining")
#gridx(
columns: (auto, 10fr, auto), align: ((column, row) => if column == 1 { left } else { right }), hlinex(stroke: (thickness: 0.5pt)), [*Pos.*], [*Beschreibung*], [*Preis*], hlinex(), ..items, hlinex(), [], [
#set align(end)
Summe:
], [#format_currency((1.0 - vat) * total)€], hlinex(start: 2), [], [
#set text(number-type: "old-style")
#set align(end)
#str(vat * 100)% Mehrwertsteuer:
], [#format_currency(vat * total)€], hlinex(start: 2), [], [
#set align(end)
*Gesamt:*
], [*#format_currency(total)€*], hlinex(start: 2),
)
]
v(2em)
[
#set text(size: 0.8em)
Vielen Dank für die Zusammenarbeit. Die Rechnungssumme überweisen Sie bitte
innerhalb von 14 Tagen ohne Abzug auf mein unten genanntes Konto unter Nennung
der Rechnungsnummer.
#if kleinunternehmer [
Gemäß § 19 UStG wird keine Umsatzsteuer berechnet.
]
]
v(1em)
// This is the content of an https://en.wikipedia.org/wiki/EPC_QR_code version 002
// Eventually this could be put into its own package?
let epc-qr-content = (
"BCD\n" + "002\n" + "1\n" + "SCT\n" + bank-account.bic + "\n" + bank-account.name + "\n" + bank-account.iban + "\n" + "EUR" + format_currency(total, locale: "en") + "\n" + "\n" + invoice-nr + "\n" + "\n" + "\n"
)
grid(columns: (1fr, 1fr), gutter: 1em, align: top, [
#set par(leading: 0.40em)
#set text(number-type: "lining")
#(bank-account
.at("gender", default: (:))
.at("account_holder", default: "Kontoinhaberin")): #bank-account.name \
Kreditinstitut: #bank-account.bank \
IBAN: *#iban(bank-account.iban)* \
BIC: #bank-account.bic
], qr-code(epc-qr-content, height: 4em))
[
Steuernummer: #author.tax_nr
#v(0.5em)
Mit freundlichen Grüßen
#if "signature" in author [
#scale(origin: left, x: 400%, y: 400%, author.signature)
] else [
#v(1em)
]
#author.name
]
}
|
https://github.com/jonmatthis/simple-typst | https://raw.githubusercontent.com/jonmatthis/simple-typst/main/template.typ | typst | = Hey look its a `typst` file
Wowo _italics_ *bold*
- hi
- wowo
1. wowowo
2. wsow
3. thing
1. number thing
Here's a link - https://typst.app
Typst seems nice, but f it's f-ing bs freemium app jfc 🙄 |
|
https://github.com/curvenote-templates/ncssm | https://raw.githubusercontent.com/curvenote-templates/ncssm/main/ncssm.typ | typst | MIT License | // #import "@preview/pubmatter:0.1.0"
#import "pubmatter/pubmatter.typ"
#import "@preview/scienceicons:0.0.6": curvenote-icon
#let leftCaption(it) = {
set text(size: 8pt)
set align(left)
set par(justify: true)
text(weight: "bold")[#it.supplement #it.counter.display(it.numbering)]
"."
h(4pt)
set text(fill: black.lighten(20%), style: "italic")
it.body
}
#let template(
frontmatter: (),
heading-numbering: "1.1.1",
kind: none,
paper-size: "us-letter",
// The path to a bibliography file if you want to cite some external works.
page-start: none,
max-page: none,
// The paper's content.
body
) = {
let fm = pubmatter.load(frontmatter)
let dates;
if ("date" in fm and type(fm.date) == "datetime") {
dates = ((title: "Published", date: fm.date),)
} else {
dates = date
}
// Set document metadata.
set document(title: fm.title, author: fm.authors.map(author => author.name))
let theme = (color: rgb("#C18849"), font: "Noto Sans")
set page(
paper: paper-size,
margin: (left: 25%),
header: pubmatter.show-page-header(theme: theme, fm),
footer: block(
width: 100%,
stroke: (top: 1pt + gray),
inset: (top: 8pt, right: 2pt),
[
#set text(font: theme.font, size: 9pt, fill: gray.darken(50%))
Morganton Scientific | Volume 1 | 2023 - 2024
#h(1fr)
#counter(page).display()
]
),
)
if (page-start != none) {counter(page).update(page-start)}
state("THEME").update(theme)
let logo = [
#image("logo.png")
#v(-13pt)
#align(left)[
#text(size: 19pt, weight: "bold", fill: rgb("#000000"), font: theme.font)[Morganton Scientific]
#v(-6pt)
#text(size: 12pt, style: "italic", weight: "light", fill: rgb("#000000"), font: theme.font)[North Carolina School of Science and Mathematics]
]
#v(5pt)
#set par(justify: true)
#text(size: 6pt, fill: black.lighten(20%), font: theme.font)[
Journal of Student STEM Research
]
// #text(size: 6pt, fill: black.lighten(40%), font: theme.font)[
// ISSN: 2575-9752
// ]
]
show link: it => [#text(fill: theme.color)[#it]]
show ref: it => {
if (it.element == none) {
// This is a citation showing 2024a or [1]
show regex("([\d]{1,4}[a-z]?)"): it => text(fill: theme.color, it)
it
return
}
// The rest of the references, like `Figure 1`
set text(fill: theme.color)
it
}
// Set the body font.
set text(font: "Noto Serif", size: 9pt)
// Configure equation numbering and spacing.
set math.equation(numbering: "(1)")
show math.equation: set block(spacing: 1em)
// Configure lists.
set enum(indent: 10pt, body-indent: 9pt)
set list(indent: 10pt, body-indent: 9pt)
// Configure headings.
set heading(numbering: heading-numbering)
show heading: it => locate(loc => {
// Find out the final number of the heading counter.
let levels = counter(heading).at(loc)
set text(10pt, weight: 400)
if it.level == 1 [
// First-level headings are centered smallcaps.
// We don't want to number of the acknowledgment section.
#let is-ack = it.body in ([Acknowledgment], [Acknowledgement],[Acknowledgments], [Acknowledgements])
// #set align(center)
#set text(if is-ack { 10pt } else { 12pt })
#show: smallcaps
#v(20pt, weak: true)
#if it.numbering != none and not is-ack {
numbering(heading-numbering, ..levels)
[.]
h(7pt, weak: true)
}
#it.body
#v(13.75pt, weak: true)
] else if it.level == 2 [
// Second-level headings are run-ins.
#set par(first-line-indent: 0pt)
#set text(style: "italic")
#v(10pt, weak: true)
#if it.numbering != none {
numbering(heading-numbering, ..levels)
[.]
h(7pt, weak: true)
}
#it.body
#v(10pt, weak: true)
] else [
// Third level headings are run-ins too, but different.
#if it.level == 3 {
numbering(heading-numbering, ..levels)
[. ]
}
_#(it.body):_
]
})
if (logo != none) {
place(
top,
dx: -33%,
float: false,
box(
width: 27%,
{
if (type(logo) == "content") {
logo
} else {
image(logo, width: 100%)
}
},
),
)
}
// Title and subtitle
pubmatter.show-title-block(fm)
let corresponding = fm.authors.filter((author) => "email" in author).at(0, default: none)
let margin = (
if corresponding != none {
(
title: "Correspondence to",
content: [
#corresponding.name\
#link("mailto:" + corresponding.email)[#corresponding.email]
],
)
},
(
title: [Open Access #h(1fr) #pubmatter.show-license-badge(fm)],
content: [
#set par(justify: true)
#set text(size: 7pt)
#pubmatter.show-copyright(fm)
]
),
if fm.at("github", default: none) != none {
(
title: "Data Availability",
content: [
Source code available:\
#link(fm.github, fm.github)
],
)
},
).filter((m) => m != none)
place(
left + bottom,
dx: -33%,
dy: -10pt,
box(width: 27%, {
set text(font: theme.font)
if (kind != none) {
show par: set block(spacing: 0em)
text(11pt, fill: theme.color, weight: "semibold", smallcaps(kind))
parbreak()
}
if (dates != none) {
let formatted-dates
grid(columns: (40%, 60%), gutter: 7pt,
..dates.zip(range(dates.len())).map((formatted-dates) => {
let d = formatted-dates.at(0);
let i = formatted-dates.at(1);
let weight = "light"
if (i == 0) {
weight = "bold"
}
return (
text(size: 7pt, fill: theme.color, weight: weight, d.title),
text(size: 7pt, d.date.display("[month repr:short] [day], [year]"))
)
}).flatten()
)
}
v(2em)
grid(columns: 1, gutter: 2em, ..margin.map(side => {
text(size: 7pt, {
if ("title" in side) {
text(fill: theme.color, weight: "bold", side.title)
[\ ]
}
set enum(indent: 0.1em, body-indent: 0.25em)
set list(indent: 0.1em, body-indent: 0.25em)
side.content
})
}))
}),
)
place(
left + bottom,
dx: -33%,
dy: 20pt,
box(width: 27%, {
link("https://curvenote.com")[#text(size: 8pt)[#curvenote-icon(color: rgb("#355E98")) #text(fill: rgb("#355E98"), font: "Avenir")[Published by Curvenote]]]
}),
)
pubmatter.show-abstract-block(fm)
show par: set block(spacing: 1.4em)
show raw.where(block: true): (it) => {
set text(size: 8pt)
block(fill: luma(240), width: 100%, inset: 10pt, radius: 1pt, it)
}
show figure.caption: leftCaption
set figure(placement: auto)
set bibliography(title: text(10pt, "References"), style: "ieee")
show bibliography: (it) => {
set text(7pt)
set block(spacing: 0.9em)
it
}
// Display the paper's contents.
body
}
|
https://github.com/kilpkonn/msc-thesis | https://raw.githubusercontent.com/kilpkonn/msc-thesis/master/abstract.typ | typst | Rust is a general-purpose systems programming language that guarantees memory safety without the need for a garbage collector.
With on-par performance with C/C++, Rust attempts to challenge C/C++'s position in the market by providing better tooling and a better developer experience.
The Rust type system is similar to many functional programming languages as it features a rich type system, including sum and product types.
Developer experience is more similar to that of high-level functional programming languages than C/C++.
However, Rust does not have a tool for term search -- automatic program synthesis based on types.
Yet we believe it is a perfect candidate for one with its expressive type system.
In this thesis, we extend the official Rust language server `rust-analyzer` with a term search tool.
In addition to program synthesis, we experiment with using term search for autocompletion.
We develop the algorithm for term search in three iterations.
The first iteration is the simplest algorithm that follows one that is used in Agsy, a similar tool for Agda.
The second iteration improves on the first by reversing the search direction, simplifying the caching of intermediate results.
In the final iteration, we implement a bidirectional search.
This algorithm can synthesize terms in many more situations than in previous iterations,
without a significant decrease in performance.
To evaluate the performance of our algorithm, we run it on 155 popular open-source Rust libraries.
We delete parts of their source code, creating "holes".
We then let the algorithm re-synthesize the missing code,
and measure how many holes the algorithm can fill and how often the algorithm suggests the original code.
As an outcome of this thesis, we also upstream our tool to the official `rust-analyzer`.
The thesis is written in English and is #context counter(page).at(<end>).first() pages long,
including #context counter(heading).at(<conclusion>).first() chapters,
#context counter(figure.where(kind: image)).final().first() figures
#context counter(figure.where(kind: raw)).final().first() code listings and
#context counter(figure.where(kind: table)).final().first() tables.
|
|
https://github.com/yhtq/Notes | https://raw.githubusercontent.com/yhtq/Notes/main/常微分方程/作业/2100012990 郭子荀 常微分方程 7.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: note.with(
title: "作业7",
author: "YHTQ",
date: none,
logo: none,
withOutlined : false,
withTitle : false,
withHeadingNumbering: false
)
= 5.13 p190
== 2.(1)
先解齐次线性微分方程组:
$
vec(y, z)' = mat(0, 1;1, 0) vec(y, z)
$
设:
$
A := mat(0, 1;1, 0)
$
特征值为 $1, -1$,对应特征向量为:
$
xi_1 = vec(1, 1)\
xi_(-1) = vec(1, -1)
$
一个基础解矩阵为:
$
(e^x vec(1, 1), e^(-x) vec(1, -1))
$
做常数变易,设:
$
vec(y, z) = (e^x vec(1, 1), e^(-x) vec(1, -1)) U\
vec(y, z)' = (e^x vec(1, 1), e^(-x) vec(1, -1)) U' + (e^x vec(1, 1), e^(-x) vec(1, -1))' U\
= mat(0, 1;1, 0) vec(y, z) + vec(2, 1)e^x\
(e^x vec(1, 1), e^(-x) vec(1, -1)) U' = vec(2, 1)e^x\
mat(e^x, e^(-x);e^x, -e^(-x)) U' = vec(2, 1) e^x\
mat(e^(-x), e^(-x);e^(x), -e^(x))mat(e^x, e^(-x);e^x, -e^(-x)) U' = mat(e^(-x), e^(-x);e^(x), -e^(x)) vec(2 e^x, e^x) \
mat(2, 0;0, 2) U' = vec(3, e^(2 x))\
U' = vec(3/2, 1/2 e^(2 x))\
U = vec(3/2 x, 1/4 e^(2 x) )\
vec(y, z) = mat(e^x, e^(-x);e^x, -e^(-x)) vec(3/2 x, 1/4 e^(2 x) ) = vec(3/2 x e^x + 1/4 e^x, 3/2 x e^x - 1/4 e^x)\
$
这就求得一个特解,原方程的通解就是:
$
vec(3/2 x e^x + 1/4 e^x, 3/2 x e^x - 1/4 e^x) + (e^x vec(1, 1), e^(-x) vec(1, -1)) vec(C_1, C_2)
$
== 3.(1)
先解齐次线性微分方程组:
$
vec(y, z)' = mat(0, 1;-1, 0) vec(y, z)
$
设 $A = mat(0, 1;-1, 0)$ 特征值为 $i, -i$,对应特征向量为:
$
xi_i = vec(1, i)\
xi_(-i) = vec(1, -i)
$
一个基础解矩阵为:
$
(e^(i x) vec(1, i), e^(-i x) vec(1, -i)) = mat(
cos x + i sin x, cos x -i sin x;
i cos x - sin x, -i cos x - sin x
)
$
找到两个基解:
$
mat(cos x, sin x; -sin x, cos x)
$
设非齐次方程的解:
$
vec(y, z) = mat(cos x, sin x; -sin x, cos x) U\
$
则有:
$
mat(cos x, sin x; -sin x, cos x) U' = vec(tan^2 x - 1, tan x)\
mat(cos x, sin x; -sin x, cos x) mat(cos x, -sin x; sin x, cos x) U' = mat(cos x, sin x; -sin x, cos x) vec(tan^2 x - 1, tan x)\
U' = vec((sin^2 x)/(cos x) - cos x + (sin^2 x)/(cos x), - (sin^3 x)/(cos^2 x) + sin x + sin x)\
U = vec(arctanh(sin x) - 2 sin x,-3 cos x - 1/(cos x))\
vec(y, z) = mat(cos x, sin x; -sin x, cos x) vec(arctanh(sin x) - 2 sin x + C_1,-3 cos x - 1/(cos x) + C_2)
$
== 4
先用常数变易,设 $y = e^(A x) U$,有:
$
y' = A y + f(x) = A e^(A x) U + e^(A x) U' \
f(x) = e^(A x) U'\
U = integral e^(-A x) f(x) dif x\
y = e^(A x) (integral_0^x e^(-A t) f(t) dif t + C)\
$
$y$ 以 $omega$ 为周期当且仅当:
$
e^(A omega) e^(A x) (integral_0^x e^(-A t) f(t) dif t + integral_x^(x + omega) e^(-A t) f(t) dif t + C) = e^(A x) (integral_0^x e^(-A t) f(t) dif t + C)\
e^(A omega) (integral_0^x e^(-A t) f(t) dif t + integral_x^(x + omega) e^(-A t) f(t) dif t + C) = integral_0^x e^(-A t) f(t) dif t + C\
(e^(A omega) - I) C = (I - e^(A omega)) integral_0^x e^(-A t) f(t) dif t - e^(A omega) integral_x^(x + omega) e^(-A t) f(t) dif t
$
因此若设 $e^(A omega) - I$ 可逆,上式即可解出符合要求的 $C$,这等价于 $e^(A omega)$ 没有特征值 $1, A$ 没有特征值 $0$
反之有 $A$ 有特征值零,也即不满秩,设 $A xi = 0$,考虑方程:
$
y' = A y + xi
$
不难验证 $t xi$ 是一个特解,通解为:
$
t xi + e^(A x) C
$
不难验证该方程没有以 $omega$ 为周期的解,证毕
= 5.15 p210
== 1
=== (1)
对应特征多项式:
$
lambda^2 + lambda - 2 = 0\
(lambda + 2)(lambda - 1) = 0\
$
因此通解就是 $linearCombinationC(e^x, e^(-2 x))$
=== (3)
对应特征多项式:
$
lambda^4 - 5 lambda^2 + 4 = 0\
(lambda^2 - 4)(lambda^2 - 1) = 0\
$
四个解分别是 $2, -2, 1, -1$,因此通解是:
$
linearCombinationC(e^(2 x), e^(-2 x), e^x, e^(-x))
$
=== (5)
先解齐次方程,对应特征多项式:
$
lambda^2 - 4 lambda + 8 = 0\
lambda = 2 plus.minus 2 i
$
两个解为 $e^(2x)(cos 2 x + i sin 2 x), e^(2 x)(cos 2 x - i sin 2 x)$,找到两个实解:
$
e^(2 x) cos 2 x, e^(2 x) sin 2 x
$
再试求特解。先求:
$
y'' - 2 y' + 8 y = e^(2 x)
$
的特解,猜测其形如 $k e^(2 x)$,代入得:
$
4 k - 4 k + 8 k = 1\
k = 1/8
$
因此一个特解为 $1/8 e^(2 x)$\
再求 $y'' - 2 y' + 8 y = sin 2 x$,猜测其特解为 $s cos 2 x + t sin 2 x$,代入得:
$
- 4 s cos 2 x - 4 t sin 2 x - 2(2 t cos 2 x - 2 s sin 2 x) + 8(s cos 2 x + t sin 2 x) = sin 2 x\
cases(
8 s - 4 t - 4 s = 0,
8 t + 4 s - 4 t = 1
)
$
得 $s = t = 1/8$,特解为 $1/8 (cos 2 x + sin 2 x)$\
综上,原方程通解为:
$
1/8 (cos 2 x + sin 2 x + e^(2 x)) + linearCombinationC(e^(2 x) cos 2 x, e^(2 x) sin 2 x)
$
== 3
#let lc = linearCombination(name: $c$)
#let g_s = ($e^(lambda_1 x)$, $e^(lambda_2 x)$)
先做常数变易,设解 $y = #(linearCombination(..g_s))$,求一阶导:
$
y' = #(linearCombination(name : $C'$, ..g_s)) + linearCombinationC(lambda_1 e^(lambda_1 x), lambda_2 e^(lambda_2 x))
$
令 $#(linearCombination(name : $C'$, ..g_s)) = 0$,再求导:
$
y'' = #(linearCombination(name : $C'$, $lambda_1 e^(lambda_1 x)$, $lambda_2 e^(lambda_2 x)$)) + linearCombinationC(lambda_1^2 e^(lambda_1 x), lambda_2^2 e^(lambda_2 x))
$
代入原方程:
$
#(linearCombination(name : $C'$, $lambda_1 e^(lambda_1 x)$, $lambda_2 e^(lambda_2 x)$)) + linearCombinationC(lambda_1^2 e^(lambda_1 x), lambda_2^2 e^(lambda_2 x))\
+ a(linearCombinationC(lambda_1 e^(lambda_1 x), lambda_2 e^(lambda_2 x))) + b(#(linearCombination(..g_s))) = f(x)\
#(linearCombination(name : $C'$, $lambda_1 e^(lambda_1 x)$, $lambda_2 e^(lambda_2 x)$)) = f(x)
$
解出 $C_1, C_2$:
$
C'_2 (lambda_2 - lambda_1) e^(lambda_2 x) = f(x)\
C'_2 = 1/ (lambda_2 - lambda_1) f(x) e^(-lambda_2 x)\
C'_1 = 1/ (lambda_1 - lambda_2) f(x) e^(-lambda_1 x)\
C_2 = integral_0^x 1/ (lambda_2 - lambda_1) f(t) e^(-lambda_2 t) dif t\
C_1 = integral_0^x 1/ (lambda_1 - lambda_2) f(t) e^(-lambda_1 t) dif t
$
最终得:
$
y = 1/(lambda_2 - lambda_1) (e^(lambda_2 x) integral_0^x f(t) e^(-lambda_2 t) dif t - e^(lambda_1 x) integral_0^x f(t) e^(-lambda_1 t) dif t)
$
可设通解为:
$
y = 1/(lambda_2 - lambda_1) (e^(lambda_2 x) (integral_0^x f(t) e^(-lambda_2 t) dif t + C_1) - e^(lambda_1 x) (integral_0^x f(t) e^(-lambda_1 t) dif t + C_2))\
= e^(lambda_1 x)/(lambda_2 - lambda_1 x) (e^((lambda_2 - lambda_1 )x) (integral_0^x f(t) e^(-lambda_2 t) dif t + C_1) - (integral_0^x f(t) e^(-lambda_1 t) dif t + C_2))
$
注意到要使上式有界,考虑 $x -> -infinity$ 必有 $(e^((lambda_2 - lambda_1 )x) (integral_0^x f(t) e^(-lambda_2 t) dif t + C_1) - (integral_0^x f(t) e^(-lambda_1 t) dif t + C_2)) -> 0$,而由 $f$ 有界知无穷积分:
$
integral_(-infinity)^(x) f(t) e^(-lambda_1 t) dif t
$
存在,因此 $(integral_0^x f(t) e^(-lambda_1 t) dif t + C_2)$ 趋于常数,$e^((lambda_2 - lambda_1 )x) (integral_0^x f(t) e^(-lambda_2 t) dif t + C_1)$ 也趋于常数,可得 $integral_0^x f(t) e^(-lambda_2 t) dif t + C_1$ 趋于零,进而:
$
integral_0^x f(t) e^(-lambda_2 t) dif t + C_2 = integral_(-infinity)^(x) f(t) e^(-lambda_2 t) dif t\
$
利用洛必达法则可得:
$
e^((lambda_2 - lambda_1 )x) integral_(-infinity)^(x) f(t) e^(-lambda_2 t) dif t = (integral_(-infinity)^(x) f(t) e^(-lambda_2 t) dif t)/(e^((lambda_1 - lambda_2) x) ) -> 0
$
从而 $integral_0^x f(t) e^(-lambda_2 t) dif t + C_1 -> 0$,有:
$
integral_0^x f(t) e^(-lambda_1 t) dif t + C_1 = integral_(-infinity)^(x) f(t) e^(-lambda_1 t) dif t
$
综上解只能是:
$
1/(lambda_2 - lambda_1) (e^(lambda_2 x) integral_(-infinity)^x f(t) e^(-lambda_2 t) dif t - e^(lambda_1 x) integral_(-infinity)^x f(t) e^(-lambda_1 t) dif t )
$
而:
$
abs(e^(lambda_2 x) integral_(-infinity)^x f(t) e^(-lambda_2 t) dif t)
&<= e^(lambda_2 x) integral_(x)^(-infinity) abs(f(x)) e^(-lambda_2 t) dif t\
&<= M e^(lambda_2 x) integral_(x)^(-infinity) e^(-lambda_2 t) dif t\
&= M e^(lambda_2 x) e^(-lambda_2 x)\
&= M
$
类似也可证明另一部分也有界,进而有界
对于第一个命题,设此特解为 $y_0$,通解为 $y_0 + C_1 e^(lambda_1 x) + C_2 e^(lambda_2 x)$,由 $lambda_1, lambda_2 < 0$ 知结论当然正确
对于第二个命题,可以验证若 $f(x)$ 是周期函数则:
$
e^(lambda x) integral_(-infinity)^x f(t) e^(-lambda t) dif t, forall lambda < 0
$
都是周期函数,因此 $y_0$ 当然是周期函数
= p238
== 1
=== (1)
$1, -1$ 是常点,$0$ 是正则奇点,既然方程等价于:
$
x^2 y'' + x(1-x) y' + x^2 y = 0
$
且 $1-x$ 非负
=== (2)
$1, -1$ 是正则奇点,$0$ 是非正则奇点,既然方程等价于:
$
2(1-x^2)y'' + 2/x^3 y' + 2/x^2 y = 0
$
$x^3$ 导致三重极点的出现
=== (3)
$1, -1$ 是正则奇点,$0$ 非正则,原因同上
== 2
#let sumn(s) = $sum_(n=#s)^(+infinity)$
== (1)
方程等价于:
$
2 x^2 y'' + x y' + x^2 y = 0
$
容易验证 $0$ 是正规奇点,指标方程形如:
$
rho (rho - 1) + rho = 0\
rho^2 = 0
$
因此选取 $rho = 0$ 即可,也即可设:
$
y = sumn(0) a_n x^n
$
代入方程:
$
2 x sumn(2) n (n-1) a_n x^(n-2) + sumn(1) n a_n x^(n-1) + x sumn(0) a_n x^n = 0\
2 sumn(2) n (n-1) a_n x^(n-1) + sumn(1) n a_n x^(n-1) + sumn(0) a_n x^(n+1) = 0\
a_1 x^0 + 2 sumn(1) (n+1) n a_(n+1) x^(n) + sumn(1) (n+1) a_(n+1) x^(n) + sumn(1) a_(n-1) x^n = 0\
a_1 x^0 + sumn(1) ((2 n + 1) (n+1) a_(n+1) + a_(n-1)) x^n = 0
$
得到方程:
$
a_1 = 0\
(2 n + 1) (n+1) a_(n+1) + a_(n-1) = 0
$
可得 $n$ 为奇数时 $a_n = 0$,为偶数时有:
$
a_n = - 1/2 1/(n ( n - 1/2)) a_(n-2) = ... = (-1/2)^(n/2) 1/(n!! (n -1/2)!!) a_0
$
先取 $a_0 = 1$,在二阶常系数微分方程中,设 $y_2$ 是另一个线性无关的解,及:
$
W = Det(y_1, y_2;y'_1, y'_2)
$
熟知:
$
W' = -a(x) W = -1/(2 x) W
$
解得:
$
W = C x^(-1/2)
$
无妨设 $W = x^(-1/2)$,有:
$
y_1 y'_2 - y_2 y'_1 = x^(-1/2)
$
设 $y_2 = u y_1$ 有:
$
u' y_1^2 = x^(-1/2)\
u = integral y_1^(-2)(x) x^(-1/2) dif x\
y_2 = y_1(x) integral y_1^(-2)(x) x^(-1/2) dif x
$
== (2)
方程等价于:
$
x^2 y'' + x y' - x y= 0
$
同样可以验证是正规奇点,指标方程为:
$
rho(rho - 1) + rho = 0
$
同样取 $rho = 0$ 也即设:
$
y = sumn(0) a_n x^n
$
代入得:
$
x sumn(2) n (n-1) a_n x^(n-2) + sumn(1) n a_n x^(n-1) - sumn(0) a_n x^n = 0\
sumn(2) n (n-1) a_n x^(n-1) + sumn(1) n a_n x^(n-1) - sumn(0) a_n x^(n) = 0\
sumn(1) (n+1) n a_(n+1) x^n + sumn(0) (n+1) a_(n+1) x^(n) - sumn(0) a_n x^(n) = 0\
$
得到方程:
$
a_1 = a_0\
(n+1) n a_(n+1) + (n+1) a_(n+1) = a_n\
a_n = (n+1)^2 a_(n+1)\
a_n = (1/(n!))^2 a_0
$
因此可设:
$
y_1 = sumn(0) (1/(n!))^2 x^n
$
类似之前的过程设:
$
W = Det(y_1, y_2;y'_1, y'_2)
$
有:
$
W' = - 1/x W\
W = 1/x \
y_1 y'_2 - y_2 y'_1 = 1/x\
$
设 $y_2 = u y_1$,有:
$
u' y_1^2 = 1/x\
u = integral_()^() 1/(x y_1^2 (x)) dif x\
y_2 = y_1(x) integral_()^() 1/(x y_1^2 (x)) dif x
$
|
|
https://github.com/janekx21/bachelor-thesis | https://raw.githubusercontent.com/janekx21/bachelor-thesis/main/readme.md | markdown | # Bachelor Thesis
by <NAME>
# Development
Use the `flake.nix` for installing Typst and utils.
```shell
typst watch main.typ
```
TODO:
- https://link.springer.com/book/10.1007/978-1-4842-7792-8
|
|
https://github.com/chrischriscris/Tareas-CI5651-EM2024 | https://raw.githubusercontent.com/chrischriscris/Tareas-CI5651-EM2024/main/tarea08/src/main.typ | typst | #import "template.typ": conf, question, pseudocode, GITFRONT_REPO
#show: doc => conf("Tarea 8: Divide y Vencerás/Programación Dinámica", doc)
#question[
Considere un polinomio formado por los números de su carné, donde el i–ésimo
número corresponde al coeficiente para $x^i$.
Por ejemplo, si su carné es `12-02412`, entonces el polinomio será:
$ P (x) &= 1x^0 + 2x^1 + 0x^2 + 2x^3 + 4x^4 + 1x^5 + 2x^6 \
&= 1 + 2x + 2x^3 + 4x^4 + x^5 + 2x^6 $
Calcule y muestre el resultado de aplicar la DFT (Transformada Discreta de
Fourier) al polinomio obtenido, usando las *raíces octavas* de la unidad.
][
En este caso, el carné a considerar es `18-10892`, por lo que el polinomio es:
$ P (x) &= 1x^0 + 8x^1 + 1x^2 + 0x^3 + 8x^4 + 9x^5 + 2x^6 \
&= 1 + 8x + x^2 + 8x^4 + 9x^5 + 2x^6 $
Con esto, el vector de coeficientes es $(1, 8, 1, 0, 8, 9, 2, 0)$, ya que
debemos completar hasta tener un vector de coeficientes de tamaño $2^k$.
Luego, las raíces octavas de la unidad vendrán dadas por
$omega^k = e^((pi k)/4 i) $, con $k in [0..7]$.
Corriendo el algoritmo `FFT` con este vector obtenemos el siguiente resultado
(comenzando por $omega$):
$ "FFT"((1, 8, 1, 0, 8, 9, 2, 0), e^(pi/4 i)) &\
=
&(29, -7 - i - e^(pi/4 i), 6 + 17i, -7 + i + e^((3pi)/4 i),\
&-5, -7 - e^(pi/2 i) + e^(pi/4 i), 6 - 17i, -7 + e^(pi/2 i) - e^((3pi)/4 i))\
= &(29, -7 - sqrt(2) / 2 - (sqrt(2)/2 + 1) i, 6 + 17i, -7 + sqrt(2) / 2 + (1 - sqrt(2)/2)i,\
&-5, -7 + sqrt(2) / 2 + (sqrt(2)/2 - 1)i, 6 - 17i, -7 - sqrt(2) / 2 + (sqrt(2)/2 + 1)i) $
Lo que corresponde a $(P(omega^0), P(omega^1), dots, P(omega^7))$.
][
Considere un número entero positivo $X$. Definimos la función $"decomp"(X)$ como
la cantidad de enteros positivos $a$, $b$, $c$ y $d$ de tal forma que
$a b + c d = X$.
$ "decomp"(X) = |{(a, b, c, d) : a, b, c, d > 0 and a b + c d = X}| $
Dado un número $N$ , queremos hallar el máximo valor para $"decomp"(X)$ donde
$1 <= X <= N$.
Diseñe un algoritmo que permita encontrar la respuesta en $O(N log N)$.
_Nota: Puede suponer que todas las operaciones aritméticas, incluyendo
multiplicaciones, divisiones y módulos se hacen en O(1)_.
*Pistas:*
- ¿De cuántas formas se puede descomponer $N$ en dos sumandos $a$ y $b$, tal que $a+b = N$?
- ¿De cuántas formas se puede descomponer $N$ en dos factores $a$ y $b$, tal que $a times b = N$?
- ¿Que relación existe entre la cantidad de divisores de un número y su
descomposición en factores primos?
- La Criba de Eratóstenes se puede usar para ver si un número es primo. ¿Se podrá
modificar para calcular algo más?
- Un cambio de perspectiva pudiera ser de utilidad.
][
Notemos lo siguiente:
- Para $X < 2$ el valor de $"decomp"(X)$ es $0$.
- $N$ tiene $N - 1$ descomposiciones en dos sumandos mayores que 0, que vienen
dadas por $1 + (N - 1), 2 + (N - 2), dots, (N - 1) + 1$.
- Por otro lado, $N$ tiene tanta descomposiciones en dos factores como divisores,
las cuales vendrán dadas por $d_1 times (N / d_1), d_2 times (N / d_2), dots, d_k times (N / d_k)$,
donde $d_1, d_2, dots, d_k$ son los divisores de $N$. Llamemos $D_N$ a la
cantidad de divisores de $N$.
- Para cada forma de descomponer $N$ en dos sumandos, podemos descomponer cada
sumando en dos factores de $D_i$ y $D_j$ formas respectivamente.
Teniendo esto en cuenta, podemos expresar el valor de $"decomp"(X)$ como:
$ "decomp"(X) = sum_(i=1)^(X-1) D_i D_(X-i) $
El problema se reduce a hallar el máximo de esta expresión en el rango
$1 <= X <= N$.
(Sin terminar ...)
][
Sea $P = {(x_1 , y_1 ), (x_2 , y_2 ), dots, (x_n , y_n )}$ un conjunto de $n$
puntos.
Para cualquier subconjunto $C subset.eq P$ , definimos la lejanía de $C$ como la
multiplicación de la distancia horizontal hasta el origen más grande en $C$
por la distancia vertical hasta el origen más grande en $C$ (nótese que no
necesariamente es el mismo punto quien tiene estos máximos).
$ "lejania"(C) = (max_((x, y) in C) |x|) times (max_((x, y) in C) |y|) $
Queremos realizar una partición de $P$ en subconjuntos $C_1 , C_2 , dots, C_m$
de tal forma que
#align(center)[
#box(height: 10pt)[
#columns(2)[
- $C_1 union C_2 union dots union C_m = P$
- $C_1 sect C_2 sect dots sect C_m = emptyset$
]
]
]
La cantidad $m$ de subconjuntos que forma la partición es libre, entre $1$ y $n$.
La lejanía de la partición es la suma de las lejanías de los conjuntos que lo
conforman.
$ "lejania"(C_1 union C_2 union dots union C_m) = "lejania"(C_1) + "lejania"(C_2) + dots
+ "lejania"(C_m) $
Diseñe un algoritmo que permita hallar una partición con mínima lejanía en
$O(n log n)$, usando memoria adicional $O(n)$.
*Pistas:*
- ¿Existen puntos en la entrada que son redundantes?
- ¿Dar un orden a los puntos nos permitiría considerar *subsecuencias* en lugar de
*subconjuntos*?
- La geometría es un área muy útil de las matemáticas.
][
F
]
|
|
https://github.com/typst/packages | https://raw.githubusercontent.com/typst/packages/main/packages/preview/delegis/0.2.0/delegis.typ | typst | Apache License 2.0 | // sentence number substitution marker
#let s = "XXXXXXSENTENCEXXXNUMBERXXXXXX"
/// Create an unmarkes section, such as a preamble.
/// Usage: `#unnumbered[Preamble]`
#let unnumbered = (it, ..rest) => heading(level: 6, numbering: none, ..rest, it)
/// Manually create a section. Useful when unsupported characters are used in the heading.
/// Usage: `#section[§ 3][Administrator*innen]`
#let section = (number, it, ..rest) => unnumbered({number + "\n" + it}, ..rest)
/// Initialize a delegis document.
#let delegis = (
// Metadata
title : "Vereinsordnung zur IT-Infrastruktur",
abbreviation : "ITVO",
resolution : "3. Beschluss des Vorstands vom 24.01.2024",
in-effect : "24.01.2024",
draft : false,
// Template
logo : none,
// Overrides
size : 11pt,
font : "Atkinson Hyperlegible",
lang : "de",
paper: "a5",
str-draft : "Entwurf",
str-intro : (resolution, in-effect) => [Mit Beschluss (#resolution) tritt zum #in-effect in Kraft:],
// Content
body
) => {
/// Metadata
set document(title: title + " (" + abbreviation + ")", keywords: (title, abbreviation, resolution, in-effect))
/// General Formatting
let bg = if draft {
rotate(45deg, text(100pt, fill: luma(85%), font: font, str-draft))
} else {}
set page(paper: paper, numbering: "1 / 1", background: bg)
set text(hyphenate: true, lang: lang, size: size, font: font)
/// Clause Detection
show regex("§ ([0-9a-zA-Z]+) (.+)$"): it => {
let (_, number, ..rest) = it.text.split()
heading(level: 6, numbering: none, {
"§ " + number + "\n" + rest.join(" ")
})
}
/// Heading Formatting
set heading(numbering: "I.1.A.i.a.")
show heading: set align(center)
show heading: set text(size: size, weight: "regular")
show heading.where(level: 1): set text(style: "italic")
show heading.where(level: 2): set text(style: "italic")
show heading.where(level: 3): set text(style: "italic")
show heading.where(level: 4): set text(style: "italic")
show heading.where(level: 5): set text(style: "italic")
show heading.where(level: 6): set text(weight: "bold")
/// Outlines
show outline.entry: it => {
show linebreak: it => {} // disable manual line breaks
show "\n": " " // disable section number line breaks
it
}
set outline(indent: 1cm)
show outline: it => {
it
pagebreak(weak: true)
}
/// Sentence Numbering
show regex(s): it => {
counter("sentence").step()
super(strong(counter("sentence").display()))
}
show parbreak: it => {
counter("sentence").update(0)
it
}
/// Title Page
page(numbering: none, {
place(top + right, block(width: 2cm, logo))
v(1fr)
show par: set block(spacing: .6em)
if draft {
text[#str-draft:]
} else {
par(text(str-intro(resolution, in-effect)))
}
par(text(2em, strong[#title (#abbreviation)]), leading: 0.6em)
v(3cm)
})
// Metadata once again. Needs to be down here to have the page size set.
// Can be used with `typst query`, e.g.:
//
// `typst query example.typ "<title>" --field value --one` returns `"[title]"`
[
#metadata(title)<title>
#metadata(abbreviation)<abbreviation>
#metadata(resolution)<resolution>
#metadata(in-effect)<in-effect>
]
// allow footnotes that don't conflict with sentence numbers
set footnote(numbering: "[1]")
/// Content
body
} |
https://github.com/Enter-tainer/typstyle | https://raw.githubusercontent.com/Enter-tainer/typstyle/master/tests/assets/typstfmt/148-broken-input.typ | typst | Apache License 2.0 | #cite(
// Newline
= Level 1
== Level 2
Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua.
|
https://github.com/typst-community/guidelines | https://raw.githubusercontent.com/typst-community/guidelines/main/src/chapters/style/trailing.typ | typst | Creative Commons Attribution Share Alike 4.0 International | #import "/src/util.typ": *
#import mantys: *
= Trailing Content Arguments
Prefer trailing content argument calling style `#func(...)[...]` only for short runs of arguments directly.
Trailing content arguments are harder to visually separate for complex or large amounts of arguments such as tables with multiple rows and make refactoring more noisy in diffs.
#do-dont[
```typst
#link("https://github.com")[github.com]
#custom[a][b]
```
][
```typst
// most tables
#table[a][b][c]
```
]
|
https://github.com/El-Naizin/cv | https://raw.githubusercontent.com/El-Naizin/cv/main/cv.typ | typst | Apache License 2.0 | #import "brilliant-CV/template.typ": *
#show: layout
#cvHeader(hasPhoto: true, align: left)
#autoImport("education")
#autoImport("professional")
#autoImport("projects")
#autoImport("certificates")
#autoImport("publications")
#autoImport("skills")
#cvFooter()
|
https://github.com/Amelia-Mowers/typst-tabut | https://raw.githubusercontent.com/Amelia-Mowers/typst-tabut/main/doc/example-snippets/only-cells.typ | typst | MIT License | #import "@preview/tabut:<<VERSION>>": tabut-cells
#import "usd.typ": usd
#import "example-data/supplies.typ": supplies
#tabut-cells(
supplies,
(
(header: [Name], func: r => r.name),
(header: [Price], func: r => usd(r.price)),
(header: [Quantity], func: r => r.quantity),
)
) |
https://github.com/kdog3682/2024-typst | https://raw.githubusercontent.com/kdog3682/2024-typst/main/src/clip.typ | typst | #import "/home/kdog3682/2024-typst/src/base-utils.typ": *
#import "/home/kdog3682/2024-typst/src/dialogue-functions.typ": *
#import "/home/kdog3682/2024-typst/src/exponent-rules.typ": exponent-rules
#import "/home/kdog3682/2024-typst/src/dialogue.header.typ": header as math-front-matter
#import "/home/kdog3682/2024-typst/src/page-templates.typ"
#import "/home/kdog3682/2024-typst/src/utility-components.typ": *
#let speakers = ("Kloe", "Kaylee")
#let longest = get-longest((speakers))
#let speaker-width = longest * 10pt
#let dialogue-item = dialogue-item.with(speaker-width: speaker-width)
#show math.equation: set text(size: 1.1em)
#show par: set block(spacing: 1.75em)
#set par(leading: 0.68em)
show: page-templates.dialogue
// this calls the function
#show math.equation: (it) => {
if it.fields().block == true {
v(10pt)
set par(leading: 1.5em)
it
v(10pt)
} else {
it
}
}
#math-front-matter(
student-group: "ravenclaw",
title: "Multiplying Exponents",
topic: "Exponents I",
)
#dialogue-item(speaker: "Kaylee", [
$x dot x dot x$ means $x^#xblue(1) dot x^#xblue(1) dot x^#xblue(1)$.
])
#dialogue-item(speaker: "Kloe", [
And it equals $x^#xblue(3)$.
])
#dialogue-item(speaker: "Kaylee", [
Look Kloe, $1 + 1 + 1 = #xblue(3)$.
#v(10pt)
And on the other side, we have $x^#xblue(3)$.
#v(10pt)
Could this be a concidence?
])
#dialogue-item(speaker: "Kloe", [
I think not!
#v(10pt)
Try this question Kaylee: #wde("x^100 * x^1")
])
#dialogue-item(speaker: "Kaylee", [
Does it equal $display(x^(#xblue(100) #xplus() #xblue(1)) #xarrow() x^#xblue(101))$?
])
#dialogue-item(speaker: "Kloe", [
It does!\
You have just discovered the first exponent rule.
#exponent-rules(1)
#v(10pt)
Give this question a try.
#findx("a^1 * a^2 * a^3 = a^#text(size: 0.65em, $display(x/2)$)")
])
#dialogue-item(speaker: "Kaylee", [
Multiplying means add.
#answerx($1 + 2 + 3 = display(x/2)$, 12)
])
#dialogue-item(speaker: "Kloe", [
#emoji-icon("muscle")
Try this one.
#findx("a^x * b = a^(4x)", target: "b")
])
#dialogue-item(speaker: "Kaylee", [
I dont know Kloe. Can you tell me the answer?
])
#dialogue-item(speaker: "Kloe", [
#give-answer("a^(3x)", target: "b")
])
#dialogue-item(speaker: "Kaylee", [
How come?
])
#dialogue-item(speaker: "Kloe", [
Because $a^#xblue($1x$) #xdot() a^(#xblue($3x$)) #xarrow() a^(#xblue($4x$))$.
#v(10pt)
$x + 3x = 4x$
])
#dialogue-item(speaker: "Kaylee", [
Give me another one Kloe!
])
#dialogue-item(speaker: "Kloe", [
#findx("a^x * b * b = a^(4x)", target: "b")
])
#dialogue-item(speaker: "Kaylee", [
There's 2 $b$'s this time!
#v(10pt)
Hmm...
#v(10pt)
$
x + b + b &= 4x\
2b &= 3x\
b &= display((3x)/2)\
$
#v(10pt)
Does $b$ equal #boxed($1.5x$)?
])
#dialogue-item(speaker: "Kloe", [
With a base of $a$.
])
#dialogue-item(speaker: "Kaylee", [
The final answer is #answer-box(label: "b", "$a^1.5$")
])
#dialogue-item(speaker: "Kloe", [
That's perfect Kaylee.
Sometimes, you're just solving for the power, and you don't need the base.\
But in this one, you're solving for the whole thing so you do need it.
])
#dialogue-item(speaker: "Kaylee", [
Kloe.
])
#dialogue-item(speaker: "Kloe", [
Yes my dear?
])
#dialogue-item(speaker: "Kaylee", [
Exponents feel easy and hard at the same time.
])
#dialogue-item(speaker: "Kloe", [
That's because exponents combine together a lot of ideas.\
Soon we will put fractions into exponents.
])
#dialogue-item(speaker: "Kaylee", [
Can you do that?
])
#dialogue-item(speaker: "Kloe", [
And soon we will put exponents into our exponents! #emoji-icon("dancer")
])
#dialogue-item(speaker: "Kaylee", [
Stop it Kloe!
])
#dialogue-item(speaker: "Kloe", [
Just wait Kaylee. You are going to really like exponents. #emoji-icon("smile")
])
|
|
https://github.com/Myriad-Dreamin/typst.ts | https://raw.githubusercontent.com/Myriad-Dreamin/typst.ts/main/fuzzers/corpora/text/numbers_02.typ | typst | Apache License 2.0 |
#import "/contrib/templates/std-tests/preset.typ": *
#show: test-page
// Test floats.
#12.0 \
#3.14 \
#1234567890.0 \
#0123456789.0 \
#0.0 \
#(-0.0) \
#(-1.0) \
#(-9876543210.0) \
#(-0987654321.0) \
#(-3.14) \
#(4.0 - 8.0)
|
https://github.com/SE-legacy/templatesTypst | https://raw.githubusercontent.com/SE-legacy/templatesTypst/master/conf.typ | typst | #let header() = {
set align(center)
set text(font: "Cambria")
text("МИНОБРНАУКИ РОССИИ\nФедеральное государственное бюджетное образовательное учреждение\nвысшего образования\n")
v(0.2em)
text(weight: "bold", "«САРАТОВСКИЙ НАЦИОНАЛЬНЫЙ ИССЛЕДОВАТЕЛЬСКИЙ
ГОСУДАРСТВЕННЫЙ УНИВЕРСИТЕТ
ИМЕНИ Н. Г. ЧЕРНЫШЕВСКОГО»\n")
set align(left)
}
#let signature(post, name) = {
grid(
columns: (1fr,) * 3,
align: (left, center, right),
row-gutter: 5pt,
post, block(inset: (y: 13pt), line(length: 3cm, stroke: .4pt)), name
)
}
#let get_student_word(sex) = {
if sex == "male" {
return "студента"
} else if sex == "female" {
return "студентки"
} else if sex == "plural" {
return "студентов"
}
}
#let get_speciality(group) = {
let specialities = (
[02.03.02 --- Фундаментальная информатика и информационные технологии],
[09.03.01 --- Информатика и вычислительная техника],
[10.05.01 --- Компьютерная безопасность],
[02.03.03 --- Математическое обеспечение и администрирование информационных систем],
[09.03.04 --- Программная инженерия],
[44.03.01 --- Педагогическое образование],
[09.04.01 --- Информатика и вычислительная техника],
[02.04.03 --- Математическое обеспечение и администрирование информационных систем],
[27.03.03 --- Системный анализ и управление],
)
if group.at(1) == "7" { // x7x
if group.at(2) == "1" { // x71
return specialities.at(6) // ивт
} else if group.at(2) == "3" { // x73
return specialities.at(7) // моаис
}
return []
}
let id = int(group.at(1)) - 1;
if id < 0 or id > 8 {
return []
}
return specialities.at(id)
}
#let referat_title(info) = {
let author = info.at("author", default: (:))
set align(center)
v(3cm)
text(weight: "bold", upper(info.at("title", default: [Тема работы])))
par[ТЕСТ]
v(1.5cm)
set align(left)
let author_string = get_student_word(author.at("sex", default: "male"))
author_string = author_string + " " + author.group.at(0) + " курса " + author.group + " группы\n"
if author.faculty == [КНиИТ] {
author_string = author_string + "направления " + get_speciality(author.group) + "\n"
} else if author.at("speciality", default: []) != [] {
author_string = author_string + "направления " + author.speciality + "\n"
}
text(author_string + "факультета " + author.faculty + "\n" + author.name)
v(1fr)
// text("Проверено:\n")
// signature(info.inspector.degree, info.inspector.name)
}
#let make_title(
type: "referat",
info: ()
) = {
set page(
paper: "a4",
margin: (
top: 2cm,
bottom: 2cm,
left: 2.5cm,
right: 1.5cm
)
)
header()
if type == "referat" {
referat_title(info)
}
v(1fr)
set align(center)
text("Саратов 2024")
}
#let make_toc(
info: ()
) = {
outline(indent: 2%, title: [Содержание])
pagebreak(weak: true)
}
#let aboba(settings: ()) = {
}
#let conf(
title: none,
info: (),
type: "referat",
settings: (),
doc
) = {
info.title = title
settings.title_page = settings.at("title_page", default: (:))
set text(
size: 14pt
)
if settings.title_page.at("enabled", default: true) {
make_title(type: type, info: info)
}
set align(left)
set page(footer: context [
#h(1fr)
#if counter(page).get().at(0) == 2 {
return
}
#counter(page).display(
"1"
)
])
let caps_headings = (
[Содержание],
[Введение],
[Заключение],
[Список использованных источников]
)
set heading(numbering: "1.1")
show heading: it => {
set text(size: 14pt)
if it.depth == 1 {
pagebreak(weak: true)
}
if caps_headings.contains(it.body) {
set align(center)
//counter(heading).update(i => i - 1)
upper(it.body)
} else {
it
}
}
set page(numbering: "1")
if settings.contents_page.enabled {
make_toc(info: info)
}
doc
/*let count = authors.len()
let ncols = calc.min(count, 3)
grid(
columns: (1fr,) * ncols,
row-gutter: 24pt,
..authors.map(author => [
#author.name \
#author.affiliation \
#link("mailto:" + author.email)
]),
)
par(justify: false)[
*Abstract* \
#abstract
]*/
}
|
|
https://github.com/OverflowCat/BUAA-Digital-Image-Processing-Sp2024 | https://raw.githubusercontent.com/OverflowCat/BUAA-Digital-Image-Processing-Sp2024/master/chap02/main.typ | typst | #import "@preview/unify:0.4.3": num, qty
#import "@preview/gentle-clues:0.7.0": clue
#set text(font: "Noto Serif CJK SC")
#let problem(title: "问题", icon: emoji.quest , ..args) = clue(
accent-color: green,
title: title,
icon: icon,
..args
)
= 作业
#problem[
1. $14 "mm" × 14 "mm"$ 的 CCD 摄像机芯片有 2048×2048 个元素,将它聚焦到相距 $0.5 "m"$ 远的一个方形平坦区域.该摄像机每毫米能分辨多少线对?摄像机配备了一个 $35 "mm"$ 镜头.(提示:成像处理模型如图2.3所示,但使用摄像机镜头的焦距替代眼睛的焦距.)
]
物方焦距 $f = qty("0.5", "m")$,像方焦距 $f' = qty("35", "mm")$,物方高度记为 $H$,像高记为 $h$,则
$ h/H = f'/f, h = f'/f H = 0.07 H, $
$H = qty("1", "mm")$ 时,像高 $h = qty("0.07", "mm")$,故该摄像机的分辨率为 $ 2048 / 14 times h / 2 = 5.12 "lp" dot "mm"^(-1). $
#problem[
2. 高清晰度电视(HDTV)使用1080条水平电视线隔行扫描来产生图像(每隔一行在显像管表面画一条线,每两场形成一帧,每场用时 $1/60$ 秒).图像的宽高比是16:9.在水平行数固定的情况下,求图像的垂直分辨率.一家公司已经设计了一种图像获取系统,该系统由HDTV图像生成数字图像.在该系统中,每条(水平)电视行的分辨率与图像的宽高比成正比,彩色图像的每个像素都有24比特的灰度分辨率,红色、绿色、蓝色图像各8比特.这三幅原色图像形成彩色图像.存储90分钟的一部HDTV电影需要多少比特?
]
对于高度为 $1080" line"$ 的图像,宽度为 $ 1080/9*16 = 1920" line", $
图像面积 $ A = 1920 times 1080 = 2073600" px". $
每像素需 $24" bit"$,则每幅图像需 $ 24 times A = 49766400" bit".$
若每场时间 $T=1/60" s"$,每两场形成一帧,则视频的帧率为
$ f = 1/(2T) = 30" Hz". $
不考虑压缩,存储 $t = 90 "min" = 5400 "s"$ 的一部 HDTV 电影,需要 $ 49766400 times 30 times 5400 = #num("8062156800000")
"bit". $
#problem[
3. 两个图像子集 $S_1$、$S_2$ 的邻接方式?
]
// #figure(
// image("fig-2-3.png", width: 90%),
// caption: [$p$ 和 $q$],
// ) <fig-2-3>
#figure(
image("fig-2-3-a.png", width: 90%),
caption: [*$4$ 通路*和 *$m$ 通路*],
) <fig-2-3-a>
#figure(
image("fig-2-3-b.png", width: 90%),
caption: [*$8$ 通路*],
) <fig-2-3-b>
这两个子集
+ 不是 $4$ 邻接的,如 @fig-2-3-a,$S_1$ 和 $S_2$ 中没有像素是 $4$ 邻接的;
+ 是 $8$ 邻接的,如 @fig-2-3-b,$p$ 和 $q$ 是 $8$ 邻接的;
+ 是 $m$ 邻接的,如 @fig-2-3-a,$p$ 和 $q$ 是 $8$ 邻接的.
#problem[
4. 给出一个像素宽度的 m 通路转换为 4 通路的一种算法.
]
#import "@preview/algorithmic:0.1.0"
#import algorithmic: algorithm
#algorithm({
import algorithmic: *
Function("m-Paths-to-Four-paths", args: ($bold(A)$, $x_0$, $y_0$), {
Cmt[设定通路起点]
Assign[$x$][$x_0$]
Assign[$y$][$y_0$]
State[]
While(cond: [*True*], {
Cmt[寻找通路中下一个像素的位置]
Cmt[若为 4 邻接,不用更改,直接进行下一步]
If(cond: $A [x+1][y] = 1$, {
Assign[$x$][$x+1$]
})
ElsIf(cond: $A [x][y+1] = 1$, {
Assign[$y$][$y+1$]
})
ElsIf(cond: $A [x-1][y] = 1$, {
Assign[$x$][$x-1$]
})
ElsIf(cond: $A [x][y-1] = 1$, {
Assign[$y$][$y-1$]
})
Cmt[若为 8 邻接,则增加一个 4 邻接像素]
ElsIf(cond: $A [x+1][y+1] = 1$, {
Assign[$bold(A)[x+1][y]$][$1$]
// OR Assign[$bold(A)[x][y+1]$][1]
Assign[$x$][$x+1$]
Assign[$y$][$y+1$]
})
ElsIf(cond: $A [x+1][y-1] = 1$, {
Assign[$bold(A)[x+1][y]$][$1$]
// OR Assign[$bold(A)[x][y-1]$][1]
Assign[$x$][$x+1$]
Assign[$y$][$y-1$]
})
ElsIf(cond: $A [x-1][y+1] = 1$, {
Assign[$bold(A)[x-1][y]$][$1$]
// OR Assign[$bold(A)[x][y+1]$][1]
Assign[$x$][$x-1$]
Assign[$y$][$y+1$]
})
ElsIf(cond: $A [x-1][y-1] = 1$, {
Assign[$bold(A)[x-1][y]$][$1$]
// OR Assign[$bold(A)[x][y-1]$][1]
Assign[$x$][$x-1$]
Assign[$y$][$y-1$]
})
})
Return[]
})
})
#problem[
考虑如下图的图像分割.
#set enum(numbering: "(a)")
+ 令V={0, 1},计算 $p$ 和 $q$ 间 $4$、$8$ 和 $m$ 通路的最短长度;
+ 令V={1, 2},计算 $p$ 和 $q$ 间 $4$、$8$ 和 $m$ 通路的最短长度.
]
(a)
+ 不存在 $4$ 通路.
+ ``` 3 1 2 1 (q)
↗
2 2 0 2
↑
1 2 1 1
↗
(p) 1 → 0 1 2
```$8$ 通路最短长度为 $4$.
+ ``` 3 1 2 1 (q)
↗
2 2 0 2
↑
1 2 1 1
↑
(p) 1 → 0 → 1 2
```$m$ 通路最短长度为 $5$.
(b)
+ ``` 3 1 → 2 → 1 (q)
↑
2 → 2 0 2
↑
1 2 1 1
↑
(p) 1 0 1 2
```$4$ 通路最短长度为 $6$.
+ ``` 3 1 2 → 1 (q)
↗
2 2 0 2
↗
1 2 1 1
↑
(p) 1 0 1 2
```$8$ 通路最短长度为 $4$.
+ ``` 3 1 → 2 → 1 (q)
↑
2 → 2 0 2
↑
1 2 1 1
↑
(p) 1 0 1 2
```$m$ 通路最短长度为 $6$. |
|
https://github.com/yonatanmgr/university-notes | https://raw.githubusercontent.com/yonatanmgr/university-notes/main/0366-%5BMath%5D/03661111-%5BLinear%20Algebra%201A%5D/src/lectures/03661111_lecture_5.typ | typst | #import "/0366-[Math]/globals/template.typ": *
#show: project.with(
title: "אלגברה לינארית 1א׳ - שיעור 5",
authors: ("<NAME>",),
date: "16 בינואר, 2024",
)
#set enum(numbering: "(1.א)")
== מסקנות מכך שקיימת משוואה קנונית יחידה
+ אם $n>m$ (מספר המשתנים גדול ממספר המשוואות) אז מתקיים בדיוק אחד מהשניים:
+ אין פתרון.
+ יש לפחות $abs(F)$ (מספר האיברים בשדה $F$) פתרונות.
*נוכיח*: אם יש שורת סתירה ($0=1$) אז אין פתרונות. אחרת, כל שורה נותנת לכל היותר איבר פותח אחד, ולכן:
$ "מספר המשתנים החופשיים" = n - "מספר האיברים הפותחים" >= n-m >=1 $
ולכן יש לפחות $abs(F)$ פתרונות. #QED
+ לכל מערכת משוואות מתקיים בדיוק אחד מהבאים:
+ אין פתרון.
+ יש פתרון יחיד.
+ יש לפחות $abs(F)$ פתרונות.
*נוכיח*: נעבור לצורה קנונית, זה לא משנה את קבוצת הפתרונות.
+ $iff$ יש שורת סתירה.
+ $iff$ אין שורת סתירה ואין משתנים חופשיים.
+ $iff$ אין שורת סתירה ויש משתנה חופשי אחד לפחות.
#QED
== מערכת משוואות הומוגנית
מערכת משוואות נקראת *הומוגנית* אם $b_1= dots = b_m = 0$. כלומר: $ cases(a_11 x_1 + dots + a_(1n) x_n=0, dots.v, a_(m 1) x_1 + dots + a_(m n) x_n=0) $
נקרא לפתרון $x_1=x_2=dots=x_n=0$ *הפתרון הטרוויאלי*.
=== מסקנה
במערכת משוואות הומוגנית:
+ אם $n>m$ אז יש לפחות $abs(F)$ פתרונות.
+ תמיד:
- או שיש את הפתרון הטריוויאלי בלבד.
- או שיש לפחות $abs(F)$ פתרונות.
*הוכחה*: מיידי מהמסקנות הקודמות וקיום הפתרון הטריוויאלי.
#pagebreak()
= מרחבים לינאריים/וקטוריים
יהי $F$ שדה. קבוצה $V$ עם שתי פונקציות $a: V xx V -> V$ (נקראת "חיבור" ומוגדרת $forall u,v in V, v+u := a(v,u)$), $m: F xx V -> V$ (נקראת "כפל בסקלר" ומוגדרת $forall lambda in F forall v in V, lambda dot v = lambda v := m(lambda, v)$) תיקרא מרחב וקטורי (לינארי) מעל $F$ אם מתקיימות התכונות הבאות:
+ *חילופיות*: $forall v, u in V, v+u=u+v$.
+ *אסוציאטיביות*: $forall v, u, w in V, (v+u)+w = v+(u+w)$.
+ *קיום איבר אפס*: קיים $w in V$ ניטראלי לחיבור כלומר $forall v in V, v+w=w+v =v$. (תכף נראה ש-$w$ יחיד, ואז זה יצדיק להגיד "איבר האפס" ולסמנו ב-$0=0_v$).
+ *קיום נגדי*: $forall v in V exists w in V: v+w = 0_v$ הניטראלי לחיבור.
+ *חוק הפילוג 1*: $forall lambda, mu in F forall v in V, (lambda+mu) dot v = lambda v + mu v$.
+ *חוק הפילוג 2*: $forall lambda in F forall u, v in V, lambda (v+ u) = lambda v+ lambda mu$.
+ *אסוציאטיביות של כפל בסקלר*: $forall lambda, mu in F forall v in V, (lambda mu) dot v = lambda dot (mu v)$.
+ *איבר יחידה*: $forall v in V, 1_F dot v = v$.
איברים במ״ו נקראים *וקטורים*, ואיברים בשדה המתאים נקראים *סקלרים*.
== דוגמאות
+ $F^n$ הוא מ״ו מעל $F$ עם:
- החיבור $(v_1, dots, v_n)+(v_1, dots, v_n):=(v_1+u_1, dots, v_n+u_n)$.
- הכפל בסקלר $F in.rev lambda (v_1, dots, v_n) = (lambda v_1, dots, lambda v_n)$.
נבדוק (1): כן, כי החיבור מוגדר לפי החיבור ב-$F$, והחיבור ב-$F$ חילופי.
(2)-(4): כנ״ל.
וקטור האפס הוא $0_F = (0, dots, 0)$.
(5): $(lambda + mu)overbracket((v_1, dots, v_n), underline(v)) = (dots, (lambda+mu)v_i, dots) = (dots, lambda v_i + mu v_i, dots) = lambda underline(v)+ mu underline(v)$.
(6)-(8): כנ״ל.
$F^n$ נקרא המרחב הוקטורי הסטנדרטי מעל $F$.
+ נסתכל על $M_(m xx n) (F) = "קבוצת המטריצות עם m שורות ו-n עמודות"$. זה גם מ״ו מעל $F$ עם:
- החיבור: $M_(m xx n) (F) in.rev A = (a_(i j)), B=(b_(i j))$ כך ש-$forall i, j, a_(i j), b_(i j) in F: A+B := (a_(i j)+b_(i j))$.
- הכפל בסקלר: $lambda in F, A in M_(m xx n)(F), lambda A := (lambda a_(i j))$.
ברור ש-(8)-(1) מתקיימים.
+ דוגמה להגדרה: יהי $V$ מ״ו מעל F. נאמר שתת קבוצה $W seq V$ היא תת מרחב וקטורי של $V$ אם:
+ $0_v in W$.
+ סגירות לחיבור: $forall w_1, w_2 in W: w_1+w_2 in W$.
+ סגירות לכפל בסקלר: $forall lambda in F forall w in W: lambda w in W$.
*טענה*: אם $W$ תת מרחב של $V$, אז $W$ הוא מ״ו ביחס לחיבור וכפל בסקלר המושרים מ-$V$. נדלג על ההוכחה.
+ דוגמה: ${f: A->F "פונקציות"}="Func"(A, F)$ כאשר $A!=emptyset$ (למשל $f: RR->RR$). נגדיר:
- החיבור: $(f+g)(a) := f(a)+g(a)$.
- הכפל בסקלר: $(lambda f)(a) := lambda f(a)$.
זהו מ״ו מעל $F$, כש-$0$ היא פונק׳ האפס.
(האם יש קשר בין הדוגמה הנ״ל ל-$F^n$?)
#pagebreak()
5. דוגמה: נקח $V = RR_(>0) = {x in RR | x > 0}$. $F=RR$. נגדיר:
- החיבור: $v,w in RR_(>0) , v plus.circle w = v dot w$.
- הכפל בסקלר: $lambda in RR, v in V = RR_(>0), lambda dot.circle v := v^lambda$.
קל לראות שזה מקיים את כל התכונות. למשל, איבר האפס של $V$ הוא $.1$
== תכונות של מרחבים וקטוריים
=== טענה
יהי $V$ מ״ו מעל $F$.
+ יש חוק צמצום: $forall v, u, w in V, v+u =w+u=>v=w$.
+ איבר האפס הוא יחיד ב-$V$.
+ לכל $v in V$ יש נגדי יחיד (נסמנו $-v$).
=== הוכחה
+ יהיו $v, u, w in V$. נניח $v+u=w+u$. נראה כי מתקיים:
$ v = v+(u+u') = (v+u)+u' = (w+u)+u' = w+(u+u') = w $ כלומר, $v=w$ כנדרש.
+ נניח ש-$w, w'$ שניהם ניטראלים לחיבור ונוכיח $w=w'$. נראה כי מתקיים $w=w+w'=w'$.
+ אם $w, w'$ שניהם נגדיים ל-$v$: $v+w=0_v=v+w'$. מ-(1) מתקיים $w=w'$.
#QED
=== טענה
יהי $V$ מ״ו מעל $F$.
+ $forall lambda in F, lambda dot 0_v = 0_V$.
+ $forall v in V, 0_F dot v = 0_V$.
+ $lambda dot v = 0_V => v = 0_v or lambda = 0_v$.
+ $forall v in V, (-1_F) dot v = -v$.
=== הוכחה
+ $lambda 0_V = lambda (0_V + 0_V) = lambda 0_V + lambda 0_V$. מצמצום $0_V = lambda 0_V$.
+ באופן דומה, $0_F dot v = (0_F+0_F) dot v = 0_F v + 0_F v => 0_F dot v = 0_V$.
+ נניח $lambda dot v = 0$. אם $lambda = 0$ ניצחנו. אחרת, $lambda != 0$. כלומר, $0_V = lambda^(-1)(lambda v) = (lambda^(-1)lambda)v = 1_F dot v = v$ כנדרש.
+ יודעים שהנגדי הוא יחיד, אז די להוכיח ש-$-1_F dot v$ הוא הנגדי ל-$v$. נראה כי $ -1_F dot v + v =-1 dot v + 1 dot v = (-1+1) dot v = 0_F dot v = 0_F $
#QED |
|
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/testing-drivetrain.typ | typst | Creative Commons Attribution Share Alike 4.0 International | #import "/packages.typ": notebookinator
#import notebookinator: *
#import themes.radial.components: *
#show: create-body-entry.with(
title: "Test: Drivetrain",
type: "test",
date: datetime(year: 2023, month: 8, day: 4),
author: "<NAME>",
witness: "<NAME>",
)
= Testing Procedure
== Temperature and Current Draw
1. Load the following code onto the robot's brain:
```cpp
int start_time = pros::millis();
int end_time = start_time + 1000 * 60; // Run for 60 seconds
while (pros::millis() < end_time) {
// Move the motors at maximum speed
if (!controller.get_digital(pros::E_CONTROLLER_DIGITAL_A)) { // Emergency stop
left_motors.move(127);
right_motors.move(127);
}
std::vector<std::int32_t> left_motor_draw =
left_motors.get_current_draw_all();
std::vector<std::int32_t> right_motor_draw =
right_motors.get_current_draw_all();
std::vector<double> left_motor_temps = left_motors.get_temperature_all();
std::vector<double> right_motor_temps = right_motors.get_temperature_all();
// Print data to stdout in csv format
printf("%i, %i, %i, %i, %i, %i, %f, %f, %f, %f, %f, %f, %i \n",
left_motor_draw[0], left_motor_draw[1], left_motor_draw[2],
right_motor_draw[0], right_motor_draw[1], right_motor_draw[2],
left_motor_temps[0], left_motor_temps[1], left_motor_temps[2],
right_motor_temps[0], right_motor_temps[1], right_motor_temps[2],
pros::millis());
pros::delay(10); // The brain terminal cannot handle faster than this
}
```
2. Make sure that the motors are not above room temperature
3. Hold the robot in the air so the wheels don't touch the ground
4. Run the code
5. Log the results of the program to a csv file with the pros terminal:
```sh
pros terminal --output log.csv
```
6. Graph the results with this python script:
```py
import pandas as pd
import matplotlib.pyplot as plt
headers = [
"left_0_draw",
"left_1_draw",
"left_2_draw",
"right_0_draw",
"right_1_draw",
"right_2_draw",
"left_0_temp",
"left_1_temp",
"left_2_temp",
"right_0_temp",
"right_1_temp",
"right_2_temp",
]
file = pd.read_csv("log.csv", delimiter=",", names=headers)
y = []
index = 0
for line in file.left_0_draw:
y.append(index)
index += 1
# Repeat for right draw, left temp, and right temp
plt.plot(
y, file["left_0_draw"], "y", file["left_1_draw"], "r", file["left_2_draw"], "g"
)
plt.show()
```
== Speed Testing
1. Mark two pieces of painter's tape on the floor 12 feet apart.
2. Place the robot so that the front of the drivetrain is against the edge of the
tape.
3. Have another teammate ready with a camera, and record the next step.
4. Drive the drivetrain as fast as possible forwards until the front of the
drivetrain touches the other tape.
5. Play back the video, and find the time that it took to traverse the distance
= Results
== Temperature and Current Draw
Overall the power draw held very steady for both sides, but this is expected
since the wheels were free spinning.
#grid(
columns: (1fr, 2fr),
gutter: 20pt,
[
== Left Motors Power Draw
The left motors power draw is very distributed. The 3rd motor is using a lot of
power, staying around 2W. The 2nd motor operates at around the expected wattage,
at about 1W, and the first motor uses almost no power at all.
],
image("../assets/drivetrain/tests/power-left.png"),
[
== Right Motors Power Draw
The right side motors are much less distributed. The 1st and 2nd motors use
under 1W, but the third motor uses around 1.35W.
],
image("../assets/drivetrain/tests/power-right.png"),
[
== Left Motors Temperature
#admonition(
type: "warning",
)[
The temperature sensors on the V5 motors only output the temperature in steps of
5$degree.c$.
]
Due to the short length of the test and the low accuracy of the temperature
sensors the results of this test are almost completely useless. After about 30
seconds the 3rd motor increases from 35$degree.c$ to 40$degree.c$, and that the
1st and 2nd motors stay stagnant at 40$degree.c$. We can see that about 30
seconds in the temperature changes by 5$degree.c$. We can conclude that the
decreased temperature of the 3rd motor is due to its low power draw but it's
likely that if we want to get meaningful data from this we will need to test
over a much larger period of time.
],
image("../assets/drivetrain/tests/temperature-left.png"),
[
== Right Motors Temperature
This test fared similarly to the left side motors. The 1st motors stayed
stagnant at 40$degree.c$. The 2nd and 3rd motors started at 35$degree.c$ and
increased to 40$degree.c$ over time, the 2nd motor after 10s and the 3rd motor
after 30.
],
image("../assets/drivetrain/tests/temperature-right.png"),
)
#colbreak()
== Speed Testing
We conducted a total of 5 trials of our speed test.
#admonition(
type: "note",
)[
The video we took of the 1st trial started late, and therefore did not have
enough info to calculate the correct time.
]
#align(center, table(
columns: 7,
[],
[Trial 1],
[Trial 2],
[Trial 3],
[Trial 4],
[Trial 5],
[Average],
[Time],
[n/a],
[2.08s],
[2.08s],
[2.08s],
[2.04s],
[2.07s],
[Speed],
[n/a],
[5.76 f/s],
[5.76 f/s],
[5.76 f/s],
[5.88s f/s],
[5.76 f/s],
))
We also recorded the velocity of the left and right side of the drivetrain
during each test.
#let graph_width = 75%
#figure(
caption: [ Trial 1 ],
image("../assets/drivetrain/tests/test-1.png", width: graph_width),
)
#figure(
caption: [ Trial 2 ],
image("../assets/drivetrain/tests/test-2.png", width: graph_width),
)
#figure(
caption: [ Trial 3 ],
image("../assets/drivetrain/tests/test-3.png", width: graph_width),
)
#figure(
caption: [ Trial 4 ],
image("../assets/drivetrain/tests/test-4.png", width: graph_width),
)
#figure(
caption: [ Trial 5 ],
image("../assets/drivetrain/tests/test-5.png", width: graph_width),
)
#colbreak()
= Final Conclusion
The drivetrain matches our projected speed of 5.96 f/s pretty closely with an
average speed of 5.76 f/s. It is also much faster than our drivetrain from last
year, properly taking advantage of all 6 motors.
However there are a couple issues that need fixing:
- Several motors use more than the recommended 1W in free spin.
- While testing speed we noticed that the drivetrain doesn't move in a straight
line, so one side is moving slower than the other
- While doing informal tests on our practice field we noticed that the bot cannot
get over the barrier.
- The drivetrain is very difficult to control overall due our use of 6 omni
wheels. Making turns is exceptionally difficult, especially sharp ones. The
drivetrain continues in its original direction for a good distance, with no way
to control it.
|
https://github.com/Fr4nk1inCs/typreset | https://raw.githubusercontent.com/Fr4nk1inCs/typreset/master/src/utils/header.typ | typst | MIT License | #let make-header(body) = {
locate(location => {
let page-index = counter(page).at(location).first()
if page-index == 1 { return }
set text(size: 8pt)
body
})
}
|
https://github.com/ljgago/typst-chords | https://raw.githubusercontent.com/ljgago/typst-chords/main/README.md | markdown | MIT License | # chordx
A package to write song lyrics with chord diagrams in Typst.
**Table of Contents**
- [Introduction](#introduction)
- [Usage](#usage)
- [Typst Packages](#typst-packages)
- [Local Packages](#local-packages)
- [Documentation](#documentation)
- [Examples](#examples)
- [Chart Chords](#chart-chords)
- [Piano Chords](#piano-chords)
- [Single Chords](#single-chords)
- [Changelog](#changelog)
- [License](#license)
## Introduction
With `chordx` you can easily generate song lyrics with chords for writing songbooks.
`chordx` generates chord charts for stringed instruments (e.g. guitar, ukulele, etc.), piano chords (with diferent piano layouts) and single chords that are chords without charts used to write the chords over a word to write songbooks.
## Usage
`chordx` exports 3 functions to generate diferents types fo charts:
- `chart-chord`: used to generate chart chords for stringed instruments.
- `piano-chord`: used to generate piano chords.
- `single-chord`: used to show the chord name over a word.
### Typst Packages
Typst added an experimental package repository and you can import `chordx` as follows:
```typ
#import "@preview/chordx:0.4.0": *
```
### Local Packages
If the package hasn't been released yet, or if you just want to use it from this repository, you can use _*local-packages*_.
You can read the documentation about typst [local-packages](https://github.com/typst/packages#local-packages) and learn about the path folders used in differents operating systems (Linux / MacOS / Windows).
In Linux you can do:
```sh
git clone https://github.com/ljgago/typst-chords ~/.local/share/typst/packages/local/chordx/0.4.0
```
And import the package in your file:
```typ
#import "@local/chordx:0.4.0": *
```
## Documentation
Here [chordx-docs](docs/chordx-docs.pdf) you have the reference documentation that describes the functions and parameters used in this package. (_Generated with [tidy](https://github.com/Mc-Zen/tidy)_)
## Examples:
### Chart Chords
```typ
#import "@preview/chordx:0.4.0": *
#let chart-chord-sharp = chart-chord.with(size: 18pt)
#let chart-chord-round = chart-chord.with(size: 1.5em, design: "round")
// Design "sharp"
#chart-chord-sharp(tabs: "x32o1o", fingers: "n32n1n")[C]
#chart-chord-sharp(tabs: "ooo3", fingers: "ooo3")[C]
// Desigh "round" with position "bottom"
#chart-chord-round(tabs: "xn332n", fingers: "o13421", fret: 3, capos: "115", position: "bottom")[Cm]
#chart-chord-round(tabs: "onnn", fingers: "n111", capos: "313", position: "bottom")[Cm]
// Design "round" with background color in chord name
#chart-chord-round(tabs: "xn332n", fingers: "o13421", fret: 3, capos: "115", background: silver)[Cm]
#chart-chord-round(tabs: "onnn", fingers: "n111", capos: "313", background: silver)[Cm]
```
<h3 align="center">
<a href="examples/chart-chords.typ">
<img
alt="Chart Chord"
src="examples/chart-chords.svg"
style="max-width: 100%; width: 100%;"
>
</a>
</h3>
### Piano Chords
```typ
#import "@preview/chordx:0.4.0": *
#let piano-chord-sharp = piano-chord.with(layout: "F", size: 18pt)
#let piano-chord-round = piano-chord.with(layout: "F", size: 1.5em, design: "round")
#piano-chord-sharp(keys: "<KEY>", fill-key: blue)[B]
#piano-chord-round(keys: "<KEY>", fill-key: yellow, position: "bottom")[B]
#piano-chord-round(keys: "<KEY>", fill-key: red)[B]
```
<h3 align="center">
<a href="examples/piano-chords.typ">
<img
alt="Piano Chord"
src="examples/piano-chords.svg"
style="max-width: 100%; width: 100%;"
>
</a>
</h3>
### Single Chords
```typ
#import "@preview/chordx:0.4.0": *
#let chord = single-chord.with(
font: "PT Sans",
size: 12pt,
weight: "semibold",
background: silver
)
#chord[Jingle][G][2] bells, jingle bells, jingle #chord[all][C][2] the #chord[way!][G][2] \
#chord[Oh][C][] what fun it #chord[is][G][] to ride \
In a #chord[one-horse][A7][2] open #chord[sleigh,][D7][3] hey!
```
<h2 align="center">
<a href="examples/single-chords.typ">
<img
alt="Single Chord"
src="examples/single-chords.svg"
style="max-width: 100%; width: 450pt;"
>
</a>
</h2>
## Changelog
You can read the latest changes in [CHANGELOG.md](./CHANGELOG.md)
## License
[MIT License](./LICENSE)
|
https://github.com/EunTilofy/NumComputationalMethods | https://raw.githubusercontent.com/EunTilofy/NumComputationalMethods/main/coding/task4/SC-report-4.typ | typst | #import "../../template.typ": *
#show: project.with(
course: "Computing Method",
title: "Computing Method - Programming 4",
date: "2024.6.1",
authors: "<NAME>, 3210106357",
has_cover: false
)
= 问题
\
应用科学计算的方法,求下列问题的数值近似解:\
设双曲线 $C_1 : x y = 4$ 及椭圆 $C_2 : x^2 + 4 y^2 = 4$,求在曲线 $C_1, C_2$ 各找一个点 $P_1, P_2$,使得 $abs(P_1 P_2)$ 的距离最小,即
$
abs(P_1 P_2) = min_(Q_1 in C_1, Q_2 in C_2) abs(Q_1 Q_2)
$
= 算法
\
设 $P_1(x_1, 4/(x_1)), P_2 (2 cos x_2, sin x_2)$,则目标函数:$
f(x) = (x_1 - 2 cos x_2)^2 + (4/x_1 - sin x_2)^2.
$
求偏导和二阶导矩阵,得$
nabla f (x) = [2(x_1 - 2cos x_2) - 8/(x_1^2) (4/x_1 - sin x_2), 4 x_1 sin x_2 - 3 sin 2 x_2 - (8 cos x_2) / x_1]^T \
nabla^2 f(x) = bmatrix(2 + 96/x_1^4 - (16 sin x_2) / x_1^3, 4 sin x_2 + (8 cos x_2) / x_1^2;4 sin x_2 + (8 cos x_2) / x_1^2, 4 x_1 cos x_2 - 6 cos 2 x_2 + (8 sin x_2) / x_1)
$
我们采用纯 Newton 法(不带步长因子搜索)求解该问题,算法流程如下(取 $alpha = 1$):
+ 输入 $x^((0)) in bb(R)^2, 0 leq epsilon < 1$
+ 对于 $k = 0, 1, dots$,循环:
#set enum(numbering: "(a)")
+ $p_k arrow.l - [nabla^2 f(x^((k)))]^(-1) nabla f(x^((k)))$.
+ $x^((k+1)) arrow.l x^((k)) + alpha p_k$。
+ 如果 $norm(nabla f(x^((k+1)))) leq epsilon$,退出循环;否则,继续执行。
+ 输出 $x^((k+1))$。
= 程序
```matlab
x0 = [0.5; 0.5];
X = Newton(x0,1e-6);
X
function P = Newton(X, eps)
while norm(Diff(X)) > eps
p = - inv(Hess(X)) * Diff(X);
X = X + p;
end
P = X;
end
function P = Diff(x)
x1 = x(1);
x2 = x(2);
y1 = 2*(x1-2*cos(x2))-8*(4/x1-sin(x2))/(x1^2);
y2 = 4*x1*sin(x2)-3*sin(2*x2)-8*cos(x2)/x1;
P = [y1; y2];
end
function P = Hess(x)
x1 = x(1);
x2 = x(2);
y11 = 2 + 96/(x1^4)-16*sin(x2)/(x1^3);
y12 = 4*sin(x2)+8*cos(x2)/(x1^2);
y21 = y12;
y22 = 4*x1*cos(x2)-6*cos(2*x2)+8*sin(x2)/x1;
P = [y11, y12; y21, y22];
end
```
= 数据与结果
我们以 $(x_1, x_2) = (0.5, 0.5)$,作为初始猜测执行 Newton 法,最后得到答案为 $(x_1, x_2) = (2.3910,6.9036)$。
= 结论
#figure(
image("1.png", width: 90%),
)
将求解出的 $P_1, P_2$ 标在图像上,可以看出,求解结果正确。
根据图的对称性,将 $P_1, P_2$ 沿坐标轴对称后的点对同样满足条件。 |
|
https://github.com/MatheSchool/typst-g-exam | https://raw.githubusercontent.com/MatheSchool/typst-g-exam/develop/test/sugar/test-002-sugar-solution.typ | typst | MIT License | #import "../../src/lib.typ": *
#show: g-exam.with(
show-grade-table: false,
question-text-parameters: (size: 18pt, font:"OpenDyslexic")
)
= Header
=? Quiestion 1 ? What ?
=% Clarification %
=! Solution.
=3? Queston a
=32? Queston b?
==321.43? Queston c?
|
https://github.com/pavelzw/moderner-cv | https://raw.githubusercontent.com/pavelzw/moderner-cv/main/lib.typ | typst | MIT License | #import "@preview/fontawesome:0.2.1": *
#let _cv-line(left, right, ..args) = {
set block(below: 0pt)
table(
columns: (1fr, 5fr),
stroke: none,
..args.named(),
left,
right,
)
}
#let moderncv-blue = rgb("#3973AF")
#let _header(
title: [],
subtitle: [],
socials: (:),
) = {
let titleStack = stack(
dir: ttb,
spacing: 1em,
text(size: 30pt, title),
text(size: 20pt, subtitle),
)
let social(icon, link_prefix, username) = [
#fa-icon(icon) #link(link_prefix + username)[#username]
]
let socialsList = ()
if "phone" in socials {
socialsList.push(social("phone", "tel:", socials.phone))
}
if "email" in socials {
socialsList.push(social("envelope", "mailto:", socials.email))
}
if "github" in socials {
socialsList.push(social("github", "https://github.com/", socials.github))
}
if "linkedin" in socials {
socialsList.push(
social("linkedin", "https://linkedin.com/in/", socials.linkedin),
)
}
let socialStack = stack(
dir: ttb,
spacing: 0.5em,
..socialsList,
)
stack(
dir: ltr,
titleStack,
align(
right + top,
socialStack,
),
)
}
#let moderner-cv(
name: [],
subtitle: [CV],
social: (:),
color: moderncv-blue,
lang: "en",
font: ("New Computer Modern"),
show-footer: true,
body,
) = [
#set page(
paper: "a4",
margin: (
top: 10mm,
bottom: 15mm,
left: 15mm,
right: 15mm,
),
)
#set text(
font: font,
lang: lang,
)
#show heading: it => {
set text(weight: "regular")
set text(color)
set block(above: 0pt)
_cv-line(
[],
[#it.body],
)
}
#show heading.where(level: 1): it => {
set text(weight: "regular")
set text(color)
_cv-line(
align: horizon,
[#box(fill: color, width: 28mm, height: 0.25em)],
[#it.body],
)
}
#_header(title: name, subtitle: subtitle, socials: social)
#body
#if show-footer [
#v(1fr, weak: false)
#name\
#datetime.today().display("[month repr:long] [day], [year]")
]
]
#let cv-line(left-side, right-side) = {
_cv-line(
align(right, left-side),
par(right-side, justify: true),
)
}
#let cv-entry(
date: [],
title: [],
employer: [],
..description,
) = {
let elements = (
strong(title),
emph(employer),
..description.pos(),
)
cv-line(
date,
elements.join(", "),
)
}
#let cv-language(name: [], level: [], comment: []) = {
_cv-line(
align(right, name),
stack(dir: ltr, level, align(right, emph(comment))),
)
}
#let cv-double-item(left-1, right-1, left-2, right-2) = {
set block(below: 0pt)
table(
columns: (1fr, 2fr, 1fr, 2fr),
stroke: none,
align(right, left-1), right-1, align(right, left-2), right-2,
)
}
#let cv-list-item(item) = {
_cv-line(
[],
list(item),
)
}
#let cv-list-double-item(item1, item2) = {
set block(below: 0pt)
table(
columns: (1fr, 2.5fr, 2.5fr),
stroke: none,
[], list(item1), list(item2),
)
}
|
https://github.com/Vikingu-del/Resume | https://raw.githubusercontent.com/Vikingu-del/Resume/main/README.md | markdown | MIT License | # Resume
Building a Resume with a Marked Up Language like Typst
English Version
[English Resume](https://github.com/Vikingu-del/Resume/blob/main/Resume%20In%20English.pdf)
German Version
[German Resume](https://github.com/Vikingu-del/Resume/blob/main/Resume%20In%20German.pdf)
|
https://github.com/typst/packages | https://raw.githubusercontent.com/typst/packages/main/packages/preview/canonical-nthu-thesis/0.1.0/layouts/preface.typ | typst | Apache License 2.0 | #import "../utils/cover-with-rect.typ": cover-with-white-rect
#let preface-impl(
margin: (:),
it,
) = {
set page(
margin: margin,
background: cover-with-white-rect(image("../nthu-logo.svg", width: 1.95in, height: 1.95in)),
numbering: "i",
)
set text(
size: 12pt,
font: ("New Computer Modern", "TW-MOE-Std-Kai"),
hyphenate: true,
)
set par(
leading: 1.5em,
first-line-indent: 2em,
)
// Disable heading numbering.
set heading(numbering: none)
show heading.where(
level: 1,
): it => {
// Show the body of the heading with some vertical spacing surrounding.
// Headings in the preface are not numbered.
block(width: 100%, {
set text(size: 24pt)
v(3em)
it.body
v(2em)
})
}
// Show level-1 outline entries in bold text and without the dots.
show outline.entry.where(
level: 1,
): it => {
strong(it.body)
h(1fr)
// strong(repr(it))
strong(it.page)
}
// Reset the page counter to start the abstract at page i.
counter(page).update(1)
it
}
|
https://github.com/lucannez64/Notes | https://raw.githubusercontent.com/lucannez64/Notes/master/Gradient%20Vector.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: "Gradient Vector",
authors: (
"<NAME>",
),
date: "30 Octobre, 2023",
)
#set heading(numbering: "1.1.")
= Gradient Vector
<gradient-vector>
== Definition
<definition>
In multivariable calculus, the gradient vector of a scalar-valued
function is a vector-valued function that points in the direction of the
greatest rate of increase of the function at a given point. It is a
generalization of the concept of the derivative of a function of one
variable, which points in the direction of the greatest rate of increase
of the function at a given point.
The gradient vector of a function $f lr((x comma y))$ at a point
$lr((x_0 comma y_0))$ is given by:
$ nabla f lr((x_0 comma y_0)) eq vec(frac(diff f, diff x) lr((x_0 comma y_0)) med frac(diff f, diff y) lr((x_0 comma y_0))) $
Where $frac(diff f, diff x) lr((x_0 comma y_0))$ and
$frac(diff f, diff y) lr((x_0 comma y_0))$ are the partial derivatives
of the function with respect to $x$ and $y$ respectively.
The gradient vector is a useful concept in multivariable calculus, as it
allows us to find the direction of maximum increase of a function at a
given point, and to calculate the directional derivative of a function
in a particular direction.
== Example
<example>
To find the gradient vector of the function
$f lr((x comma y)) eq y ln x plus x y^2$ at a point
$lr((x_0 comma y_0))$, we need to take the partial derivatives of the
function with respect to $x$ and $y$ and evaluate them at the point
$lr((x_0 comma y_0))$.
The partial derivatives of $f$ with respect to $x$ and $y$ are:
$ frac(diff f, diff x) eq y^2 plus y 1 / x $
$ frac(diff f, diff y) eq ln x plus 2 x y $
The gradient vector of the function at the point $lr((x_0 comma y_0))$
is then given by:
$ nabla f lr((x_0 comma y_0)) eq vec(frac(diff f, diff x) lr((x_0 comma y_0)) med frac(diff f, diff y) lr((x_0 comma y_0))) eq vec(y_0^2 plus y_0 / x_0 med ln x_0 plus 2 x_0 y_0) $
For example, if $lr((x_0 comma y_0)) eq lr((1 comma 1))$, then the
gradient vector is:
$ nabla f lr((1 comma 1)) eq vec(1^2 plus 1 / 1 med ln 1 plus 2 dot.op 1 dot.op 1) eq vec(2 med 2) $
Evaluating these partial derivatives at the point $lr((1 comma 2))$
gives us:
$ frac(diff f, diff x) lr((1 comma 2)) eq 2^2 plus 2 dot.op 1 / 1 eq 6 $
$ frac(diff f, diff y) lr((1 comma 2)) eq ln 1 plus 2 dot.op 1 dot.op 2 eq 4 $
The gradient vector at the point $lr((1 comma 2))$ is then given by:
$ nabla f lr((1 comma 2)) eq vec(frac(diff f, diff x) lr((1 comma 2)) med frac(diff f, diff y) lr((1 comma 2))) eq vec(6 med 4) $
Therefore, the gradient vector at the point $lr((1 comma 2))$ is
$vec(6 med 4)$.
== Link
<link>
- #link("Partial Derivative.pdf")[Partial Derivative]
|
|
https://github.com/zenor0/FZU-report-typst-template | https://raw.githubusercontent.com/zenor0/FZU-report-typst-template/main/fzu-report/utils/set-report.typ | typst | MIT License | #import "numbering-tools.typ": number-with-circle, chinese-numbering
#import "packages.typ": show-cn-fakebold
#import "bachelor-footnote.typ": bachelor-footnote
#import "show-heading.typ": show-heading
#import "figure-and-ref.typ": show-figure, show-ref, set-math-numbering
#import "bilingual-bibliography.typ": show-bibliography
#import "fonts.typ": 字体, 字号
#let set-report(bilingual-bib: true, doc) = {
set page(paper: "a4", margin: (top: 2cm+0.5cm, bottom: 2cm+0.5cm, left: 2cm, right: 2cm))
set text(font: 字体.宋体, size: 字号.小四, weight: "regular", lang: "zh")
set par(first-line-indent: 2em, leading: 15pt, justify: true)
show par: set block(spacing: 15pt)
// show: show-cn-fakebold
show: show-bibliography.with(bilingual: bilingual-bib)
show heading: show-heading.with(always-new-page: false)
show figure: show-figure.with(
main-body-table-numbering: "1.1",
main-body-image-numbering: "1-1", // 其他也会视为 image
appendix-table-numbering: "A.1",
appendix-image-numbering: "A-1", // 其他也会视为 image
)
show ref: show-ref.with(
main-body-table-numbering: "1.1",
main-body-image-numbering: "1-1", // 其他也会视为 image
appendix-table-numbering: "A.1",
appendix-image-numbering: "A-1", // 其他也会视为 image
)
set math.equation(numbering: set-math-numbering.with(
main-body-numbering: "(1.1)",
appendix-numbering: "(A.1)",
))
set footnote(numbering: num => number-with-circle(num))
set footnote.entry(
separator: line(start: (2.5em, 0pt),length: 30%, stroke: 0.5pt)+v(0.5em),
gap: 1em
)
show footnote.entry: bachelor-footnote
set heading(numbering: chinese-numbering)
doc
} |
https://github.com/polarkac/MTG-Stories | https://raw.githubusercontent.com/polarkac/MTG-Stories/master/stories/006%20-%20Magic%202014/005_A%20Blessed%20Life.typ | typst | #import "@local/mtgstory:0.2.0": conf
#show: doc => conf(
"A Blessed Life",
set_name: "Magic 2014",
story_date: datetime(day: 24, month: 07, year: 2013),
author: "<NAME>",
doc
)
The inquisitor towered over Brenalt, her face impassive and stern. "Explain to me how you survived, Soldier." The threat hung plain and heavy in her voice. If his story did not satisfy the inquisitor, Brenalt would never rise from his hospital bed.
The young soldier's wounds were serious—several deep cuts and gouges, two broken ribs, and a fractured shield-arm. But despite the pain he was in and the obvious threat to his life, Brenalt seemed calm, almost serene.
"I don't think you'll believe me, Ma'am. I don't entirely believe it myself."
The inquisitor scoffed: "Here's what I believe. Your squad was overrun by a band of the undead. Each of your comrades died doing their duty. But not you. You alone returned, your miserable life intact. I believe you made a deal for your life, and the seed of darkness is now within you. Confess it now, and I can make your end a merciful one."
Brenalt smiled weakly. "You are half-right, Ma'am. I did make a deal, but not with a demon."
#v(0.35em)
#line(length: 100%, stroke: rgb(90%, 90%, 90%))
#v(0.35em)
Brenalt threw his entire weight against the decaying door, and it slammed shut with an echoing boom. The ruined shrine was remarkably intact, considering how long this region had been behind the undead lines. The walls would hold for a little while. Time enough to consider, breathe, and mourn. Tomas, Edrick, and Stanton were dead. His best friends. The four have been inseparable as boys, and now Brenalt was alone for the first time. Mattias was slumped down next to a cracked and crumbled statue; he wouldn't last the night with wounds like those. Brenalt had no idea what had happened to the rest of his squad. This was supposed to be a simple reconnaissance mission, light resistance if any. It hadn't worked out that way.
"I could use some water." Mattias's voice was cracked and raspy. Brenalt's waterskin was mostly empty, but he eased a few last drops into Mattias's mouth. Mattias sputtered and coughed. "Probably a waste of water, but thank you. You should run, Bren. You should run until you can't. You're not too bad off, you might make it. Tell our families." Mattias coughed, groaned, and slumped down a little deeper.
Mattias's eyes shut and did not open again.
The wind was rising outside, and it whistled over the gaps in the roof tiles. Brenalt looked around the shrine, looking for anything to brace the door, or maybe a place to hide and rest. There was almost nothing left. The icons and statues had all been torn apart, deep gouges were dug in the stonework as the monsters defiled this once-sacred place. But an altar remained, largely intact, and a shaft of moonlight shone down on it from above. Brenalt limped over to it, and got down on his knees. His prayer was wordless—a simple expression of fear, hope, and need.
The wind changed.
Brenalt was not alone. He opened his eyes, and was surrounded by warmth and light. At the center of it all was #emph[her] . His heart felt as if it were being pressed by her presence and beauty. Not beauty in the normal sense—there was absolutely nothing human about her. This was a creature from a different world, as alien in thought and mind as she was familiar in form. Her expression was calm, entreating, and almost amused at the young man kneeling before her.
"Uh... hello." The angel's expression did not change. "I need help. I don't know if you... if you're watching, if you even know what's happening down here, but we're fighting a war, and we're losing. My squad is dead, and I don't think I'm going to make it home, either. But I want to. A lot of people are giving up, but I'm not. I'll keep fighting, I'll do everything I can, but... I don't have the strength to do it alone."
The angel's smile widened, and she nodded once. Somewhere deep in his chest, Brenalt felt a welling of strength. A pact had been reached.
#v(0.35em)
#line(length: 100%, stroke: rgb(90%, 90%, 90%))
#v(0.35em)
The inquisitor's eyes were closed. Her face had softened, and she weighed her thoughts for a long time before speaking.
"I believe you, soldier. There hasn't been a verified visitation in decades, but... I believe you. Maybe I'm wrong, maybe you're lying and you'll be the death of us all. But I think I need to believe."
The inquisitor held the young soldier's hand in silence for several minutes.
#v(0.35em)
#line(length: 100%, stroke: rgb(90%, 90%, 90%))
#v(0.35em)
"We're running out of ideas, <NAME>. Even our clearest victories are losses when it comes down to numbers. Most of their dead just get stitched back together, alongside #emph[every] man and woman we lose. We've deployed clerics to the front lines. But if we lose them, and we do, they rise as a perversion of what they once were."
Brenalt had risen through the ranks quickly—he had been promoted to Captain within weeks of returning to duty, and after a further series of improbable victories, promoted again and again over the last four years. Had the war's progress been less dismal, his rise would have been unlikely. As it was, the ranks of officers needed replenishing on a regular basis.
The men and women who fought with him knew he had been blessed. He didn't speak of it himself, but the rumors flew through the camps. General Brenalt had been blessed by the angels, and no matter how bad it got, Brenalt managed to emerge victorious.
Those victories were relative, however. Ranks and ranks of the dead could be destroyed, but there never seemed to be an end to them. Since the war began, there had never been a report of any sort of commanders among the undead. The existence of a necromancer or demon as the driving force behind the enemy had been theorized, but if that enemy existed, it had never shown itself. A council of the remaining generals and political leaders had been assembled to try to come up with a new strategy, as the end of the entire human population was coming into view.
"And what of the angels, Brenalt? What do they say to you? Why haven't they come to help us?" Another commander, younger than he was, had a look of hope in his eyes that Brenalt had come to recognize.
"They don't speak to me. I don't know why they do, or don't do, anything. I've talked to the elders, I've talked to the priests, and all that I can say for certain is they are very, very different than we are. We see them as beautiful, but I do not think we see what they #emph[are] . Perhaps those are merely the forms they choose to show us. Forms that we can understand. We see a radiant smiling face, and we think that #emph[means] something. But they are as different from us as we are from a hound. Perhaps our worship is nothing more than the wagging of a hound's tail. Yet I have stood in the presence of an angel, and I have felt her benevolence. I know with absolute certainty that they are powerful. The angels answered my call once, and whatever they are, I still believe that they might come to our aid. But we cannot rely on them. We cannot rely on them even for hope."
A lightly armored scout burst into the war council and bent a knee before giving his message. "Battle report, my lords. The Fourth Legion is lost. The dead have overrun both Greenfield and River's Glen. Greenfield was evacuated, but they hit River's Glen out of nowhere. I don't think many people got out."
<NAME> shook her head. "The Fourth was down a division, and we could barely keep it supplied. I imagine the refugees from Greenfield will put a lot of pressure on the Eastern Tower; we should preemptively divert some supplies there if we can spare them. A damn shame about River's Glen, but it wasn't strategically important."
Brenalt leaned forward on the table, his head cradled in his hands.
"No. But it was my home."
#v(0.35em)
#line(length: 100%, stroke: rgb(90%, 90%, 90%))
#v(0.35em)
Brenalt hobbled to the top of a ridge and looked out at what had once been golden fields of wheat and rye. Now, it was a teeming mass of the dead, utterly despoiled. He could no longer ride a horse, not that he had a horse to ride—his leg had been crushed in battle a few months before. The army was no more. He could recognize some of the armor and insignia still being worn by the freshly risen in the army below—all that remained of a once-great fighting force.
Brenalt had no command, no warriors to assist him. He had been leading a small band of laborers and farmers to safety as holding after holding fell. As far as he knew, he, and the several dozen people with him, were the last humans alive.
Down the valley below, he saw a gaunt man wrapped in silks, escorted by dozens of skeletal servants. Even at this distance, Brenalt could feel his power. The necromancer was real, after all. Brenalt wondered if he had come to the front lines now, just to see the last vestiges of humanity crushed. A final moment of gloating over the last pieces of his victory as they fell into place.
Brenalt's despair turned to rage. He looked to the heavens and screamed.
"It was all for nothing! I gave you everything! I have buried everything I have ever loved, and for eight years, I have fought every single day! I have spread word of your #emph[light] and your #emph[love] , and that false hope led thousands to their deaths! Deaths that brought no rest! Now, at last, I will die with the last of my people. I will die fighting. I will die honoring my promise to you. Does it make you laugh? To hold out glimpses of hope to us sad little mortals? To watch us dance? Watch us suffer? Well, I don't care anymore. This will be the last sunrise for my people. I don't intend to watch it set."
He looked back over his shoulder to the handful of refugees that had followed him to the ridge. Their heads were all bowed in prayer.
Brenalt's rage faded, and a sad smile crept to his face. Whether it was out of mockery, respect, or desperation, he bowed his head with them.
He raised his staff toward the enemy, girding himself for one last charge.
The wind changed.
|
|
https://github.com/Enter-tainer/typstyle | https://raw.githubusercontent.com/Enter-tainer/typstyle/master/tests/assets/unit/markup/content-func.typ | typst | Apache License 2.0 | #doc-style.show-parameter-block("length", "number", [The size of the mark in the direction it is pointing. The width of a legend items preview picture, a small preview of the graph the legend item belongs to.], default: 0.2cm)
|
https://github.com/AHaliq/CategoryTheoryReport | https://raw.githubusercontent.com/AHaliq/CategoryTheoryReport/main/chapters/chapter3/optional.typ | typst | #import "../../preamble/lemmas.typ": *
#import "../../preamble/catt.typ": *
#import "@preview/fletcher:0.5.1" as fletcher: diagram, node, edge
#exercise("1")[In any category $bold(C)$, show that ... is a coproduct diagram just if for...]
For products we have the following as given
$
"UMP"(c_1^(-1) comp f^(-1), c_2^(-1) comp f^(-1)) &= f^(-1) \
Hom(op(bold(C)),s:Z,t:C) &iso Hom(op(bold(C)),s:C,t:A) times Hom(op(bold(C)),s:C,t:B) \
f^(-1) &iso (c_1^(-1) comp f^(-1), c_2^(-1) comp f^(-1))
$
taking its dual we derive
$
f &iso (f comp c_1, f comp c_2) \
Hom(bold(C),s:C,t:Z) &iso Hom(bold(C),s:A,t:C) times Hom(bold(C),s:B,t:C)
$
#exercise("2")[Show in detail that the free monoid functor $M$ preserves coproducts for any sets $A,B$ ...]
#figure(
diagram(
cell-size: 10mm,
$
& M(X)
edge("dl", M(a), <-)
edge("dr", M(b), <-) \
M(A)
edge("d", 1_(M(A)), <-) &
M(A + B)
edge("l", M(q_a), <-)
edge("r", M(q_b), <-)
edge("u", M(u), "-->")
edge("dl", M(q_a), <-)
edge("dr", M(q_b), <-)
edge("d", u', "<--")
&
M(B)
#edge("d", $1_(M(B))$, "->", label-anchor: "west", label-sep: 0em) \
M(A) &
M(A) + M(B)
edge("l", <-)
edge("r", <-) &
M(B)
$,
),
)
$
"UMP"(a,b) &= u \
"UMP"(M(a), M(b)) &= M(u) \
"UMP"(M(a), M(b)) &= M(u) comp u' \
$
by uniqueness property of UMP
$
M(u) &= u' comp M(u) \
1_(M(A+B)) &= u' \
M(A+B) &= M(A) + M(B)
$
#exercise("3")[Verify that the construction given in the text of the coproduct of monoids $A+B$ as a quotient of the free monoid $M(|A|+|B|)$ really is a coproduct in the category of monoids.]
#figure(
diagram(
cell-size: 10mm,
$
C
#edge("r", $c_1$, "->", shift: 3pt)
#edge("r", $c_2$, "->", shift: -3pt, label-anchor: "north", label-sep: 0em) &
M(|A|+|B|)
#edge("rr", $q$, ">->", bend: 30deg)
#edge("drr", $[f,g]'$, "->", bend: -30deg) &
A
edge("r", i_A, ->)
edge("dr", f, ->) &
M(|A|+|B|) slash ~
edge("d", [f,g], "-->") &
B
edge("l", i_B, ->)
edge("dl", g, ->) \
& & & M
$,
),
)
1. $arr([f,g],M(|A|+|B|) slash ~, M)$ is defined as follows
$
[f,g]([a] dot "rest") &= f(a) dot_M [f,g]("rest") \
[f,g]([b] dot "rest") &= g(b) dot_M [f,g]("rest")
$
2. $q$ is defined as a quotient of $M(|A|+|B|)$ such that
$
[f,g]' comp c_1 = [f,g]' comp c_2 => [f,g] comp q = [f,g]'
$
3. thus a coequalizer by $"UMP"(c_1,c_2,q) = [f,g]$
4. thus $[f,g]$ is unique by $q$ being a coequalizer
5. thus the coproduct $A+B$ holds for $"UMP"(f,g)=[f,g]$
6. therefore, we have $M(|A|+|B|) slash ~ = A + B$
#exercise("4")[Show that the product of two powerset boolean algebras $cal(P)(A)$ and $cal(P)(B)$ is also a powerset, ...]
#figure(
diagram(
cell-size: 10mm,
$
& X
edge("dl", a, ->)
edge("dr", b, ->)
edge("d", u, "-->") \
cal(P)(A)
edge("r", pi_1, <-) &
cal(P)(A + B) &
cal(P)(B)
edge("l", pi_2, <-)
$,
),
)
$
pi_1 &= [S |-> S sect A}] \
pi_2 &= [S |-> S sect B] \
a &= [x |-> u(x) sect A}] \
&= [S |-> S sect A] comp [x |-> u(x)]\
&= pi_1 comp u \
b &= pi_2 comp u \
"UMP"(a,b) &= u
$
#exercise("6")[Verify that the category of monoids has all equalizers and finite products.]
#figure(
diagram(
cell-size: 10mm,
$
A_2 &
A_0
edge("l", i', "hook->")
edge("r", i, "hook->") &
A_1
#edge("r", $f$, "->", shift: 3pt)
#edge("r", $g$, "->", shift: -3pt, label-anchor: "north", label-sep: 0em) &
B \
& Z
edge("u", h, "-->")
edge("ur", z, ->)
edge("ul", z', ->)
$,
),
)
1. let $A_0 = {a | a in A_1 and f(a) = g(a)}$ making $A_0 subset.eq A_1$ and $i$ its inclusion
2. moreover $forall x. h(x)= z(x)$ making $h$ uniquely determined from $z$
3. thus equalizer UMP $f comp z = g comp z => i comp h = z$ holds
4. let $A_0 subset.eq A_2$ with $i'$ its inclusion
5. thus $forall x. h(x)=z'(x)$ as well satisfying the UMP for product
6. therefore $A_0 = A_1 times A_2 subset.eq A_1 sect A_2$
#exercise("10")[In the proof of proposition 3.24 in the text it is shown that any monoid $M$ has a specific presentation $T^2 M arrows.rr T M -> M$ as a coequalizer of free monoids. Show that coequalizers of this particular form are preserved by the forgetful functor $Mon -> Set$]
#figure(
diagram(
cell-size: 10mm,
$
|T^2 M|
#edge("r", $|epsilon|$, "->", shift: 3pt)
#edge("r", $|mu|$, "->", shift: -3pt, label-anchor: "north", label-sep: 0em) &
|T M|
#edge("r", $|pi|$, "->")
edge("dr", z, ->) &
|M|
edge("d", u, "-->") \
& & Z
$,
),
)
1. recall $|q| = [a |-> q(a)]$ from $q$ with arguments as single alphabets
2. since $pi (x_1, ..., x_n) = x_1 dot ... dot x_n$, then $|pi|(x) = x$, thus $|pi| = 1_(|T M|)$ and $u=z$
5. therefore $z comp |epsilon| = z comp |mu| => u comp |pi| = z$, preserving the coequalizer
#exercise("11")[Prove that $Set$ has all coequalizers by constructing the coequalizer of a parallel pair of functions $A arrows.rr^f_g B -> Q = B slash (f=g)$ by quotienting $B$ by a suitable equivalence relation $R$ on $B$, generated by the pairs $(f(x),g(x))$ for all $x in A$. Define $R$ to be the intersection of all equivalence relations on $B$ containing all such pairs.]
#figure(
diagram(
cell-size: 10mm,
$
A
#edge("r", $f$, "->", shift: 3pt)
#edge("r", $g$, "->", shift: -3pt, label-anchor: "north", label-sep: 0em) &
B
#edge("r", $q$, "->")
edge("dr", mu, ->) &
Q
edge("d", mu, "-->") \
& & B times B
$,
),
)
1. we know $R(b_1,b_2) = R(f(x),g(x))$
2. let $q(b) = {b | R(b,b)}$ and $mu(b) = (b,b)$
2. thus $mu comp f = mu comp g => mu comp q = mu$
$
(mu comp f)(x) = (mu comp g)(x) &=> (mu comp q)(b) = mu(b)\
mu(f(x)) = mu(g(x)) &=> {mu(b) | R(b,b)} = mu(b)\
(f(x),f(x)) = (g(x),g(x)) &=> {mu(b) | R(b,b)} = mu(b)\
R(f(x),g(x)) &=> {mu(b) | R(b,b)} = mu(b)\
R(b,b) &=> {mu(b) | R(b,b)} = mu(b)\
R(b,b) &=> mu(b) = mu(b)\
R(b,b) &=> top \
$
4. therefore the UMP holds for coequalizer
#exercise("12")[Verify the coproduct-coequalizer construction mentioned in the text for coproduct of rooted posets, that is, posets with a least element 0 and monotone maps preserving 0. Specifically, show that the coproduct $P +_0 Q$ of two such posets can be constructed as a coequalizer in posets, $1 arrows.rr^(0_p)_(0_Q) P+Q -> P +_0 Q$. You may assume as given the fact that the category of posets has all coequalizers.]
#figure(
diagram(
cell-size: 10mm,
$
1
#edge("r", $0_P$, "->", shift: 3pt)
#edge("r", $0_Q$, "->", shift: -3pt, label-anchor: "north", label-sep: 0em) &
P+Q
#edge("r", $q$, "->")
edge("dr", f, ->) &
P +_0 Q
edge("d", f, "-->") \
& & R
$,
),
)
1. $0_P, 0_Q$ is the representation of the least element in $P, Q$ respectively
2. $q$ quotients the least elements of $P, Q$ i.e. $0_P = 0_Q$
3. thus $f comp 0_P = f comp 0_Q => f comp q = f$ making $q$ the coequalizer
#exercise("13")[Show that the category of monoids has all coequalizers as follows
#exercise("1")[Given any pair of monoid homomorphisms $f,g:M->N$, show that the following equivalence relation on $N$ agree:
#exercise("a")[$n ~ n' <=>$ for all monoids $X$ and homomorphisms $h:N->X$, one has $h f = h g$ implies $h n= h n'$]
1. let $m$ be such that $f(m) = n, g(m) = n'$
2. thus
$
n &~ n' \
f(m) &~ g(m) \
(h comp f)(m) &~ (h comp g)(m) \
h(n) &~ h(n')
$
#exercise("b")[the intersection of all equivalence relations $~$ on $N$ satisfying $f m ~ g m$ for all $m in M$ as well as $n ~ n' and m ~ m' => n dot m ~ n' dot m'$]
1. ??
]
#exercise("2")[Taking $~$ to be the equivalence relation defined in (1), show that the quotient set $N slash ~$ is a monoid under $[n] dot [m] = [n dot m]$, and the projection $N -> N slash ~$ is the coequalizer of $f$ and $g$.]
?? whats $[n]$ again?
]
#exercise("14")[Consider the following category of sets:
#exercise("a")[Given a function $arr(f,A,B)$ describe the equalizer of the function $f comp p_1, f comp p_2 : A times A -> B$ as a binary relation on $A$ and show that it is an equivalence relation called the kernel of $f$]
?? what is a kernel?
#exercise("b")[Show that the kernel of the quotient $A -> A slash R$ by an equivalence relation $R$ is $R$ itself]
?? i need to learn more algebra about kernels
#exercise("c")[Given any binary relation $R subset.eq A times A$, let $[R]$ be the equivalence relation on $A$ generated by $R$. Show that the quotient $A -> A slash [R]$ is the coequalizer of the two projections]
#exercise("d")[Using the foregoing, show that for any binary relation $R$ on a set $A$ one can characterize the equivalence relation $[R]$ generated by $R$ as the kernel of the coequalizer of the two projections of $R$.]
]
*notes* in commutative diagram below eqn 3.8 in 3.24, it should be $T^2 M$ and not just $T^2$ right? |
|
https://github.com/cadojo/correspondence | https://raw.githubusercontent.com/cadojo/correspondence/main/_extensions/exploration/typst-show.typ | typst | MIT License | // Typst custom formats typically consist of a 'typst-template.typ' (which is
// the source code for a typst template) and a 'typst-show.typ' which calls the
// template's function (forwarding Pandoc metadata values as required)
//
// This is an example 'typst-show.typ' file (based on the default template
// that ships with Quarto). It calls the typst function named 'article' which
// is defined in the 'typst-template.typ' file.
//
// If you are creating or packaging a custom typst template you will likely
// want to replace this file and 'typst-template.typ' entirely. You can find
// documentation on creating typst templates here and some examples here:
// - https://typst.app/docs/tutorial/making-a-template/
// - https://github.com/typst/templates
#show: doc => $if(report)$report$else$article$endif$(
$if(title)$
title: [$title$],
$endif$
$if(theme)$
theme: $theme$,
$endif$
$if(by-author)$
author: (
$for(by-author)$
$if(it.name)$
author(
name: name(
$if(it.name.given)$
given: "$it.name.given$",
$endif$
$if(it.name.family)$
family: "$it.name.family$",
$endif$
$if(it.name.literal)$
literal: "$it.name.literal$",
$endif$
$if(it.name.dropping-particle)$
dropping-particle: "$it.name.dropping-particle$",
$endif$
$if(it.name.non-dropping-particle)$
non-dropping-particle: "$it.name.non-dropping-particle$",
$endif$
),
$if(it.name.url)$
url: "$it.name.url$",
$endif$
$if(it.name.email)$
email: "$it.name.email$",
$endif$
$if(it.name.phone)$
phone: "$it.name.phone$",
$endif$
$if(it.name.fax)$
fax: "$it.name.rax$",
$endif$
$if(it.name.orcid)$
orcid: "$it.name.orcid$",
$endif$
$if(it.name.note)$
note: "$it.name.note$",
$endif$
$if(it.name.acknowledgements)$
acknowledgements: "$it.name.acknowledgements$",
$endif$
$if(it.name.roles)$
roles: "$it.name.roles$",
$endif$
$if(it.affiliations)$
affiliations: (
$for(it.affiliations)$
affiliation(
$if(it.name)$
name: "$it.name$",
$endif$
$if(it.department)$
department: "$it.department$",
$endif$
$if(it.address)$
address: "$it.address$",
$endif$
$if(it.city)$
city: "$it.city$",
$endif$
$if(it.region)$
region: "$it.region$",
$endif$
$if(it.country)$
country: "$it.country$",
$endif$
$if(it.postal-code)$
postal-code: "$it.postal-code$",
$endif$
$if(it.url)$
urle: "$it.url$",
$endif$
)
$endfor$
),
$endif$
email: [$it.email$] ),
$endif$
$endfor$
),
$endif$
$if(date)$
date: [$date$],
$endif$
$if(abstract)$
abstract: [$abstract$],
$endif$
$if(margin)$
margin: ($for(margin/pairs)$$margin.key$: $margin.value$,$endfor$),
$endif$
$if(mainfont)$
font: ("$mainfont$",),
$endif$
$if(monofont)$
mono: ("$monofont$"),
$endif$
$if(fontsize)$
fontsize: $fontsize$,
$endif$
$if(toc)$
outline: $toc$,
$endif$
$if(report)$$else$
columns: $if(columns)$$columns$$else$1$endif$,
$endif$
doc,
)
|
https://github.com/19pdh/suplement-sprawnosci | https://raw.githubusercontent.com/19pdh/suplement-sprawnosci/master/proby.typ | typst | #let proby = (
(
img: "krazki/kolarz.svg",
nazwa: "<NAME>",
tagi: "#duch #siła",
opis: "Nasmaruj łańcuch, bo czeka Cię długa droga. Masz 24h aby przejechać 300km. Pamiętaj, nie koła cię niosą, tylko umysł prowadzi.
Wymagane sprawności: Sanitariusz, Wędrowiec, Kolarz"
),
(
img: "krazki/puszczanin.svg",
nazwa: "Puszczanin",
tagi: "#duch #hart",
opis: "Prawdziwy puszczan w lesie znajdzie wszystko co mu potrzebne. Ubierz się w mundur, a do plecaka spakuj śpiwór, nóż, baniak wody i pół chleba. Wyjdź do lasu i żyj z nim w zgodzie przez 48h. Podczas próby pozostań w ukryciu i nie zostawiaj po sobie śladów.
Wymagane sprawności: Rosomak, Kamyk"
)
)
|
|
https://github.com/catppuccin/typst | https://raw.githubusercontent.com/catppuccin/typst/main/requirements.typ | typst | MIT License | #import "@preview/oxifmt:0.2.1"
#import "@preview/tidy:0.3.0"
#import "@preview/valkyrie:0.2.1"
|
https://github.com/shunichironomura/iac-typst-template | https://raw.githubusercontent.com/shunichironomura/iac-typst-template/main/template/main.typ | typst | MIT No Attribution | // This template is licensed under the MIT-0 License. You can freely use and modify this template without any restrictions.
// #import "@preview/stellar-iac:0.4.1": project
#import "../lib.typ": project
#show: project.with(
paper-code: "IAC-24-A1.2.3",
title: "Title of the paper",
authors: (
(
name: "<NAME>",
email: "<EMAIL>",
affiliation: "Northbridge University",
corresponding: true,
),
(name: "<NAME>", email: "<EMAIL>", affiliation: "Western Institute of Technology"),
),
organizations: (
(
name: "Northbridge University",
display: "Department of Computer Science, Northbridge University, 123 Academic Road, Springfield, USA 12345",
),
(
name: "Western Institute of Technology",
display: "Department of Mechanical Engineering, Western Institute of Technology, 456 Research Avenue, Metropolis, USA 67890",
),
),
keywords: (
"Keyword 1",
"Keyword 2",
"Keyword 3",
),
header: [#lorem(20)],
abstract: [#lorem(200)],
)
#heading(numbering: none)[Nomenclature]
#lorem(40)
#heading(numbering: none)[Acronyms/Abbreviations]
#lorem(40)
= Introduction
#lorem(40)
== Subsection headings
#lorem(40)
=== Sub-subsection headings
#lorem(40)
$
arrow(F)_g = - G (m times m_E) / R_E^2 arrow(i)_r = m arrow(g)_(t a)
$
== Figure
You can reference figures like this @fig:randomized-sine-cosine.
#figure(
image("img/randomized-sine-cosine.png"),
caption: [Randomized variations of sine and cosine waveforms over time. The blue curve represents a sine wave with random noise added, while the green curve represents a similarly modified cosine wave.],
) <fig:randomized-sine-cosine>
== Table
You can reference tables like this @table:sample-data.
#figure(
table(
columns: 5,
table.header(
[],
[$alpha$],
[$beta$],
[$gamma$],
[$delta$],
),
[Parameter A], [3.21], [1.57], [0.89], [4.76],
[Parameter B], [0.123], [0.456], [0.789], [0.234],
),
caption: [Sample data of various parameters for $alpha$, $beta$, $gamma$, and $delta$],
) <table:sample-data>
= Cite the references
Indicate references like this @doe2023techniques. Or like this @doe2023techniques @johnson2019renewable.
= Results
#lorem(40)
= Discussion
#lorem(40)
= Conclusion
#lorem(20)
#heading(numbering: none)[Acknowledgements]
#lorem(20)
#heading(numbering: none)[Appendix A. Title of appendix]
#lorem(20)
#heading(numbering: none)[Appendix B. Title of appendix]
#bibliography("references.bib", title: "References", style: "american-institute-of-aeronautics-and-astronautics")
|
https://github.com/xsro/xsro.github.io | https://raw.githubusercontent.com/xsro/xsro.github.io/zola/typst/Control-for-Integrator-Systems/6highorder.typ | typst | #import "lib/lib.typ":ode45,get_signal,op,sig
#import "@preview/cetz:0.2.0"
#import cetz.plot
#import cetz.draw: *
= High-Order Sliding Mode Control for Integrator Systems
Tranditionally, a linear feedback can stabilize high-order system without robustness
#let highorder(ux)=(0,6).map(
C=>cetz.canvas({
plot.plot(
size: (6,3),
axis-style: "school-book",
x-tick-step: 1, y-tick-step:4,
{
let rhs(t,x)={
let delta=C*calc.sin(t)
let u=ux(x)
let dx=(
x1:x.x2,
x2:x.x3,
x3:x.x4,
x4:u+delta,
// u:u,
)
dx
}
let (xout,dxout)=ode45(rhs,14,(x1:4,x2:3,x3:2,x4:1),0.005,record_step:0.1)
plot.add(get_signal(xout,"x1"),label:$x_1$)
plot.add(get_signal(xout,"x2"),label:$x_2$)
plot.add(get_signal(xout,"x3"),label:$x_3$)
plot.add(get_signal(xout,"x4"),label:$x_4$)
},
y-label:"value",
x-label:"time",
title:$delta=#C$
)
})
)
#table(columns:(auto,auto,auto),align: center+horizon,
[],$x^((4))=u$,$x^((4))=u+10*sin(t)$,
[linear\ feedback],..highorder(x=>-(x.x1)-4*(x.x2)-6*(x.x3)-4*(x.x4)),
[relay SMC\ feedback],..highorder(x=>-10*op.sign(x.x1+2*op.sig(x.x2,4/3)+2*op.sig(x.x3,2)+op.sig(x.x4,4))),
)
#pagebreak()
#columns(2)[
Consider the system
$
sigma^((r))=u+delta.
$
Nested Sliding Controllers are given by
$
u&=-alpha Psi_(r-1,r)(sigma,dot(sigma),dots,sigma^((r-1)))\
Psi_(0,r)&="sign"(sigma)\
Psi_(i,r)&="sign"(sigma^((i))+beta_i N_(i,r) Psi_(i-1,r))\
N_(i,r)&=(|sigma|^(1/r)+|dot(sigma)|^(q/(r-1))+dots + |sigma^(q/(r-i+1))|)^(1/q)
$
]
#pagebreak() |
|
https://github.com/maucejo/book_template | https://raw.githubusercontent.com/maucejo/book_template/main/src/_book-utils.typ | typst | MIT License | #import "@preview/subpar:0.1.1"
#import "@preview/hydra:0.5.1": hydra
#import "_book-params.typ": *
// Equations
#let boxeq(body) = {
set align(center)
box(
stroke: 1pt + colors.gray,
radius: 5pt,
inset: 0.5em,
fill: colors.gray.lighten(60%),
)[#body]
}
#let nonumeq(x) = {
set math.equation(numbering: none)
x
}
// Subfigure
#let subfigure = subpar.grid.with(
gap: 1em,
numbering: n => if states.isappendix.get() {numbering("A.1", counter(heading).get().first(), n)
} else {
numbering("1.1", counter(heading).get().first() , n)
},
numbering-sub-ref: (m, n) => if states.isappendix.get() {numbering("A.1a", counter(heading).get().first(), m, n)
} else {
numbering("1.1a", counter(heading).get().first(), m, n)
},
supplement: fig-supplement
)
// Long and short captions for figures or tables
#let ls-caption(long, short) = context if states.in-outline.get() { short } else { long }
// Font exists ?
#let checkfont(font) = context {
let res = true
let size = measure(text(font: font, fallback: false)[
Test
])
if size.width == 0pt {
res = false
}
return res
}
// Page header and footer - add empty page if necessary
#let page-header = context {
let is-start-chapter = query(heading.where(level:1))
.map(it => it.location().page())
.contains(here().page())
if not state("content.switch", false).get() and not is-start-chapter {
return
}
state("content.pages", (0,)).update(it => {
it.push(page)
return it
})
if not is-start-chapter { // Use of Hydra for the header
set text(style: "italic", fill: colors.gray)
if calc.odd(here().page()) {
align(right, hydra(2, book: true))
} else {
align(left, hydra(1))
}
}
}
#let page-footer = context {
let is-start-chapter = query(heading.where(level:1))
.map(it => it.location().page())
.contains(here().page())
let has-content = state("content.pages", (0,)).get()
.contains(here().page())
let current-page = counter(page).get().first()
let total-page = counter(page).final().first() - 2
if has-content or is-start-chapter {
if states.page-numbering.get() == "i" {
align(center, counter(page).display(states.page-numbering.get()))
} else {
align(center, [#current-page / #total-page])
}
} else {
if current-page > 2 {align(center, [#current-page / #total-page])}
}
} |
https://github.com/7sDream/fonts-and-layout-zhCN | https://raw.githubusercontent.com/7sDream/fonts-and-layout-zhCN/master/chapters/02-concepts/dimension/vertical-adv.typ | typst | Other | #import "/template/template.typ": web-page-template
#import "/template/components.typ": note
#import "/lib/glossary.typ": tr
#show: web-page-template
// ### Vertical advance
=== #tr[vertical advance]
// Not all scripts are written horizontally! Computers are still pretty bad at dealing with vertical scripts, which is why we need books like this, and why we need readers like you to push the boundaries and improve the situation.
不是所有#tr[scripts]都是水平书写的!直到现在,计算机在处理垂直#tr[scripts]时的表现依旧很差,这就是我们编写这本书的原因。我们需要像你这样的读者来帮助改善这一情况,进一步扩展技术的边界。
// In a vertical environment, the baseline is considered the middle of the glyph, and the distance to be advanced between em-squares is the *vertical advance*:
在垂直排版环境中,#tr[baseline]被放置在#tr[glyph]的中间。#tr[em square]间的步进距离称为*#tr[vertical advance]*(@figure:vertical-advance)。
#figure(
caption: [垂直步进],
)[#include "vertical-advance.typ"] <figure:vertical-advance>
// For fonts which have mixed Latin and CJK (Chinese, Japanese, Korean), just ignore the Latin baseline and cap heights and put the glyph outlines in the middle of the em square.
对于支持 CJK(中日韩文)和拉丁字母混排的字体来说,可以忽略拉丁字母的#tr[baseline]和#tr[cap height],将非拉丁#tr[glyph]#tr[outline]直接放置在#tr[em square]中间(@figure:vertical-2)。
#figure(
caption: [汉字和拉丁字母混排文本],
placement: none,
)[#include "vertical-2.typ"] <figure:vertical-2>
// > Font editors usually support vertical layout metrics for Chinese and Japanese; support for vertical Mongolian is basically non-existant. (To be fair, horizontal Mongolian doesn't fare much better.) However, the W3C (Worldwide Web Consortium) has just released the [Writing Models Level 3](https://www.w3.org/TR/css-writing-modes-3/) specification for browser implementors, which should help with computer support of vertical writing - these days, it seems to be browsers rather than desktop publishing applications which are driving the adoption of new typographic technology!
#note[
字体编辑器通常都支持中文和日文的垂直#tr[layout]#tr[metrics],但对垂直蒙文的支持基本上可以说是不存在。(公平的说,即使是水平蒙文也没有得到多少支持。)不过万维网联盟(Worldwide Web Consortium,W3C)刚刚发布了针对浏览器的Writing Models Level 3#[@W3C.CSSWritingLevel3.2019]实现规范,它有望帮助计算机对于垂直书写的支持更快落地。最近似乎是浏览器而不是桌面出版程序在推动新#tr[typography]技术的发展和采用。
]
|
https://github.com/donghoony/typst_editorial | https://raw.githubusercontent.com/donghoony/typst_editorial/main/template.typ | typst | MIT License | #let project(title: "", authors: (), logo: none, body) = {
set document(author: authors, title: title)
set text(font: "Pretendard", lang: "ko")
v(0.6fr)
if logo != none { align(right, image(logo, width: 12%)) }
v(9.6fr)
text(2em, weight: 700, title)
pad(
top: 0.7em,
right: 20%,
grid(
columns: (1fr,) * calc.min(3, authors.len()),
gutter: 1em,
..authors.map(author => align(start, strong(author))),
),
)
v(2.4fr)
pagebreak()
set par(justify: true)
body
} |
https://github.com/Br0kenSmi1e/ScatteringComputation | https://raw.githubusercontent.com/Br0kenSmi1e/ScatteringComputation/main/README.md | markdown | # ScatteringComputation
Scattering based quantum computation.
- The slides - no animation: [main.pdf](main.pdf)
- The slides - typst source code: [main.typ](main.typ)
Tutorial: [How to open typst in VSCode](https://github.com/CodingThrust/Templates/tree/main/typst) |
|
https://github.com/TJ-CSCCG/tongji-undergrad-thesis-typst | https://raw.githubusercontent.com/TJ-CSCCG/tongji-undergrad-thesis-typst/main/init-files/sections/01_intro.typ | typst | MIT License | #import "../../paddling-tongji-thesis/tongjithesis.typ": *
= 基本功能介绍 <introduction>
欢迎使用基于#link("https://typst.app")[Typst]的同济大学本科生毕业设计论文模板!
Typst是被广泛认为是#LaTeX 的 “进化版”,它保留了#LaTeX 的强大功能和灵活性,同时由于其编译时间短、易于上手等特点,也被认为是#LaTeX 的
“所见即所得(WYSIWYG,What You See Is What You Get)” 的实现。
Typst的设计理念是让文档的制作过程更加高效和愉快,同时保持专业级的输出质量。然而,由于Typst仍处于开发阶段,它的功能远没有#LaTeX 和基于#LaTeX 的C#TeX 那么丰富,因此在使用Typst时,我们可能需要一些额外的工作来完成一些特殊的排版需求。
在本节(@introduction)中,我们将介绍 Typst
的简单使用方法,尤其是中文排版的相关内容,并提供一些常用的排版示例。如果你对
Typst 的使用方法还不太熟悉,可以参考#link("https://typst.app/docs")[#emph[Typst的官方文档]]。
== 标题
Typst 用 `=` 来表示标题,其后紧跟标题内容。标题的级别由 `=` 的个数决定,`=` 的个数越多,标题级别越低。本模板支持的标题级别最高为
5,即
`=====`。
除了 `=`,Typst 还支持使用 #raw("#heading()", lang: "typ") 函数来表示标题,还可以自定义标题的样式。
下面是一个标题的例子:
#table(
columns: (1fr, 1fr), [
#set align(center)
#strong[代码]
], [
#set align(center)
#strong[渲染结果]
], ```typ
#heading(level: 2, outlined: false, "二级标题")
二级标题是一种较为重要的标题级别,一般用于表示文章中的主要章节或主题。通常,它们会在上面添加分割线或加粗等效果,以突出其重要性。
#heading(level: 3, outlined: false, "三级标题")
相对于二级标题而言,三级标题是更加具体的标题级别,通常用于表示二级标题下的具体内容描述。它们的长度通常比二级标题短,与二级标题之间应有一定的间距。
#heading(level: 4, outlined: false, "段落标题")
段落标题是文章中比正文稍微具有一些重要性和突出性的内容,通常用加粗或斜体等方式来区别于正文。
#heading(level: 5, outlined: false, "子段落标题")
子段落标题是相对于段落标题更加细节化的内容,用于突出一段文字中的重点内容。通常采用斜体或加粗的方式表示。在一些正式的文献中,子段落标题的使用较少。
```, [
#h(2em)
#heading(level: 2, outlined: false, "二级标题")
二级标题是一种较为重要的标题级别,一般用于表示文章中的主要章节或主题。通常,它们会在上面添加分割线或加粗等效果,以突出其重要性。
#heading(level: 3, outlined: false, "三级标题")
相对于二级标题而言,三级标题是更加具体的标题级别,通常用于表示二级标题下的具体内容描述。它们的长度通常比二级标题短,与二级标题之间应有一定的间距。
#heading(level: 4, outlined: false, "段落标题")
段落标题是文章中比正文稍微具有一些重要性和突出性的内容,通常用加粗或斜体等方式来区别于正文。
#heading(level: 5, outlined: false, "子段落标题")
子段落标题是相对于段落标题更加细节化的内容,用于突出一段文字中的重点内容。通常采用斜体或加粗的方式表示。在一些正式的文献中,子段落标题的使用较少。
],
)
值得注意的是,本模板中的标题样式已经根据同济大学的毕业论文要求进行了调整,因而可能与
Typst 的默认样式有所不同。
== 字体
与Markdown类似,在Typst中,粗体文字用 `*` 包裹,斜体文字用 `_` 包裹,等宽字体用 #raw("`") 包裹。例如:
#table(columns: (1fr, 1fr), [
#set align(center)
#strong[代码]
], [
#set align(center)
#strong[渲染结果]
], ```typ
In Typst, *bold*, _italic_ and `monospace` are supported.
```, [
In Typst, *bold*, _italic_ and `monospace` are supported.
])
在本模板中,我们将中文的粗体、斜体和等宽字体分别预设为 “#strong[黑体]”、“#emph[楷体]”
和 “#raw("仿宋")”。
请注意,因为语法解析的限制, `*...*`、`_..._` 和 #raw("`...`") 的前后有时需要空格分隔;而由于中文字体的特殊性,这样会导致额外的空格出现。因此,为了避免这种情况,我们可以使用 #raw("#emph[...]", lang: "typ") 函数来表示斜体,#raw("#strong[...]", lang: "typ") 函数来表示加粗,#raw("#raw(\"...\")", lang: "typ") 函数来表示等宽字体。例如:
#table(
columns: (1fr, 1fr), [
#set align(center)
#strong[代码]
], [
#set align(center)
#strong[渲染结果]
], ```typ
在中文环境中, *粗体*、_斜体_ 和 `等宽字体` 可能会导致额外的空格出现。而#strong[粗体]、#emph[斜体]和#raw("等宽字体")则不会。
```, [
在中文环境中, *粗体*、_斜体_ 和 `等宽字体` 可能会导致额外的空格出现。而#strong[粗体]、#emph[斜体]和#raw("等宽字体")则不会。
],
)
此外,Typst 还支持使用 #raw("#[#set text(font: <some_font>); <some_text>]", lang: "typ") 命令来自定义字体。在本模板中,我们预置了方正字库中的以下字体,并设置了相应的别名供使用。
#table(
columns: (auto, auto, 1fr), [
#set align(center)
#strong[字体]
], [
#set align(center)
#strong[别名]
], [
#set align(center)
#strong[渲染结果]
], [
#set align(center)
#set text(font: font-family.song)
宋体
], [
#set align(center)
#raw("font-family.song", lang: "typ")\
或\
#raw("songti", lang: "typ")
], [
#set text(font: font-family.song)
#h(2em)1900年前后,由埃里希 · 宝隆创办的 “同济医院” 正式挂牌。埃里希 ·
宝隆医生看到医院里的医疗力量不足,计划在院内设立德文医学堂,招收中国学生,培养施诊医生。
], [
#set align(center)
#set text(font: font-family.hei)
黑体
], [
#set align(center)
#raw("font-family.hei", lang: "typ")\
或\
#raw("heiti", lang: "typ")
], [
#set text(font: font-family.hei)
#h(2em)这个计划得到德国驻沪总领事以及德国政府高等教育司的支持。1906年,他们设立了一个支持医学堂开办的基金会,得到了德国
“促进德国与外国思想交流的科佩尔基金会”
的协助,筹集到一批医科书刊及新式的外科手术电动器械等物品。
], [
#set align(center)
#set text(font: font-family.kai)
楷体
], [
#set align(center)
#raw("font-family.kai", lang: "typ")\
或\
#raw("kaiti", lang: "typ")
], [
#set text(font: font-family.kai)
#h(2em)1907年6月医学堂开学前,德国驻沪总领事克纳佩在上海不仅号召德国商人捐款,而且要求德国洋行向中国商人募捐。同时,费舍尔还要求中国官方的资助和支持,克纳佩利用在中德两国募来的捐款,成立了
“为中国人办的德国医学堂基金会”。
], [
#set align(center)
#set text(font: font-family.fangsong)
仿宋
], [
#set align(center)
#raw("font-family.fangsong", lang: "typ")\
或\
#raw("fangsong", lang: "typ")
], [
#set text(font: font-family.fangsong)
#h(2em)董事会由18人组成,主要成员有:三个德医公会元老:宝隆、福沙伯(第二任校长)、福尔克尔;三名德国商人:莱姆克、米歇劳和赖纳;两名中国绅商:朱葆三(沪军都督府财政部长及上海商务会会长,大买办)、虞洽卿(荷兰银行买办);总领事馆的副领事弗赖海尔
· 冯 · 吕特等。
], [
#set align(center)
#set text(font: font-family.xiaobiaosong)
小标宋
], [
#set align(center)
#raw("font-family.xiaobiaosong", lang: "typ")\
或\
#raw("xiaobiaosong", lang: "typ")
], [
#set text(font: font-family.xiaobiaosong)
#h(2em)埃里希 ·
宝隆医生被正式推选为董事会总监督(董事长)兼学堂首任总理(校长),负责学堂的管理。医学堂的校址设在同济医院对面的白克路(今凤阳路415号上海长征医院内)。1907年10月1日德文医学堂举行了开学典礼。
], [
#set align(center)
#set text(font: font-family.xihei)
细黑
], [
#set align(center)
#raw("font-family.xihei", lang: "typ")\
或\
#raw("xihei", lang: "typ")
], [
#set text(font: font-family.xihei)
#h(2em)1923年3月17日北洋政府教育部下达第108号训令,批准同济工科
“改为大学”。学校随即召开董事会议,将学校定名为 “同济大学”。1923年3月26日,学校以
“同济大学董事会” 名义呈文北洋政府教育部,称 “经校董会议定名称为同济大学”。
],
)
我们还可以使用 #raw("#underline[]", lang: "typ") 命令来表示下划线,例如:
#table(columns: (1fr, 1fr), [
#set align(center)
#strong[代码]
], [
#set align(center)
#strong[渲染结果]
], ```typ
#underline[中Lorem文ipsum中dolor文]
```, [
#underline[中Lorem文ipsum中dolor文]
])
=== 生僻字支持
由于本模板使用的是方正字库GBK字体,我们可以直接使用生僻字#footnote[此处的生僻字指:GBK编码中有,但GB2312编码中没有的字。]:丂丄丅丆丏丒丗丟丠両丣並丩丮丯丱丳丵丷丼乀乁乂乄乆乊乑乕乗乚乛乢乣乤乥乧乨乪乫乬乭乮乯。
|
https://github.com/andreasKroepelin/TypstJlyfish.jl | https://raw.githubusercontent.com/andreasKroepelin/TypstJlyfish.jl/main/examples/summary-tables.typ | typst | MIT License | #import "../typst/lib.typ": *
#set page(height: auto, width: auto, margin: 1em)
#read-julia-output(json("summary-tables-jlyfish.json"))
#jl-pkg("SummaryTables")
#jl(```julia
using SummaryTables
```)
#jl(```julia
n = 123
data = (
sex = rand(["male", "female"], n),
age = rand(18:60, n),
typesetting = rand(["Typst", "LaTeX"], n),
citations = rand(0:100, n),
editor = rand(["vim", "emacs", "helix", "nano", "micro", "amp"], n)
)
table_one(
data,
[
:sex => "Sex",
:age => "Age (years)",
:typesetting => "Preferred typesetting system",
:citations => "Number of citations",
],
groupby = :editor => "Preferred text editor",
show_n = true,
)
```)
|
https://github.com/FuryMartin/I-QinShiHuang-Money | https://raw.githubusercontent.com/FuryMartin/I-QinShiHuang-Money/master/README.md | markdown | Creative Commons Zero v1.0 Universal |
<p align="center">
<picture>
<img alt="我,秦始皇,打钱" src="./assets/我,秦始皇.png" width=55%>
</picture>
</p>
## 使用
- VSCode 安装 [Tinymist Typst](https://marketplace.visualstudio.com/items?itemName=myriad-dreamin.tinymist) 插件
- 编辑 `data.json` 中的的对应字段
- 预览 `main.typ` 并导出
## 字体
需要安装:[三极小篆简](https://www.fonts.net.cn/font-39567254338.html)
## 效果

致谢:
- 该模版参考了 [erictapen/typst-invoice](https://github.com/erictapen/typst-invoice) 的实现 |
https://github.com/Jbolt01/cv | https://raw.githubusercontent.com/Jbolt01/cv/main/main.typ | typst | #set document(
title: "Vijay Shanugam Resume",
author: "<NAME>",
)
#set page(paper: "us-letter", margin: 0.5in)
#set text(size: 10pt, font: ("linux libertine"))
#set table(
stroke: none,
inset: 3pt,
columns: (70%, 30%),
align: (x, y) => (left, right).at(x),
)
#set list(
spacing: 5pt,
indent: 15pt,
marker: strong[•],
)
#show heading: it => [
#set text(25pt)
#block(below: 5pt, it.body)
]
#align(
center,
)[
= #smallcaps[Vijay Shanmugam] \
#link(
"mailto:<EMAIL>",
)[#underline(offset: 4pt)[<EMAIL>]]
$bar.v$ 202-815-0071 $bar.v$
#link(
"https://linkedin.com/in/vijay-shanmugam",
)[#underline(offset: 4pt)[linkedin.com/in/vijay-shanmugam]]
]
#show heading: it => [
#set text(13pt, weight: "regular")
#block(
height: 14pt,
width: 100%,
stroke: (bottom: 1pt),
above: 10pt,
below: 5pt,
smallcaps(it.body)
)
]
#show table: it => [
#block(below: 4pt, it)
]
== Education
#table(
[#strong[B.S. in Computer Science & Electrical and Computer Engineering]],
[#align(right)[Aug 2023–May 2027]],
[#emph[Cornell University]],
[#emph[Ithaca, NY]],
)
- *CS Courses:* Object-Oriented Programming and Data Structures, Data Structures and Functional Programming
- *ECE Courses:* Embedded Systems, Digital Logic and Computer Organization, Probability and Inference for Random Signals
- *Activities:* Cornell Quant Fund, Cornell International Collegiate Programming Competition
== Experience
#table(
[#strong[Space Exploration Sector Intern]],
[#align(right)[Jun 2022–Aug 2024]],
[#emph[Johns Hopkins University Applied Physics Laboratory]],
[#emph[Laurel, MD]],
)
- Designed a high-level RF subsystem for an Ion Beam Deflection mission, including antenna configuration selection and comprehensive link budget analysis based on inter-subsystem data rates.
- Developed radio frequency test equipment automation scripts using Ruby (COSMOS) and Python (GSEOS), streamlining testing processes and improving efficiency.
- Implemented Continuous Integration and Deployment for HDL development using Atlassian Bamboo, optimizing synthesis with build artifact caching to reduce build times and improve code quality.
#table(
[#strong[System Operator]],
[#align(right)[Oct 2021–May 2023]],
[#emph[Montgomery Blair High School]],
[#emph[Silver Spring, MD]],
)
- Led team of 10 designers and developers to build a new website for largest high school in Maryland.
- Deployed containerized software on Linux servers for over 3500 daily users.
- Maintained Django website and CMS for Silver Chips Online, a newspaper with over 50k annual readers.
#table(
[#strong[Data Science Intern]],
[#align(right)[Jun 2021–Aug 2021]],
[#emph[LendingPoint]],
[#emph[Remote]],
)
- Conducted data analysis to optimize conversions on the sales funnel for eBay working capital loans, contributing to the improvement of the loan application process.
- Developed SQL queries to perform user-level analytics, integrating data from multiple platforms including Salesforce, Mouseflow, DOMO, Google Analytics, and Plaid.
- Gained practical experience in applying data science techniques to real-world financial technology problems, enhancing understanding of the intersection between data analysis and business operations.
== Projects
#table(
[#strong[prmpt: Prompt Compression Library for LLMs]],
[#align(right)[#link("https://github.com/Jbolt01/prmpt")[#underline(offset: 4pt)[github.com/Jbolt01/prmpt]]]],
)
- Developed a Python library to optimize large language model (LLM) performance by efficiently compressing input prompts, resulting in faster inference and reduced operational costs.
- Implemented multiple compression techniques, including autocorrection, entropy-based token elimination, and lemmatization, and incorporated advanced metrics like BERTScore to evaluate semantic preservation.
- Designed a modular architecture with a command-line interface, allowing for easy extension, customization, and integration into existing workflows.
== Skills
- *Languages:* Python, C, C++, Verilog, Java, OCaml, SQL, LaTeX, JavaScript, TypeScript, Matlab, Ruby
- *Libraries:* Numpy/Pandas, PyTorch/Tensorflow, Matplotlib, COSMOS, GSEOS, React
- *Tools:* Git/Terminal, Vivado/Quartus, GCP/AWS, Linux, Electronic Test Equipment, Soldering
== Awards
#table(
[Jane Street FTTP, 1st Place Electronic Training Competition (Advanced Division)], [Mar 2024],
[USA Computing Olympiad, Platinum Division], [Feb 2022],
[American Invitational Math Exam, Score: 9], [Feb 2022],
[American Math Competition 12, Distinguished Honor Roll], [Nov 2021]
)
|
|
https://github.com/saurabtharu/Internship-repo | https://raw.githubusercontent.com/saurabtharu/Internship-repo/main/Internship%20Report%20-%20typst/chapters/02-toc-list_of_abb-fig-tables.typ | typst |
#align(center,text(16pt)[
*TABLE OF CONTENTS*
])\
#text(12pt)[
#show outline.entry: it => {
if it.element.has("label") and (it.element.label == <appendices> or it.element.label == <references>) {
it.element.body
} else {
it
}
}
#show outline.entry.where(
level: 1
): it => {
v(10pt, weak: true)
strong(it)
}
#outline(
indent: 2em,
title: none,
) <TOC>
]
#pagebreak()
/*************************************************************************************/
= LIST OF FIGURES
#text(12pt)[
#outline(
title: [],
target: figure.where(kind: figure),
)
]
#pagebreak()
/*************************************************************************************/
= LIST OF TABLES
#text(12pt)[
#outline(
title: [],
target: figure.where(kind: table),
)
]
#v(50%)
#pagebreak()
/*************************************************************************************/
= LIST OF ABBREVIATIONS
\
#table(
columns: (1fr, 2fr),
inset: 5pt,
align: left,
fill: none,
stroke: none,
"CI/CD ", "Continuous Integration and Continuous Development",
"DHCP", "Dynamic Host Configuration Protocol",
"DNS", "Domain Name System",
"HAProxy", "High Availability",
"HTTPS", "Hypertext Transfer Protocol Secure",
"IAC ", "Infrastructure as Code",
"ITOPS", "IT Operation",
"LVM", "Logical Volume Manager",
"NFS", "Network File System",
"SELINUX", "Secure Linux",
"SSL ", "Secure Socket Layer",
"TCP/IP", "Transfer Control Protocol",
)
#pagebreak() |
|
https://github.com/jamesrswift/blog | https://raw.githubusercontent.com/jamesrswift/blog/main/assets/packages/booktabs/style.typ | typst | MIT License | #let toprule = stroke(0.8pt)
#let lightrule = stroke(0.3pt)
#let midrule = stroke(0.5pt)
#let bottomrule = stroke(0.8pt) |
https://github.com/AxiomOfChoices/Typst | https://raw.githubusercontent.com/AxiomOfChoices/Typst/master/Courses/Math%2018_785%20-%20Number%20Theory/Assignments/Assignment%202.typ | typst | #import "/Templates/generic.typ": latex, header
#import "@preview/ctheorems:1.1.0": *
#import "/Templates/math.typ": *
#import "/Templates/assignment.typ": *
#show: doc => header(title: "Assignment 2", name: "<NAME>", doc)
#show: latex
#show: NumberingAfter
#show: thmrules
#let col(x, clr) = text(fill: clr)[$#x$]
#let pb() = {
pagebreak(weak: true)
}
#set page(numbering: "1")
#let bar(el) = $overline(#el)$
#set enum(numbering: "(a)")
// #show math.equation: set text(font: "Latin Modern Math")
*Sources consulted* \
Classmates: <NAME>, <NAME>.\
Texts: Class Notes, Algebraic Number Theory by Milne, Elementry and Analytic Theory of Algebraic Numbers by Narkiewicz, Number Fields by Marcus.
= Question
== Statement
Let $cal(O)_K$ be the ring of integers of an imaginary quadratic field $K$ and let $c$ be a positive integer.
+ Prove that $cal(O) := ZZ + c cal(O)_K$ is an order, and that $c cal(O)_K$ is the conductor and $c = [cal(O)_K, cal(O)]$.
+ These exhaust all orders of $cal(O)_K$.
== Solution
+ Clearly $ZZ + c cal(O)_K$ is a sub-ring, but its fractional field must be the same as that of $cal(O)_K$ since we can simply divide by $c$ to get back any element of $cal(O)_K$. Now clearly $c cal(O)_K$ is an ideal, but using second isomorphism theorem $cal(O) quo c cal(O)_K iso ZZ quo (c) = ZZ_(c)$, the subrings of which are all of the form $(m)$ for $m divides c$. These are in bijection then to ideals of $cal(O)$ containing $c cal(O)_K$.
But now these ideals are all of the form $(m) + c cal(O)_K$ so they are not ideals of $cal(O)_k$ since they do not contain elements in $c cal(O)_K backslash m cal(O)_K$. Since an ideal of $cal(O)_K$ contained in $cal(O)$ would also be ideals of $cal(O)$ this exhausts all such ideals and thus $c cal(O)_K$ is indeed the conductor. Finally the co-sets of $cal(O)$ are of the form $cal(O) + m cal(O)_K$ for integers $m$ with $0 <= m < c$ so the index is exactly $c$.
+ Let $cal(O)$ be an arbitrary order of $cal(O)_K$. Set $c = [cal(O)_K:cal(O)]$, then we have $c cal(O)_K seq cal(O)$ and thus we also have $ZZ + c cal(O)_K seq cal(O)$. But we know that $[cal(O)_K : ZZ + c cal(O)_K] = c$ so we have $cal(O) = ZZ + c cal(O)_K$.
= Question
== Statement
+ Show that $f(X) = X^3 + X^2 - 2X + 8$ is irreducible in $QQ[X]$. Let $theta$ be a root of $f(X)$ and $K = QQ(theta)$.
+ Show that $theta' = 4 slash theta$ is integral.
+ Show that ${1, theta, theta'}$ is an integral basis of $cal(O)_K$ and the discriminant $Delta_K = -503$.
+ Show that for every $alpha in cal(O)_K$, ${1, alpha, alpha^2}$ cannot be an integral basis.
== Solution
+ Consider $ov(f)(X)$ which is the polynomial $f$ reduced $mod 3$ to $FF_3$. It is equal to $X^3 + X^2 - 2X + 2$, plugging in values we get
$
ov(f)(0) = 2\
ov(f)(1) = 1 + 1 - 2 + 2 = 2\
ov(f)(1) = 2 + 1 - 1 + 2 = 1\
$
so this polynomial has no root in $FF_3$. But a reducible polynomial with degree at most $3$ must have a root so this polynomial is not reducible.
+ The minimal polynomial for $theta'$ is
$
X^3 - X^2 + 2X + 8 = 0
$
we can check this
$
64 / theta^3 - 16 / theta^2 + 8 / theta + 8
=
(64 - 16 theta + 8 theta^2 + 8theta^3) / theta^3
=
0
$
+ We can calculate the minimal polynomials of $theta^2,(theta')^2$,
$
theta^4 = 3 theta^2 - 10 theta + 8\
theta^6 = 27 theta^2 - 50 theta + 104
$
so we have
$
(theta^2)^3 - 5 (theta^2)^2 - 12 (theta^2) - 64 = 0
$
and $tr(theta^2) = 5$. Similarly for $(theta')^2$ we have
$
(theta'^2)^3 + 3 (theta'^2)^2 - 12 (theta'^2) - 64 = 0
$
so $tr(theta'^2) = - 3$. The polynomial we already know give us $tr(theta) = -1$ and $tr(theta') = 1$.
Calculating the discriminant matrix gives us
$
mat(3, -1, 1; -1, 5, 12; 1, 12, -3)
$
who's determinant is $Delta_K = -503$ which is square free, making $1, theta, theta'$ an integral basis.
+ Let $alpha = a + b theta + c theta'$ be such that $1, alpha, alpha^2$ is an integral basis. Then $alpha' = b theta + c theta'$ also forms a basis, so we may assume that $a = 0$. Now we compute the trace of powers of $alpha$ but in $FF_2$
$
tr(b theta + c theta') mod 2 = b tr(theta) + c tr(theta') mod 2 = b + c mod 2
$
$
tr((b theta + c theta')^2) mod 2
= tr(b^2 theta + 2 b c (theta theta') + c^2 theta'^2) mod 2
= b^2 + c^2 mod 2 = b + c
$
$
tr((b theta + c theta')^3) mod 2
&= tr(b^3 theta^3 + 3 b^2 c (theta^2 theta') + 3 b c^2 (theta theta'^2) + c^3 theta'^3) mod 2
\ &= b tr(-theta^2 + 2theta -8) + 4 tr(3 b^2 c theta + 3 b c^2 theta') + c tr(theta'^2 - 2 theta' - 8) mod 2
\ &= b + c mod 2
$
$
tr((b theta + c theta')^4) mod 2
&=
tr(b^4 theta^4 + 4 b^3 c (theta^3 theta') + 6 b^2 c^2 (theta^2 theta'^2) + 4 b c (theta theta'^3) + c^4 theta'^4) mod 2
\ &=
tr(b^4 theta^4 + c^4 theta'^4) mod 2
=
b^4 tr(theta^4) + c^4 tr(theta'^4) mod 2
\ &=
b^4 tr(theta (-theta^2 + 2 theta - 8)) + c^4 tr(theta'(theta'^2 - 2 theta' - 8)) mod 2
\ &=
b^4 tr(theta (theta^2)) + c^4 tr(theta'(theta'^2)) mod 2
\ &=
b^4 tr(- theta^2 + 2 theta - 8) + c^4 tr(theta'^2 - 2 theta' - 8) mod 2
\ &=
b^4 tr(theta^2) + c^4 tr(theta'^2) mod 2
= b^4 + c^4 mod 2 = b + c mod 2
$
so the matrix for $Delta(1,alpha, alpha^2) mod 2$ looks like
$
mat(1, a + b, a+b; a+ b, a + b, a + b; a + b, a + b, a + b) = 0.
$
= Question
== Statement
Show that $f(X) = X^5 - X + 1$ is irreducible in $QQ[X]$. Let $theta$ be a root of $f(X)$ and $K = QQ(theta)$. Find an integral basis of $cal(O)_K$ and calculate the discriminant $Delta_K$.
== Solution
We consider $f(X)$ again modulo 3, we get $ov(f)(X) = X^5 + 2X + 1$. Now clearly $ov(f)$ has no roots in $FF_3$, so if it were reducible it would necessarily have an irreducible factor of degree $2$. That irreducible factor will split in $FF_9$ and thus would be a factor of $X^9 - X$, so let us check the $gcd(X^9 - X, X^5 + 2X + 1)$. We can compute
$
X^9 - X - (X^4 + 1) (X^5 + 2X + 1)
=
X^9 - X - X^9 - X^5 - 2 X^5 - 2X - X^4 - 1
\ =
2X^4 + 2.
$
Then
$
X^5 + 2X + 1 + X(2X^4 + 2)
= X + 1
$
But this clearly has no shared factor with $ov(f)$ since $X = 2$ is not a root of $ov(f)$. Thus $gcd(X^9 - X, X^5 + 2X + 1) = 1$ which contradicts the assumption that $X^5 + 2X + 1$ is reducible.
Let us now consider $K = QQ(theta)$, we are going to guess that the integer ring $cal(O)_K$ is monogenic and compute the discriminant $Delta(f)$. We compute the trace over the basis $(1, theta,theta^2, theta^3,theta^4)$.
$
theta (1, theta,theta^2, theta^3,theta^4)
=
(theta,theta^2, theta^3,theta^4, theta - 1)
$
so $tr(theta) = 0$. We continue like this
$
theta^2 (1, theta,theta^2, theta^3,theta^4)
=
(theta^2, theta^3,theta^4, theta-1, theta^2 - theta)
\
theta^3 (1, theta,theta^2, theta^3,theta^4)
=
(theta^3,theta^4, theta-1, theta^2 - theta, theta^3 - theta^2)
\
theta^4 (1, theta,theta^2, theta^3,theta^4)
=
(theta^4, theta-1, theta^2 - theta, theta^3 - theta^2, theta^4 - theta^3)
\
theta^5 (1, theta,theta^2, theta^3,theta^4)
=
(
theta-1, theta^2 - theta, theta^3 - theta^2, theta^4 - theta^3, - theta^4 + theta - 1
)
\
theta^6 (1, theta,theta^2, theta^3,theta^4)
=
(
theta^2 - theta, theta^3 - theta^2, theta^4 - theta^3, - theta^4 + theta - 1, theta^2 + 1
)
\
theta^7 (1, theta,theta^2, theta^3,theta^4)
=
(
theta^3 - theta^2, theta^4 - theta^3, - theta^4 + theta - 1, theta^2 + 1, theta^3 + theta
)
\
theta^8 (1, theta,theta^2, theta^3,theta^4)
=
(
theta^4 - theta^3, - theta^4 + theta - 1, theta^2 + 1, theta^3 + theta, theta^4 + theta^2
)
$
This gives us $tr(theta) = 0, tr(theta^3) = 0, tr(theta^4) = 4, tr(theta^5) = - 5, tr(theta^6) = 0, tr(theta^7) = 0, tr(theta^8) = 4$.
We now have the matrix
$
det mat(5, 0, 0, 0,4;0, 0, 0, 4, -5;0,0,4,-5,0;0,4,-5,0,0;4,-5,0,0,4)
=2869 = 19 times 151
$
so since the discriminant is square free $Delta_K = 2869$, it also follows that $1, theta, theta^2, theta^3, theta^4$ is an integral basis.
= Question
== Statement
#let qu = $cal(Q) u a d_Delta$
We will denote by $[a,b,c]$ the quadratic form $a x^2 + b x y + c y^2$. Let
$qu$ denote the $Sl_2 (ZZ)$ equivalence classes of positive definite binary quadratic forms $[a,b,c]$ over $ZZ$ with discriminant $Delta = b^2 - 4 a c$.
A positive definite binary quadratic form $[a,b,c]$ over $ZZ$ is called "reduced" if
$
-a < b <= a < c, or 0 <= b <= a = c.
$
Show that every positive definite binary quadratic form $[a,b,c]$ over $ZZ$ is $Sl_2 (ZZ)$ equivalent to a unique reduced form.
== Solution
Let $[a,b,c]$ be a positive definite quadratic form in $qu$, first let us check the actions of the generators of $Sl_2 (ZZ)$
$
mat(0, 1; -1, 0)^T
mat(a, b/2; b/2, c)
mat(0, 1; -1, 0)
=
mat(-b/2, -c;a, b/2)
mat(0, 1; -1, 0)
=
mat(c, -b/2; -b/2, a)
$
so we can write $a' = c, b' = -b, c' = a$. The next action is
$
mat(1, 1; 0, 1)^T mat(a, b/2; b/2, c) mat(1, 1; 0, 1) = mat(a, b/2; a + b/2, c + b/2) mat(1, 1; 0, 1)
= mat(a, a + b/2; a + b/2, a + b + c)
$
which we can write as $a' = a, b' = b + 2a, c' = a + b + c$. For the inverse we get
$
mat(1, -1; 0, 1)^T mat(a, b/2; b/2, c) mat(1, -1; 0, 1) = mat(a, b/2; -a + b/2, c - b/2) mat(1, -1; 0, 1)
= mat(a, -a + b/2; -a + b/2, c - b + a)
$
which gives us $a' = a, b' = b - 2a, c' = c - b + a$. Now since we define the 'norm' on these quadratic forms by $norm([a,b,c]) = abs(b)$, which we know is positive because this is a positive definite quadratic form. We now check how the generators act on this norm, we get that the first one does not change the norm, just switches $a$ and $c$. If we instead use the second generator or its inverse we get
$
norm([a',b',c']) = abs(b') = abs(b plus.minus 2a)
$
thus we can decrease the norm this way if and only if $abs(a) < abs(b)$, and if $abs(a) = abs(b)$ we can keep the norm the same while making $b$ positive. Then for the representative with minimal norm we must have $-a <= b <= a$ and then by applying the first generator we can force $a <= c$. After that if $a < c$ and $-a = b$ then applying the second generator gives us $b' = -b = a, c' = c + 2a$ which forces $-a < b <= a < c$. If instead $a = c$ then we can use the first generator as necessary to force $0 <= b <= a = c$.
Thus the minimal norm representative is reduced. Now assume that $[a',b',c']$ and $[a,b,c]$ are $Sl_2 (ZZ)$ related and both are reduced. Now notice that for any vector $v = (x,y)$ in $ZZ^2 backslash {(0,0)}$ we have
$
[a,b,c] (x,y) >= a x^2, c y^2, (a - abs(b) + c) min(x^2,y^2)
>= min(a, c, a - abs(b) + c) = a
$
so since $[a,b,c]$ is $Sl_2 (ZZ)$ related to $[a',b',c']$ then for every $v = (x,y)$ in $ZZ^2 backslash {(0,0})$ we have
$
[a',b',c'] (x,y) >= a
$
so in particular $a' >= a$ and $c' >= a$. In identical argument shows that $a >= a'$ so $a = a'$. Now we can also ask a similar question, whats the second smallest non-zero value we can get? For $[a,b,c]$ this is $c$, for $[a',b',c']$ this is $c'$, so an identical argument shows that $c = c'$, this then immediately tells us that $abs(b) = abs(b')$.
Now if $a = c$ then $b$ is related to $-b$ through the first generator. If $a < c$ then if $a = abs(b)$ then we know $b = b' = a$ since they are both reduced. If $abs(b) < a$ then we know that $a$ and $c$ are strictly the two smallest non-zero values you can get from both $[a,b,c]$ and $[a',b',c']$, thus the relator in $Sl_2 (ZZ)$ that maps them to each other must be either $I$ or $-I$ and so $b = b'$. Thus every equivalence class has a unique representative.
= Question
== Statement
Show that the set $qu$ is finite and give an explicit upper bound in terms of $Delta$.
== Solution
As we showed in the previous question, the elements of $qu$ are in bijection with positive definite reduced quadratic forms $[a,b,c]$ with discriminants equal to $Delta$. Now for a positive definite reduced quadratic form we have
$
Delta = b^2 - 4 a c >= a c - 4 a c >= - 3 a c
$
so we have $a c <= - Delta/ 3$. But since $a,c$ are both positive there are finitely many such $a,c$'s that can satisfy this bound, specifically at most $Delta^2$ such pairs. Since each product would uniquely determine a $b$ up to a sign (if such a $b$ exists) then there at most $Delta^2$ positive definite reduced quadratic forms with discriminant $Delta$, and so $abs(qu) <= Delta^2$.
= Question
== Statement
Calculate the class number of $K = QQ(sqrt(Delta))$ when
$
Delta = -3,-7,-15,-20.
$
Whenever $K$ in the above list is not a UFD, give an explicit example of non-unique factorization into irreducible elements.
== Solution
Since elements of $Cl (K)$ are in bijection with elements of $qu$ then we can simply check the number of reduced quadratic forms of discriminant $Delta$.
For $Delta = -3$, the bound from the previous question gives us
$
a dot c <= 1
$
so $a = c = 1$ is the only solution, which forces $b = 1$. Thus $H(QQ(sqrt(-3))) = 1$.
For $Delta = -7$, the bound is
$
a dot c <= 2
$
so $a = c = 1$ and $a = 1, c = 2$ are the only solutions. The first one cannot correspond to a form since $b^2 + 7 = 4$ has no solutions. The second one has $a = b = 1, c = 2$. Again $H(QQ(sqrt(-7))) = 1$.
For $Delta = -15$, the bound is
$
a dot c <= 5
$
but we also need $a dot c >= 4$ to have any hope of a solution, so only
$
a = 1, c = 4 quad a = 1, c = 5 quad a = b = 2
$
are possible solutions. From there we check that $a = b = 1, c = 4$ and $a = c = 2, b = 1$ are the only solutions. This gives us $H(QQ(sqrt(-15))) = 2$.
For $Delta = -20$, the bound is
$
5 <= a dot c <= 6
$
which gives us
$
a = 1, c = 5 quad a = 1, c = 6 quad a = 2, c = 3
$
then we check that $a = 1, b = 0, c = 5$ and $a = b = 2, c = 3$ are the only solutions. This gives us $H(QQ(sqrt(-20))) = 2$.
We now give examples of non-uniqueness, in $QQ(sqrt(-15))$
$
(1 - sqrt(-15)) / 2
(1 + sqrt(-15)) / 2
=
(1 + 15) / 4 = 4 = 2^2
$
Now we know that norm of a general element
$
N_(K quo QQ) (a + b (1 + sqrt(-15)) / 2) = (a + b / 2)^2 + 15 / 4 b^2
$
and so $N_(K quo QQ) ((1 - sqrt(-15))/2) = N_(K quo QQ) ((1+sqrt(-15))/2)= 1/4 +15/4 = 4$ and $N_(K quo QQ) (2) = 4$, but there are no elements with norm $2$ because
$
a^2 + a b + 4 b^2 = 2
$
clearly has no solutions so they are all irreducible.
For $QQ(sqrt(-20)) = QQ(sqrt(-5))$, we have
$
(1 + sqrt(-5))
(1 - sqrt(-5))
=
1 + 5
=
6
=
2 dot 3
$
these have norms $6,6,4,9$ but no elements have norms, $2,3$ so these are all irreducible and so we are done.
|
|
https://github.com/typst/packages | https://raw.githubusercontent.com/typst/packages/main/packages/preview/note-me/0.1.0/example.typ | typst | Apache License 2.0 | // As the package hasn't been published, import it from local.
// Replace `local` to `preview` once the package is published.
#import "@local/note-me:0.1.0": *
#note[
Highlights information that users should take into account, even when skimming.
]
#tip[
Optional information to help a user be more successful.
]
#important[
Crucial information necessary for users to succeed.
]
#warning[
Critical content demanding immediate user attention due to potential risks.
]
#caution[
Negative potential consequences of an action.
]
#admonition(
icon: "icons/stop.svg",
color: color.fuchsia,
title: "Custom Title",
)[
The icon, color and title are customizable.
]
```typ
#note[
Highlights information that users should take into account, even when skimming.
]
#tip[
Optional information to help a user be more successful.
]
#important[
Crucial information necessary for users to succeed.
]
#warning[
Critical content demanding immediate user attention due to potential risks.
]
#caution[
Negative potential consequences of an action.
]
#admonition(
icon: "icons/stop.svg",
color: color.fuchsia,
title: "Custom Title",
)[
The icon, color and title are customizable.
]
``` |
https://github.com/i-am-wololo/cours | https://raw.githubusercontent.com/i-am-wololo/cours/master/main/i21/recherche.typ | typst | = Algos de recherche
== Recheche Dichotomique
Soit une liste triee, l'algorithme consiste a chercher x dans la moitie de la liste:
- si $T[i] < x$, on prend la partie gauche
- si $T[i] > x$, on prend la partie droite
En code, cela consiste a prendre l'indice du milieu, n/2 pour un tableau de longueur n, puis de comparer la taille. Enfin d'avancer l'indice de 1 si le nombre trouve est petit, et l'inverse si il est trop grand.
La dichotomie est aussi utilise pour la recherche de pic:
```Tant que (b - a) > ε
m ← (a + b) / 2
Si (f(a)*f(m) ≤ 0) alors
b ← m
sinon
a ← m
Fin Si
Fin Tant que
``` |
|
https://github.com/MobtgZhang/sues-thesis-typst | https://raw.githubusercontent.com/MobtgZhang/sues-thesis-typst/main/README.md | markdown | MIT License | # 上海工程技术大学硕士学位论文Typst模板
第一次接触Typst源于一次LaTeX社区推荐,突然发现一个非常好的项目,即Typst,这个项目是用Rust写的一个轻量级项目。
相对于LaTeX,Typst较为轻量级、编译速度快,而且语法比较简单,具有用户友好的教程及文档,适合于文档开发的操作。搭配vscode typst lsp的监听修改自动编译的功能,可以即时预览编译出的pdf文件
## Windows/Linux/MacOS/FreeBSD使用方法
参考[Typst项目页面](https://github.com/typst/typst)的安装方式进行安装。
学位论文主体为`paper.typ`,开箱即用,目前还在开发中,不适合用来进行学位论文创作。
## 编译预览
<table>
<tr>
<td><img src="imgs/page1.jpg"></td>
<td><img src="imgs/page2.jpg"></td>
</tr>
</table>
## 参考项目
1. [北京大学博士学位论文Typst模板](https://github.com/lucifer1004/pkuthss-typst)
2. [中山大学本科学位论文Typst模板](https://github.com/howardlau1999/sysu-thesis-typst)
## 开源协议
本项目遵循MIT License协议。
|
Subsets and Splits
No saved queries yet
Save your SQL queries to embed, download, and access them later. Queries will appear here once saved.