repo
stringlengths 27
90
| file
stringlengths 57
176
| language
stringclasses 2
values | license
stringclasses 13
values | content
stringlengths 25
180k
|
---|---|---|---|---|
https://github.com/Mc-Zen/tidy | https://raw.githubusercontent.com/Mc-Zen/tidy/main/examples/sincx-doc.typ | typst | MIT License | #import "/src/tidy.typ"
#set text(font: "Arial")
#set page(width: auto, height: auto, margin: 0em)
#import "/examples/sincx.typ"
#let docs = tidy.parse-module(
read("/examples/sincx.typ"),
scope: (sincx: sincx),
preamble: "#import sincx: *;"
)
#set heading(numbering: none)
#block(
width: 12cm,
fill: luma(255),
inset: 20pt,
tidy.show-module(docs, show-outline: false)
)
|
https://github.com/kamack38/cram-snap | https://raw.githubusercontent.com/kamack38/cram-snap/main/template/main.typ | typst | MIT License | #import "@preview/cram-snap:0.2.0": cram-snap, theader
#set page(
paper: "a4",
flipped: true,
margin: 1cm,
)
#set text(font: "Arial", size: 11pt)
#show: cram-snap.with(
title: [Git Cheatsheet],
icon: image("git-icon.svg"),
)
#table(
theader[Adding changes],
[`git add -u <path>`], [Add all tracked files to the *staging area*.],
[`git add -p <path>`], [Interactively pick which files to *stage*],
)
#table(
theader[Storing changes],
[`git stash [push] [path]`], [Put current changes in the *working tree* into *stash* for later use.],
[`git stash pop`], [Apply stored *stash* content into *working tree*, and clear *stash*.],
[`git stash drop`], [Delete a specific *stash* from all the previous *stashes*.],
)
#table(
theader[Inspecting diffs],
[`git diff [path]`], [Show changes between *working tree* and *staging area*.],
[`git diff --cached/--staged [path]`], [Show any changes between the *staging area* and the *repository*.],
[`git diff > file.patch`], [Generate a patch file for current changes],
)
#table(
theader[Reverting changes],
[`git rebase`], [Rebase the current branch on top of another specified branch.],
[`git rebase -i [commit sha]`], [Start an interactive rebase.],
[`git revert [commit sha]`], [Create a new commit, reverting changes from the specified commit. It generates an *inversion* of changes.],
[`git checkout <path>`], [Discard changes in the *working tree*.],
[`git restore [-W/--worktree] <path>`], [Discard changes in the *working tree*.],
[`git restore -S/--staged <path>`], [Remove a file from a *staging area*.],
[`git restore -SW <path>`], [Discard changes in the *working tree* and to the *staged* files],
[`git reset <path>`], [Remove a file from the *staging area*.],
[`git reset [mode] HEAD^`], [Remove the latest *commit* from the current branch and:
- `--soft` - keep file changes in the
*working tree* and *stage* them;
- `--mixed` - keep file changes;
- `--keep` - reset only files which are
different between current `HEAD` and the
last commit
- `--hard` - do *not* keep file changes.],
)
#table(
theader[Tagging commits],
[`git tag`], [List all tags.],
[`git tag <name> [commit sha]`], [Create a tag reference named `name` for the current or specific commit.],
[`git tag -a <name> -m <message>`], [Create an annotated tag with the given message.],
[`git tag -d <name>`], [Delete the tag with the given name.],
)
#table(
theader[Synchronizing repositories],
[`git fetch [remote]`], [Fetch changes from the *remote*, but not update tracking branches.],
[`git fetch --prune [remote]`], [Delete remote refs that were removed from the *remote* repository.],
[`git pull [remote]`], [Fetch changes from the *remote* and *merge* current branch with its upstream.],
[`git pull -r/--rebase [remote]`], [Fetch changes from the *remote* and *rebase* current branch on top of the upstream],
[`git push -u [remote] [branch]`], [Push local branch to *remote* repository. Set its copy as an upstream.],
)
|
https://github.com/LDemetrios/Typst4k | https://raw.githubusercontent.com/LDemetrios/Typst4k/master/src/test/resources/suite/visualize/ellipse.typ | typst | // Test the `ellipse` function.
--- ellipse ---
// Default ellipse.
#ellipse()
--- ellipse-auto-sizing ---
#set rect(inset: 0pt)
#set ellipse(inset: 0pt)
Rect in ellipse in fixed rect.
#rect(width: 3cm, height: 2cm, fill: rgb("2a631a"),
ellipse(fill: forest, width: 100%, height: 100%,
rect(fill: conifer, width: 100%, height: 100%,
align(center + horizon)[
Stuff inside an ellipse!
]
)
)
)
Auto-sized ellipse.
#ellipse(fill: conifer, stroke: 3pt + forest, inset: 3pt)[
#set text(8pt)
But, soft! what light through yonder window breaks?
]
An inline
#box(ellipse(width: 8pt, height: 6pt, outset: (top: 3pt, rest: 5.5pt)))
ellipse.
|
|
https://github.com/parallel101/cppguidebook | https://raw.githubusercontent.com/parallel101/cppguidebook/main/misc/typst/unicode.typ | typst | Other | #set text(
font: "Noto Serif CJK SC",
size: 7pt,
)
#set page(
paper: "a6",
margin: (x: 1.8cm, y: 1.5cm),
header: align(right, text(5pt)[
Unicode 宇宙
]),
numbering: "1",
)
#set par(justify: true)
#set heading(numbering: "1.")
#show "Unicode": name => box[
#text(fill: rgb("#4d932e"))[*#name*]
]
#show "UTF-32": name => box[
#text(fill: rgb("#4d932e"))[*#name*]
]
#show "UCS-4": name => box[
#text(fill: rgb("#4d932e"))[*#name*]
]
#show "UTF-16": name => box[
#text(fill: rgb("#1182ad"))[*#name*]
]
#show "UCS-2": name => box[
#text(fill: rgb("#1f9e8c"))[*#name*]
]
#show "UTF-8": name => box[
#text(fill: rgb("#bc8f08"))[*#name*]
]
#show "Latin-1": name => box[
#text(fill: rgb("#8a6643"))[*#name*]
]
#show "ISO-8859-1": name => box[
#text(fill: rgb("#8a6643"))[*#name*]
]
#show "ASCII": name => box[
#text(fill: rgb("#be6a6a"))[*#name*]
]
#show "GB2312": name => box[
#text(fill: rgb("#8c4ea4"))[*#name*]
]
#show "GBK": name => box[
#text(fill: rgb("#6645b1"))[*#name*]
]
#show "GB18030": name => box[
#text(fill: rgb("#7065eb"))[*#name*]
]
#show "ANSI": name => box[
#text(fill: rgb("#d06dd1"))[*#name*]
]
#let fun = body => box[
#box(image(
"pic/awesomeface.png",
height: 1em,
))
#text(font: "LXGWWenKai", size: 1em, fill: rgb("#cd9f0f"))[#body]
]
#let tip = body => box[
#box(image(
"pic/bulb.png",
height: 1em,
))
#text(font: "LXGWWenKai", size: 1em, fill: rgb("#4f8b4f"))[#body]
]
#let warn = body => box[
#box(image(
"pic/warning.png",
height: 1em,
))
#text(font: "LXGWWenKai", size: 1em, fill: rgb("#ed6c6c"))[#body]
]
#let story = body => box[
#box(image(
"pic/book.png",
height: 1em,
))
#text(font: "LXGWWenKai", size: 1em, fill: rgb("#807340"))[#body]
]
#let detail = body => box[
#box(image(
"pic/question.png",
height: 1em,
))
#text(font: "LXGWWenKai", size: 1em, fill: rgb("#8080ad"))[#body]
]
#let comment = name => ""
#show table.cell.where(x: 0): strong
#let codetab = (u, v, a, b, n) => table(
columns: int((a.len() + n - 1) / n) + 1,
inset: 3pt,
align: horizon,
..range(0, n).map(i =>
(
[#u], ..a.slice(int((a.len() * i + n - 1) / n), int((a.len() * (i + 1) + n - 1) / n)).map(c => c),
..range(0, if i == n - 1 { 1 } else { 0 } * (int((a.len() + n - 1) / n) - int(a.len() / n))).map(i => []),
[#v], ..b.slice(int((a.len() * i + n - 1) / n), int((a.len() * (i + 1) + n - 1) / n)).map(c => c),
..range(0, if i == n - 1 { 1 } else { 0 } * (int((a.len() + n - 1) / n) - int(a.len() / n))).map(i => []),
)
).join()
)
#align(center, text(14pt)[
*Unicode 字符编码全解*
])
#image("pic/charset.png")
想必你也被琳瑯满目的字符编码弄得晕头转向,动不动爆乱码出来骚扰你,烦死了!
UTF-32、UTF-16、UTF-8、ASCII、UCS-4、UCS-2、Latin-1、ISO-8859-1、ANSI、GBK、GB2312、GB18030、BIG5、EUC-KR、Shift-JIS、EUC-JP、EUC-TW、ISO-2022-JP、HZ-GB-2312、UTF-7……
这里面实际上只需要 UTF-32 和 UTF-8 存在就够了。
其余全是历史遗留垃圾!给*历史失误*擦屁股的。
所有的乱码现象,归根结底,是因为 UTF-32 和 UTF-8 无法普及导致的。这些过时字符编码格式的存在,为的就只是给老软件擦屁股,没有任何不可取代的理由。
其实 UTF-8 也是一个历史失误擦屁股的产物,如果能回到过去,我一开始就会责令他们全用 UTF-32,世界再也没有乱码问题!
很多教程的讲解顺序是:ASCII → Latin-1 → GB2312 → GBK → UCS-2 → UTF-16 → UTF-8 → UTF-32
这确实是他们在*历史上发明的顺序*,但*最佳的学习顺序*恰恰应该是反过来。
正如学 C++ 要从 C++23 学起,学字符编码也要从 UTF-32 学起。见过“光明”,再来“倒序”回过去,学习如何应付历史遗留问题,才是好的学习顺序。
= 计算机如何表示文字
人类发明了文字,文字由一个个字符组成。
可计算机只支持 0 和 1,如何表示人类的文字?
如果每个字都当作“点阵图片”存的话,就浪费太多空间了,而且精度不高。
```
0000001000000
0000001000000
0000001000000
0000010100000
0000010100000
0000100010000
0001000001000
0010000000100
0100000000010
1000000000001
```
== 字符集
更高效的方法是,把地球上所有存在的文字罗列出来,排在一个超大的表里,使每个字符都有一个整数作为序号对应,这个一一对应的关系就是字符集。
//(lambda s: print('#codetab("字符", "编号", ("' + '", "'.join(c for c in s) + '"), (' + ', '.join(f'"{ord(c)}"' for c in s) + '), 2)'))(list(map(chr, range(ord('我'), ord('我') + 10))))
#codetab("字符", "编号", ("我", "戒", "戓", "戔", "戕", "或", "戗", "战", "戙", "戚"), ("25105", "25106", "25107", "25108", "25109", "25110", "25111", "25112", "25113", "25114"), 2)
/ 字符集: 从“字符”到“整数”的一一映射。
而这些产生的整数,就被称为“码点 (code point)”。
/ 码点: 字符集中每个字符对应出来的整数。
Unicode 就是目前最好的字符集,他收录了从英文、中文、数字、标点、拉丁文、希腊字母、日文、韩文、梵文、藏文、甲骨文、埃及象形文字、数学符号、特殊符号、Emoji 等等,所有你能想到的的字符。
其他的字符集基本只收录了特定的语言。例如 GB2312 字符集只为中文常用字、部分数学符号、希腊字母、俄文字母、日文片假名等指定了编号,并没有收录韩文、Emoji、埃及象形文字等。
后来 GBK 加入了更多中文的生僻字,解决部分人名打不出的尴尬问题。在 GB18030 字符集中又收录了更多文字和 Emoji 等。
=== 建议用十六进制
//(lambda s: print('#codetab("字符", "编号", ("' + '", "'.join(c for c in s) + '"), (' + ', '.join(f'"{ord(c)}"' for c in s) + '), 2)'))(list(map(chr, range(ord('我'), ord('我') + 10))))
#codetab("字符", "编号", ("我", "戒", "戓", "戔", "戕", "或", "戗", "战", "戙", "戚"), ("25105", "25106", "25107", "25108", "25109", "25110", "25111", "25112", "25113", "25114"), 2)
由于计算机内部都是二进制,而二进制写起来又太长了,程序员一般喜欢用十六进制数表示数字。这样很多东西都会简化,比如 32 位无符号整数类型 (uint32) 能表示数值上限是 4294967295,一个在十进制看来完全是乱码的数字,用十六进制写就是 0xFFFFFFFF,一目了然。
//(lambda s: print('#codetab("字符", "编号", ("' + '", "'.join(c for c in s) + '"), (' + ', '.join(f'"0x{ord(c):X}"' for c in s) + '), 2)'))(list(map(chr, range(ord('我'), ord('我') + 10))))
#codetab("字符", "编号", ("我", "戒", "戓", "戔", "戕", "或", "戗", "战", "戙", "戚"), ("0x6211", "0x6212", "0x6213", "0x6214", "0x6215", "0x6216", "0x6217", "0x6218", "0x6219", "0x621A"), 2)
“我”这个字,在这个表中,编号为 0x6211。于是当计算机需要表示“我”这个字符时,就用 0x6211 这个整数代替。
如果要表示多个字符,那就用一个整数的数组吧!
例如当计算机要处理“我是小彭老师”这段文字,就可以用:
```
0x6211 0x662F 0x5C0F 0x5F6D 0x8001 0x5E08
```
这一串数字代替。
//(lambda s: print('#codetab("字符", "编号", ("' + '", "'.join(c for c in s) + '"), (' + ', '.join(f'"0x{ord(c):X}"' for c in s) + '), 2)'))("我是小彭老师")
#codetab("字符", "编号", ("我", "是", "小", "彭", "老", "师"), ("0x6211", "0x662F", "0x5C0F", "0x5F6D", "0x8001", "0x5E08"), 1)
=== 乱码的本质
随着互联网的发展,由于各国各自发展出了自己的字符集,导致各种编码混乱,国际上的文件交换难以互通,乃至于有些文字在某些国家是看不到的。这种情况下,Unicode 出现了,他的使命就是统一全世界的字符集,保证全世界所有的文字都能在全世界所有的计算机上显示出来。
例如你在玩一些日本的 galgame 时,会发现里面文字全部乱码。这是因为 Windows 在各个地区发行的是“特供版”:在中国大陆地区,他发行的 Windows 采用 GBK 字符集,在日本地区,他发行的 Windows 采用 Shift-JIS 字符集。日本程序员编译程序时,程序内部存储的是 Shift-JIS 的那些“整数”。这导致日本的 galgame 在中国大陆特供的 Windows 中,把 Shift-JIS 的“整数”用 GBK 的表来解读了,从而乱码(GBK 里的日文区域并没有和 Shift-JIS 重叠)。需要用 Locale Emulator 把 Shit-JIS 翻译成 Unicode 读给 Windows 听。如果日本程序员从一开始就统一用 Unicode 来存储,中国区玩家的 Windows 也统一用 Unicode 解析,就没有这个问题。
#fun[奇妙的是,他们美国大区自己的 Windows 系统却是最通用的 UTF-8,偏偏发往中国的特供版 Windows 给你用 GBK……]
乱码的本质就是不同的字符集中,同一个字符对应的整数不同。例如 GBK 中“我”是 0xCED2,而 Unicode 中 0xCED2 就变成 “컒” 了。保存文件的人使用 GBK,打开文件的人使用 Unicode,就会出现“我”变成“컒”的问题,就是所谓的乱码现象了。
导致乱码的罪魁祸首,不仅仅是因为字符集互不兼容,还有一个东西——字符编码,又进一步助纣为虐,增加更多混乱,我们稍后会讲到。
总之,继续用这些不统一的、各自为政的、残缺不全的字符集,没有任何好处,他们存在只是为了让老程序还能继续运行,新项目应当统一采用 Unicode 字符集。
== 字符编码
仅仅是变成了整数还不够,还需要想办法把这些整数进一步翻译成计算机能识别的“字节”,也就是俗称的序列化。
整数翻译到字节的方案有很多种,方案就称为字符编码。
整数叫码点 (code point),翻译出来的字节叫码位 (code unit)。
#image("pic/charset.png")
/ 字符集: 从字符到整数的一一映射。
/ 码点: 字符集中每个字符对应出来的整数。
/ 字符编码: 把整数进一步映射成一个或多个字节。
/ 码位: 字符编码产生的字节,一个整数可能产生多个字节。
=== 最简单的 UCS-4
Unicode 字符集映射的整数范围是从 0x0 到 0x10FFFF。
这个范围最多只需要 21 二进制位就能存储了。而 C 语言并没有提供 21 位整数类型,他支持的整数类型如下:
#codetab("类型", "最大值", ([`uint8_t`], [`uint16_t`], [`uint32_t`]), ("0xFF", "0xFFFF", "0xFFFFFFFF"), 1)
哪个最适合存储 Unicode 字符呢?似乎只能用 `uint32_t` 了,虽然只利用了 32 位中的最低 21 位,有点浪费。
例如计算机要存储“我是小彭老师!😉”这段文字,首先通过查表:
//(lambda s: print('#codetab("字符", "编号", ("' + '", "'.join(c for c in s) + '"), (' + ', '.join(f'"0x{ord(c):X}"' for c in s) + '), 2)'))("我是小彭老师!😉")
#codetab("字符", "编号", ("我", "是", "小", "彭", "老", "师", "!", "😉"), ("0x6211", "0x662F", "0x5C0F", "0x5F6D", "0x8001", "0x5E08", "0x21", "0x1F609"), 2)
查到每个字对应的整数后,用一个 `uint32_t` 数组存储:
```cpp
vector<uint32_t> str = {0x6211, 0x662F, 0x5C0F, 0x5F6D, 0x8001, 0x5E08, 0x21, 0x1F609};
```
用 32 位整数(即 4 字节)直接表示文本,这就是 UCS-4 编码。
在 UCS-4 中,1 个字符固定对应 4 个字节,非常方便计算机处理。
UCS-4 还有一个别名叫 UTF-32,他们是同一个东西。
=== 阉割的 UCS-2
可实际上 Unicode 中的大多数常用字符都在 0x0 到 0xFFFF 的范围内,超过 0x10000 的基本都是一些 Emoji、特殊符号、生僻字、古代文字,平时很少用到。
#tip[例如 “𰻞𰻞面” 中 “𰻞” 的编号为 0x30EDE,超过了 0xFFFF,但是你平时很少用到。这是 Unicode 委员会有意设计的,他们把越常用的字符越是放在前面。]
例如中文字符的范围是 0x4E00 到 0x9FFF,日文假名的范围是 0x3040 到 0x30FF,韩文字符的范围是 0xAC00 到 0xD7A3,拉丁文字符的范围是 0x0000 到 0x00FF,等等。
#tip[0x4E00 对应的中文字符是“一”,0x9FFF 对应的中文字符是“鿿”,可见 Unicode 委员会对中文区也采用了按笔画多少排序的策略。]
UCS-2:要不然,我们索性放弃支持生僻字符吧!只保留 0x0 到 0xFFFF 范围的常见字符,那 `uint16_t` 就够用了。这样每个字符只占用 2 字节,节省了一半的空间!
用 16 位整数(即 2 字节)表示 0xFFFF 以内字符组成的文本,这就是 UCS-2 字符编码。
因为最大只能表示 16 位整数,超过 0xFFFF 范围的 “𰻞” 字和 “😉” 这种趣味表情符号,就无法显示了。
- UCS-4:“我是小彭老师!我想吃𰻞𰻞面😉”
- UCS-2:“我是小彭老师!我想吃面”
#detail[不过,UTF-16 和 UCS-2 却是不同的,后面讲。]
=== 欧美的 Latin-1
可是,也有一些欧美用户认为,0xFFFF 也太多了!他们平时只需要用英文字母和拉丁字母就够了,几乎用不到中文字符。
好巧不巧,英文和拉丁字母的整数范围是 0x0 到 0xFF。一个 `uint8_t` 就能存储,内存消耗进一步降低到 1 字节。
#image("pic/latin1.svg")
0x0 到 0xFF 内所有的拉丁字母如上图所示。
欧美用户很满意,可是这样就无法支持中文和表情符号了😭
- UCS-4:“我是小彭老师!我想吃𰻞𰻞面😉”
- UCS-2:“我是小彭老师!我想吃面”
- Latin-1:“!”
#fun[欧美用户只需要 `uint8_t` 就行了,而小彭老师要考虑的就多了。]
=== 美国的 ASCII
#fun[¿还有高手?]
美国用户:什么拉不拉丁的,我们只需要英文字母就够了!
好巧不巧,英文字母的整数范围是 0x0 到 0x7F,只需要 7 位。
好处是,无符号 8 位整数 `int8_t` 也能表示了!其中符号位完全不用,剩下 7 位刚刚好。
#image("pic/ascii.png")
如图所示,ASCII 范围中并不是只有英文字母,其中还有数字、标点符号、空格、换行、各种特殊控制字符等。
大部分控制字符都在 0x0 到 0x1F 范围内,只有 DEL 这一个控制字符鹤立鸡群,位于 0x7F。
=== 总结
表示范围上一个比一个小:UCS-4 > UCS-2 > Latin-1 > ASCII
#table(
columns: 3,
[字符编码], [能表示的范围], [类型],
[UCS-4], [0x10FFFF (完整)], [`uint32_t`],
[UCS-2], [0xFFFF (常用字)], [`uint16_t`],
[Latin-1], [0xFF (拉丁)], [`uint8_t`],
[ASCII], [0x7F (不带注音的)], [`int8_t`],
)
这里面除 UCS-4 外,都是不完整的,现代软件理应不再使用他们。
== 变长编码
UCS-2 为了避免浪费,想方设法用 2 字节表示字符,只好放弃超过 0x10000 的生僻字符,只支持了 0x0 到 0xFFFF 范围。
有没有办法既节约到 2 字节空间,又能把全部 0x10FFFF 的字符都容纳下来?UTF-16 应运而生。
想当年 Unicode 委员会确立字符表时,好心把 0xD800 到 0xDFFF 之间这一段区域预留了“空号”。
#image("pic/ucs2range.png")
UTF-16 就是利用了这一段只有 0x800 大小的空号区间,容纳了剩余的 0x100000 个字符。
#fun[怎么可能?]
用一个 0x800 当然装不下,用两个就够了!方案如下:
+ 对于小于 0x10000 的正常字符,和 UCS-2 一样,直接存入 `uint16_t` 数组。
+ 对于 0x10000 到 0x10FFFF 范围的稀有字符:
+ 先把这个整数减去 0x10000,0x10000 会变成 0x0,0x10FFFF 会变成 0xFFFFF。
+ 把这个 0x0 到 0xFFFFF 的 20 位整数按二进制切成两半,每半各 10 位。
+ 把低半段加上 0xD800,高半段加上 0xDC00。
+ 得到两个 0xD800 到 0xDFFF 之间的数,正好 0xD800 到 0xDBFF 范围内的数用来表示前半段,0xDC00 到 0xDFFF 范围内的数用来表示后半段。
+ 把这两个数依次存入 `uint16_t` 数组。
所有的稀有字符,都会被拆成两段:
- 0xD800 到 0xDBFF 范围内的数用来表示一个大数的前半段,称为低代理对 (low-surrogates)。
- 0xDC00 到 0xDFFF 范围内的数用来表示一个大数的后半段,称为高代理对 (high-surrogates)。
例如生僻字“𰻞”的编号为 0x30EDE,减去 0x10000 得到 0x20EDE,变成二进制就是 0b10000011101101110。
把这 20 位二进制拆成两半,低半段是 0b10000,加上 0xD800 得到 0xD840,高半段是 0b0111011010,加上 0xDC00 得到 0xDC6A。
所以生僻字“𰻞”的 UTF-16 编码后,塞入 `uint16_t` 数组是这样:
```cpp
std::vector<uint16_t> biang = {0xD840, 0xDC6A};
```
所以,UTF-16 是一个变长编码格式,一个字符可能需要两个数才能表示。
#fun[这就是为什么说 UTF-16 和 UCS-2 是不同的。UCS-2 是定长编码,不能表示完整的 0x10FFFF 范围,而 UTF-16 可以,代价就是他成了变长编码,需要做额外的特殊压缩处理。]
变长编码有许多严重的问题,
== C 语言的问题
=== C 语言之殇 `char`
这就是为什么 C 语言的 `char` 类型是 8 位有符号整数类型 `int8_t`。
毕竟设计之初,C 语言的 `char` 就只考虑了 ASCII 的字符,没想过支持 UCS-4。
=== `wchar_t` 拯救世界
C 语言为了支持 UCS-4,就引入了 32 位无符号整数类型 `wchar_t`。
`wchar_t` 是一个编译器内置类型,和 `char` 一样是语言的一部分。
而 `int8_t` 只是 `stdint.h` 头文件中 `typedef` 定义的类型别名,不导入那个头文件就不会有。
```cpp
// stdint.h
typedef signed char uint8_t;
typedef signed short uint16_t;
typedef signed int uint32_t;
typedef signed long long uint64_t;
typedef unsigned char uint8_t;
typedef unsigned short uint16_t;
typedef unsigned int uint32_t;
typedef unsigned long long uint64_t;
```
=== 真的有这么简单的事吗?
`wchar_t` 在 Linux 上是 32 位的(理应如此)。
可 `wchar_t` 在 Windows 上却是 16 位的(由于讨厌的历史原因)!
== GB2312
可当时美国程序员偷懒,哪想到后来会加入那么多字符。
他们发明了 ASCII 字符集,给每个英文字母、数字和标点符号赋予了 0x0 到 0x7F 的整数。
于是 C 语言就用 1 字节的 char 来表示 ASCII 字符,范围也只能是 0x0 到 0x7F。
后来计算机引入欧洲其他国家,他们的语言需要使用一些带注音符号的字母,他们发现 ASCII 只占据了 char 的 0x0 到 0x7F 范围,于是把 0x80 到 0xFF 范围的整数,用来映射自己的各种带注音字母。就有了 Latin-1,由于 C 语言的 char 本来就能表示 8 位整数,所以过去写的只支持 ASCII 的程序直接就能用于处理 Latin-1,无缝衔接。
后来计算机更加普及,引入中国时,发现有几千多个汉字需要表示,0x80 到 0xFF 才 128 个空位,根本塞不下。他们想过把 char 改成 16 位的,但是 C 语言标准已定,Windows 是闭源软件又无法修改,为了兼容已经适配 ASCII 的 Windows 和各种 C 语言软件,中国的计算机学家们只好想出一个歪招:
=== UCS-2
最终在 Windows NT 这个版本中,
|
https://github.com/polarkac/MTG-Stories | https://raw.githubusercontent.com/polarkac/MTG-Stories/master/stories/051%20-%20March%20of%20the%20Machine/001_Episode%201%3A%20Triumph%20of%20the%20Fleshless.typ | typst | #import "@local/mtgstory:0.2.0": conf
#show: doc => conf(
"Episode 1: Triumph of the Fleshless",
set_name: "March of the Machine",
story_date: datetime(day: 16, month: 04, year: 2023),
author: "<NAME>",
doc
)
It is good to be Phyrexian.
It is good to be Elesh Norn.
This has always been true, but never more so than now. Three worms—Kaya, Kaito, and Tyvar, the others called them—are before her begging for mercy. Oh, they don't do it out loud, but Norn sees it. Norn understands. Fear haunts their eyes and their too stiff bodies. Weapons tremble in pale-knuckled hands. How misguided they are. If they submit, she could do away with all of their faults, but she knows they'd turn down such a magnanimous offer, such an act of benevolence. There is no point in asking.
Just as there is no point in their efforts.
All will be one. And it won't be very long, now.
"Stay with us," she tells them. "Behold the glory of New Phyrexia."
"Go to hell," says the smallest. The largest moves toward her—but the other pulls him back. Typical. Discord lives within the hearts of the nonbelievers. Even when there are so few, they are never truly united.
If only they could see that.
A mere flick of Norn's wrist is enough to summon the portals—everything in this place is keyed to her will. Metal clicks and slides and rearranges around them. Five irises open on five alternate planes. No matter how their skies started—warm violet, slate gray, or coal black—they now pulse with red light. Phyrexian symbols blaze among the clouds. It is from these portals that she now watches the invasions. Realmbreaker's massive, barb-tipped limbs burst forth, anchoring themselves wherever they please. Rivers of blessed oil run onto the earth. Pods fly from the secured barbs, soaring in all directions—but always in perfect sync. Some birth centurions, some birth golems, and some lie in wait for the lost souls they will soon welcome.
To the three lost creatures before her, a sunrise is beautiful. Phyrexia knows better. Thousands of mouths speaking with one voice; thousands of eyes with a single vision; thousands of minds with only one thought. That is beauty.
And they've created it with their own multitudinous hands.
"Have you ever known such unity?" she asks.
The smallest one opens her maw. Before the words come out, another far more pleasant voice cuts her off. "We've done as you asked."
Lukka—that is his name, isn't it? One of the humans retches at the sight of him, but to Phyrexia, he's a shining example of the future that awaits them. Oh, so he was rough around the edges. They'd smooth those soon enough. Flesh trembles at its own destruction; it's only natural.
Norn turns toward her holy evangels. Jace slips off—he knows what Norn wants, of course, knows before she has to say a thing. Three more arrive in lockstep: Lukka, Atraxa, and Ajani. Nahiri trails behind, the newest member sent to fetch her fellows. Carried like a trussed up offering between them is the once powerful Sheoldred. Out of her armor, she is pathetic and small—an overgrown Newt who once dreamed of praeterdom. All of Phyrexia knew she was only a pretender to the title. Now it's finally laid bare.
Lukka and Ajani present their quarry. Sheoldred spits, her black spittle falling well short of its target. Tied as she is, her natural inclination is to try and wriggle free. How satisfying to see her reduced to this.
"What shall we do with her?" asks Ajani. His eyes flick to the prisoners. "Or do they need dealing with first?"
Norn beholds the little worms, so afraid. Already they're skittering backward. Their plans are as obvious as their terror: leave New Phyrexia, tell the others, gather their meager forces and mount a counterattack. So the efforts of the flesh-bound often go. Where has all that struggle gotten them? Here in the inner sanctum, hopelessly outnumbered, they still think there's a way out of this.
It's amusing—in the way that death is amusing once you've transcended it. "You want to leave, don't you? Phyrexia shall permit it. On one condition," she says. "Nahiri—restraints."
Stone springs from the ground, encasing the three imperfect Planeswalkers. Only their heads remain unimpeded. It won't work forever, Norn is well aware—she saw the smallest one phase through solid matter earlier—but it will serve its purpose. And if they spit on her benevolence, then they've earned their fates.
"You shall be the prophets of our coming," she says. "In time you shall tell your unbelieving brethren what you have seen: a united future."
"What a joke," Sheoldred whispers. Speaking strains her chest against its bonds. "All of this grandstanding won't change the truth: you're only looking out for yourself, Norn. Phyrexia means nothing to you unless it conforms to your mad ravings. You've never cared about unity, you only care about yourself."
"Is that so?" Norn repeats. She slams on the arm of her throne. "Elesh Norn's cares are Phyrexia's cares. The Argent Etchings demand we spread the glory of New Phyrexia, Sheoldred. Long have you tried to rot away our holy teaching from within—but the time for that is since past. Our future is gleaming and perfect, free from your stain. Phyrexia no longer has a place for those who crave power over unity. Ajani—execute her."
#figure(image("001_Episode 1: Triumph of the Fleshless/01.jpg", width: 100%), caption: [Art by: <NAME>], supplement: none, numbering: none)
For once, Sheoldred does more than whisper. Whatever her screaming protest may be, it's lost in the swift descent of the axe. Sheoldred's head bounces to a stop at her feet, smearing black ichor across the porcelain floor. Norn pays it only a moment's attention; her servants will remove the corpse for processing. One mustn't waste perfectly good parts—they will serve Phyrexia as Sheoldred could not. Muscle strains against stone as the largest of the prisoners tries to wriggle free. Given enough time, he will.
Ele<NAME> counts on them escaping. There must be those who spread the gospel, after all, and they cannot do so from here. Once they understand how futile it is to fight the inevitable, they can depart.
But once more to the work, once more to the invasion.
"Rejoice, blessed evangels," she begins. "Our symbol blazes across the planes, our sacred words in its shadow. Soon, we shall awaken the Multiverse from its slumber. The glorious light of compleation—of New Phyrexia!—is nigh. With the barrier of their skin removed and their minds joined to ours, the others will soon come to know the ecstasy of Phyrexia as you do."
Keening howls ring within the sanctum, carried up from the bowels of New Phyrexia. How beautifully they sing that which cannot be put to words!
The evangels try to join their voices to the masses—but they are new, their throats too delicate. A lackluster addition. A choir is only a choir if each voice works in harmony with the others. The dissonance they cause is grating~ and disappointing.
"Quiet upon the congregation!" she screams.
And lo, there is quiet.
"Our work is not yet done. We stand before the untarnished glory of eternal compleation; we need only take our final steps toward it. For your zealous service and devotion, we have decided to grant you the honor of uniting your homelands. Tell us—Nahiri, where is it you were born?"
The kor has too much flesh by far, but they made do with what they could given the time. "Zendikar," she says. "Many lifetimes ago, I was born on Zendikar."
Norn nods. "Nissa," she calls. "Show us this place."
Nissa is the finest gift the Planeswalkers have given Phyrexia. Even standing at Norn's side, she can steer Realmbreaker's attention. To say nothing of her combat capabilities. If things continued at this rate she might overtake Tamiyo as Norn's favorite new servant—but there's yet time to see. And, in truth, all serve Phyrexia in their way.
The portals shift, joining together into a long oval. Disparate images ripple and reform into something new, something whole, something #emph[complete] . Before them: an ancient forest, the trees thick as towers. What little can be seen of the sky is as verdant as the canopies overhead. Elves move among the branches like ants in a hive, each armed, each looking up, each waiting for #emph[something] .
They do not realize how soon it will find them. The branches they stride along bend into Phyrexian shapes; holes within trees and stone herald the shapes their bodies will take. Norn's portal is far from the only one: Phyrexia's thousand eyes stare down upon them as they stare up. Nahiri snarls at Nissa. "The Mother of Machines cares not for these trifles. Show her one of the Skyclaves." Again, the image ripples. This time, the canopy of trees frames a view of a floating city. Hedrons surround it like the feathers of a withdrawn bird. Stark white against the sky, its edges harsh and precise, Norn finds it immediately beautiful. Perhaps the shorter lived could make something useful after all.
"You have plans for this?" Norn asks.
Nahiri nods. "Yes, Grand Praetor. This is a relic of my people—an ancient weapon we once used to dominate the plane. I can wake it once more to enact our will."
A smirk curls Norn's lips. "You wear your new purpose as well as you wear your raiment. Go to this place; our forces will meet you there."
Nahiri needs no further instruction. In three steps, she winks out of existence, the sanctum resounding with a boom. Norn glances to the prisoners once more. Gone already; they must have timed their departure with Nahiri's to conceal the sound. What pitiful creatures, to turn away from such beauty.
"Lukka. How will you bring the glory of Phyrexia to your home?"
Sheoldred's blood still stains his face and carapace. "O Reverend Mother, I will bring it to heel."
"Specifically, Lukka," she says. "That you will bring it to heel is a given."
A grunt leaves him; he shifts his weight side to side. "The monsters," he offers at last. "Once they've joined the fold, the others will cower before us."
She does not like this answer—it implies that the humans don't already cower before them. Neither does she like the simmering anger beneath the surface, anger which lends itself to missteps. Bloodlust is all well and good in a brute, but in a lieutenant? The Planeswalkers would exploit it. Lay a trap for him that he couldn't ignore. Faced with staying to ensure the compleation of the plane or bolting off to settle a personal grievance, Lukka would always choose the personal grievance.
"Very well," she says. "Go to Ikoria. Add these monsters to our ranks. But do understand what the price of failure is, Lukka, and don't forget your true home. You have been anointed with the sacred oil of New Phyrexia—you are no longer a creature of base instinct, you belong to a greater whole."
"And ever may it reign," he says.
His departure is as swift as Nahiri's, and its effects as palpable. Norn allows herself to wonder how much more quickly all this might have come together if Phyrexia had the same ability.
No, it is good Phyrexia had to carve its victory from the spine of an uncaring plane. Anything less would have left them unsuited to the job.
"Grand Praetor," says Tamiyo.
Norn is shaken from her thoughts. "Yes?"
"He will most certainly die on Ikoria," she says. "A bullheaded man often makes hasty decisions—I imagine you intend for it to go that way?"
"If he fails, he goes the way of Sheoldred, and one of you rains judgment upon him," Norn answers. "If he succeeds, the plane is ours, and he will serve penance for any mistakes to our satisfaction. Either way Phyrexia is served."
Tamiyo nods. "As I thought. You are as well reasoned as ever."
"The Grand Cenobite does not make mistakes," says Atraxa. The others are unaccustomed to her voice—they find it harsh and painful, a shard of glass to their delicate eardrums. Even Ajani flinches.
Norn does not. "Indeed. Tamiyo—was it Kamigawa you called home?"
"Once, before I came to understand the truth of things," she says.
"Nissa," Norn commands. The single word is all it takes. Once more the portals ripple and shift. The plane that greets them shines beneath a night sky. Artificial lights illuminate a glittering city. The view swings closer, as if on the end of an arrow, and soon they are within the city itself, tiered structures looming near the shore, reaching for the dark above. The people walking the streets are soft and pliable.
#figure(image("001_Episode 1: Triumph of the Fleshless/02.jpg", width: 100%), caption: [Art by: <NAME>], supplement: none, numbering: none)
It strikes her that no one is panicking. Perhaps they've realized compleation is nothing to fear—but it is more likely they do not know it is coming, in spite of the portals overhead. Here in the moments before the barbs make anchor, these people go about their pointless lives. A man ingesting some sort of food. He speaks to another person situated at a small stand offering more of the same, asking him a question whose answer will soon be irrelevant. A woman walking with two of her offspring. They are begging for an extra helping of the candy in her hand. She tears off pieces for each, leaving herself without—a sacrifice no one will remember in light of what's about to happen.
Tamiyo watches, too. Her grip tightens around an iron-bound scroll. Among the evangels she is the only one not covered in blood.
"Did you love Kamigawa?" Norn asks.
"I did," Tamiyo says. "A land of heroes and scoundrels, betrayers and champions. It seemed there were a thousand possibilities for how life might change in the future. I wanted to see them all. And I wanted to discover, with my family, which one was true. Now I love what it will become."
"Your family," Norn repeats. Ajani crosses his arms—he is listening intently, knowing there will be questions for him, too. "Do you still care for your family?"
Tamiyo watches the woman and her offspring as they walk down the street. Overhead the first slivers of white come into view. The woman continues. She swings the hands of her children, or they swing hers.
Then, as if remembering she was asked a question, she turns. "I want them to understand what I've come to know about the world—about unity. If we are all compleated then we need never be apart again," she says.
"You understand," Norn says. "Our family is greater than any you've ever known. Welcome the old into the new with open arms, Tamiyo."
There is no true silence in the beating metal heart of Phyrexia. Metal slides on metal as its denizens go about their great holy work; pistons animate beings beyond human understanding; blades cut away that which is impure. Here, too, they can still hear the distant sounds of Sheoldred's final contributions: the crack of chitin, the tear of sinew.
Yet the silence that follows Norn's words is there all the same. Tamiyo watches the screen and makes no sign that she's heard Norn's blessed command.
Realmbreaker pierces the earth. Tiered buildings shudder and shed their layers—whole floors tumble away. All around the tiles are falling like jagged porcelain snow. In only an instant the small food stand is crushed. Red spills from beneath, joining the babbling water.
The mother picks up her children, one in the crook of each arm, and runs.
"Tamiyo," Norn repeats. This hesitation sticks between Norn's pointed teeth.
A man in black streaks across their view. In a storm of brilliant cuts, the falling tiles are split, directed away from the family.
They see no more of what happens—Atraxa takes flight, blocking the view with her wings. When she speaks, her voice is sharper than the sword, sharper than the unseen knives at work not far away.
"Insolence isn't tolerated here. You were given a command."
Tamiyo starts; Ajani flinches. She turns, blinking. "I-I'm sorry, I've no idea what came over me—"
"See that whatever it is, you eradicate it," Norn says. "There can be no space for it. Return with Kamigawa under your control or be recycled into something that serves better."
"As you wish," she says. The sense must have gotten back into her—she no longer hesitates in leaving and does not once look up toward the display.
There are only four of them in the room once Tamiyo has gone. Nissa, standing at her side, her eyes clouded with green. Ajani, who watched Tamiyo go, waits for his next set of orders. Atraxa remains airborne. With every flap of her wings her anticipation is palpable.
But patience is a valuable lesson to learn.
"Ajani," she says, and he inclines his head. "What am I going to ask you?"
"To show you the place where I was born," he answers.
"No. Your destiny is greater than that. We believe you know where it lies."
It is not silence that comes between them then but understanding. When he turns toward the mirrors, it is with confidence. "You want to see Theros."
"Quite right."
Black covers the surface of the mirrors, black shines bright, black reflects something new.
A city stares back at them—one unlike the last. Wine-red waves lap at golden shores; white houses dot a verdant countryside. Where Kamigawa was swathed in the night, this place is brilliant under the light of the sun. Ships sail beneath the outstretched swords of two guardian statues. On their decks, fishers wonder why their catches have contorted into strange shapes. On the cliffsides, astronomers debate the meaning of the portal's appearances.
It is as peaceful a view as anyone might imagine, if they do not look closely.
Norn's heart brims with excitement. They are so close to perfection, so close to a deeper understanding. And she knows it will not be long: Theros is among the first wave of targets.
And it seems they're going to get a good view of the festivities.
It starts the same as it did on Kamigawa: great white branches bursting from the portals. No trees can be seen here, but the roots find purchase all the same. Pods deploy before the tree has finished its work, so eager is Phyrexia to lay claim to this place. Some burst midair, giving birth to a swarm of insectoid convertors. The wind carries the storm of blades to the market. Metal glints in the skies above, hunks of white porcelain dropping to the earth, hulks cratering the buildings they land upon. Marble crumbles like sand; black oil streaks across the white. Temples bolt their doors only for the war machines of Phyrexia to batter them down. Winged constructs devour livestock and humans alike, some descending on the ships to find their meals. Nets do little to stop them; spears bounce off their proud carapaces.
Phyrexia is hungry. <NAME> is hungry. Every clamp of their jaws brings the taste of blood to her tongue—an offering from the chorus to her. She is with them, and they are with her, and soon this place will be one.
"It seems our forces are doing well without me," Ajani says.
"At slaughtering the weak and capturing the useful," Norn says. "They will be far more efficient once you are there to lead them."
"You wouldn't be sending me there for such trivial reasons."
He has seen more than he should have, then. Commanders are best when they're clever, but also at their most dangerous. To be clever is to be individual, and within Phyrexia all are one.
<NAME> will have to remind him of this. Possibly with new modifications.
"Theros is important to the future of New Phyrexia."
As if to help deter further questions, the battle on the other side of the portal escalates. Nissa's shifted the view to that of someone standing on the shore. Partially submerged in the water is a temple. Atop that temple is a hand swathed in the shifting black of the night sky, dripping rivers onto its steps. Only when their unseen observer looks up does the full picture become clear: there is #emph[something ] guarding the place. Part woman and part something else. Strangest—and most tantalizing—is the way parts of her fade in and out of existence.
#figure(image("001_Episode 1: Triumph of the Fleshless/03.jpg", width: 100%), caption: [Art by: <NAME>], supplement: none, numbering: none)
A creature of that size could conquer whole planes on her own when compleated. Still, if size was the only thing that interested Phyrexia, Norn would have sent someone more trustworthy to Ikoria.
No—whatever this thing is, it's more than just something huge: it is something Elesh Norn #emph[wants] .
"That," she says, pointing with one porcelain finger. "You are to bring that within Phyrexia's embrace."
Ajani studies the creature. Nodding once, he looks to Norn. There is something like a smile on his muzzle as the plan becomes apparent to him. "Ah—now I understand, it's the gods you're after."
#emph[That's] one of their gods? Norn expected more of deities. Not that there are any in existence who could hope to challenge Phyrexia now that it's taken its proper place. While this creature is majestic in a way, it's far from pure. Already Norn's mind races at the possibilities.
"Bring priests with you," she says. "Bring the Argent Etchings. We will defeat these gods on every possible battleground. For those wise enough to realize the truth of the Multiverse, lend them the power to enlighten their former friends."
"The etchings will make it easy. It's belief that makes gods on Theros, not the other way around," he says. "Once the people understand the truth, the gods will follow." He looks once more over his shoulder. The creature—the god—has driven a bident through one of their attack ships. On the shore what sailors remain throw their arms around one another in celebration. Wide smiles break out across their faces, made strange by the fear that clings to their eyes.
Deep down, they know it will not be enough.
And this brings Norn an untold, ineffable joy.
"Go," she commands.
He does. Ajani, ever loyal, does as he is told. As he winks out of existence, she allows herself a moment of pride in his recruitment and creation.
And pride, too, that he did not discover the real reason she'd sent him to Theros. That's fine enough. Even ignorant of his goal, he'd accomplish it.
Only Atraxa and Nissa remain in the sanctum with her.
"Mother of Machines, highest and holiest of authorities, I live to serve," Atraxa offers.
"You needn't waste your time on such inefficiencies," Norn says. "You're well aware there's a reason your task has come last."
A slight flinch at the reprisal, visible only to the woman who shaped Atraxa's body with her own two hands. The others could lay claim to whatever parts they wished—but Norn knew Atraxa best, and Norn had her heart. Nothing remained of her former life save that which made her perfect. "Whatever New Phyrexia asks of me shall be done."
"Nissa—our missionaries once went aground on a place called Capenna. Show us what's become of it."
It takes longer for the visions before them to change. Frustrating, but not unexpected; this isn't a place Nissa knows well. When at last the view comes into focus, they are staring at a golden gate surrounded by white marble. Inscriptions surround the rim. Norn can't read the language and has no care to. Not that she could even if she'd been familiar with it to start: a shimmering golden haze renders all the fine details fuzzy.
Atraxa says nothing, but she does look up toward Norn. How like a vat-slick, freshly born Newt.
"Our predecessors found this plane by ancient means," she says. "Though it was thick with a holy stench, they saw within it something valuable—something worth the risk its guardians presented. For the better part of a year they lingered, taking whatever they wished, conducting vital research on the populace, spreading blessed corruption wherever they tread."
"Until something sealed them away," Atraxa offers. Good; she's beginning to understand why she was chosen for this.
"Indeed. Angels. False prophets bound to stone for their insolence," Norn says. These words must have weight for Atraxa. She lets them ring before continuing. "Fearing the truth we would bring to their people—a unity the likes of which they could never promise—they grew desperate. They gave up their physical forms to suppress our ship's influence. For years we have been here, and for years we've not accomplished a thing. That ends now."
"It will be done," says Atraxa. "I will free the ship—"
"The ship itself is of no concern to us. Had they been faithful they would have triumphed. If you do uncover it or its crew, you are to scavenge them for parts. Compleation is a gift they no longer deserve."
"As you wish," Atraxa says.
"Nissa—show us the atrocity they've constructed."
The view shifts to another nighttime sky, and to the city glittering beneath it. No—Norn refuses to think of it as a city. The towering needle reaching for the stars is an affront in every way. Even without a haze of gold it would reek of decadence. Everywhere the eye falls there is something to appall it: golden shells mounted to vertical shuttles, a sickening worship of fur evident in their coats and dress, the foul noise they called music played by the unworthy tubes of flesh. Its height is hubris, and hubris is its height. All of this constructed on Phyrexian bodies. All of this to keep them away.
"Burn this into your memory. Never forget what they've done to us, what they've constructed here. The faithless consider themselves divine, Atraxa, but divinity exists only in unity."
"All must be as one," Atraxa echoes. From her grip on her weapon, she has little love for the view. "What is it you wish me to do?"
"Teach these people the price of their insolence. They could have joined our ranks, once, but they will no longer find any such mercy from us. You will harvest them all."
"It will be done," Atraxa says. With a flap of her wings, she approaches the bridge to the tree—but Norn raises a hand to stop her.
"There is one other task for you," she says.
Atraxa waits in midair.
Norn points. "The angels that lent this place their protection still guard it today—albeit in a new way. The haze we see here is what remains of their ethereal forms. The faithless call it Halo, and it will be anathema to you. Until you bring the tower down and wake the angels from their rest you will be unable to escape its influence. Your most sacred duty on this plane is to find its wellspring and destroy it."
Atraxa's chin dips lower. She looks to the mirrors, then to Norn. "Mother of Machines, it is not my place to question you~"
"Indeed, it isn't," Norn says. "But your question will be permitted. Speak it."
Whatever the question may be, Norn will answer. Atraxa is already bound to the will of New Phyrexia—ultimately, it makes no matter what Norn's answer is, so long as there is one.
"If the ship has been lost for untold years and the atmosphere is poisonous, why not leave this place to the centurions? Why am I being given the task?"
"The reasons are threefold. First: it is a glorious task, and completing it announces your worth to all. Second: your previous life may lend you some protection to this 'Halo.'"
There are no true silences within the sanctum—but there is something like it as Atraxa waits for the third item, and Norn thinks of how to phrase it.
"Third: there exists a danger to New Phyrexia. In killing New Capenna, we strike at her heart."
Atraxa's wings flap once. "This danger—is that why you sent Ajani to Theros, as well?"
"Astute of you," Norn says. "Yes. This danger cannot be permitted to triumph. You and Ajani will seal our victory."
"Then all is for the glory of the faithful," Atraxa says.
She leaves, then. Only Nissa remains—yet she is cold company. Norn's lieutenant is too preoccupied with managing the tree's growth to speak with her.
The air is not quite silent in the sanctum.
Norn hates it.
With a gesture, she calls for her attendants. They arrive to recite her own thoughts and teachings to her. In their screeching voices, <NAME> forgets her nightmares—and the woman who stalks them, cloaked in white.
|
|
https://github.com/Myriad-Dreamin/typst.ts | https://raw.githubusercontent.com/Myriad-Dreamin/typst.ts/main/packages/typst.node/npm/win32-x64-msvc/README.md | markdown | Apache License 2.0 | # `@myriaddreamin/typst-ts-node-compiler-win32-x64-msvc`
This is the **x86_64-pc-windows-msvc** binary for `@myriaddreamin/typst-ts-node-compiler`
|
https://github.com/augustebaum/petri | https://raw.githubusercontent.com/augustebaum/petri/main/src/fletcher-shapes.typ | typst | MIT License | #import "@preview/cetz:0.2.2" as cetz: draw
#import "@preview/fletcher:0.4.2" as fletcher: node, edge, shapes
#let _label(label, anchor: "north", padding: 0.5em, name: "node", ..args) = {
let opposite-anchor = (
"north-west": "south-east",
"north": "south",
"north-east": "south-west",
"west": "east",
"center": "center",
"east": "west",
"south-west": "north-east",
"south": "north",
"south-east": "north-west",
).at(anchor)
draw.content((name: name, anchor: anchor), label, anchor: opposite-anchor, padding: padding, ..args)
}
#let p(pos, label, tokens: 0, label-args: (), ..args) = {
node(
pos,
[],
shape: (node, extrude) => {
draw.circle((0,0), radius: 1em, name: "node")
_label(label, ..label-args)
let token(pos, name: "") = draw.circle(pos, radius: 0.2em, fill: black, stroke: black, name: name)
// so that the tokens are equally spaced
let radius(n_tokens) = (0.12 / calc.sin(180deg / n_tokens))
let ngon(n, start-angle: 90deg) = {
for k in range(n) {
token((start-angle + 360deg * k / n, radius(n)))
}
}
if tokens == 0 {
} else if tokens == 1 {
token((0,0))
} else if tokens == 2 {
ngon(tokens, start-angle: 0deg)
} else if tokens in range(3, 7) {
ngon(tokens)
} else if tokens == 7 {
ngon(6)
token((0,0))
} else {
token((0,0), name: "token")
draw.content("token.south", text(size:0.7em)[#tokens], anchor: "north", padding: 0.05em)
}
},
..args
)
}
#let t(pos, label, width: 0.4em, height: 2.5em, label-args: (), ..args) = {
node(
pos,
[],
shape: (node, extrude) => {
draw.rect(
(- (width / 2), - (height / 2)),
( (width / 2), (height / 2)),
fill: green.lighten(60%),
..args,
name: "node"
)
_label(label, ..label-args)
// draw.content((name: "node", anchor: 180deg), label, anchor: "east", padding: .4em)
// draw.content("node.north", label, anchor: "south", padding: .5em)
}
)
}
|
https://github.com/7sDream/fonts-and-layout-zhCN | https://raw.githubusercontent.com/7sDream/fonts-and-layout-zhCN/master/chapters/02-concepts/shaping-layout.typ | typst | Other | #import "/template/template.typ": web-page-template
#import "/template/components.typ": note
#import "/lib/glossary.typ": tr
#show: web-page-template
== #tr[shaping]和#tr[layout]
// I've called this book "Fonts and Layout for Global Scripts", because I wanted it to be about the whole journey of getting text through a computer and out onto a display or a piece of paper. Having the fonts designed and engineered correctly is the first step in this; but there's a lot more that needs to be done to use those fonts.
我把本书起名叫《#tr[global scripts]的字体与#tr[layout]》,因为我想让它涵盖计算机从获取文本到输出到显示器或纸上的整个过程。正确的字体设计和字体工程只是第一步,想运用好这些字体还需要很多其他的工作。
// There are a number of stages that the letters and numbers you want to typeset go through in order to become the finished product. To begin with, the user (or in some cases, the computer) will choose what font the text should be typeset in; the text, and the choice of font and other typographic details, are the inputs to the process. These two inputs pass through some or all of the following stages before the text is set:
从输入字母和数字到获得最终的#tr[typeset]结果之间有好几个步骤。首先,用户(或计算机)会选择文本应该用什么字体;然后文本、字体以及其他#tr[typography]细节将作为整个过程的输入。在文本被#tr[typeset]出来前,这些输入信息会经历@figure:pipeline 所示的部分或所有阶段。
#figure(caption: [
计算机中文本处理的流程简图
], include "pipeline.typ") <figure:pipeline>
// We can understand most of these steps by taking the analogy of letterpress printing. A compositor will be given the text to be set and instructions about how it is to look. The first thing they'll do is find the big wooden cases of type containing the requested fonts. This is *font management*: the computer needs to find the file which corresponds to the font we want to use. It needs to go from, for example, "Arial Black" to `C:\\Windows\\Fonts\\AriBlk.TTF`, and so it needs to consult a database of font names, families, and filenames. On libre systems, the most common font management software is called [fontconfig](https://www.fontconfig.org); on a Mac, it's [NSFontManager](https://developer.apple.com/documentation/appkit/nsfontmanager?language=objc).
要理解其中的大多数步骤,可以将其类比于凸版印刷。排版工会拿到一些文本,以及关于如何呈现它们的指令。他首先要找到装有相应字体的木箱,这就是*字体管理*:计算机需要找到与我们使用的字体相对应的文件。例如,它会从“Arial Black”找到`C:\Windows\Fonts\AriBlk.TTF`。而这就需要一个有关字体名称、#tr[typeface family]信息和文件名的数据库。在自由操作系统上最常用的字体管理软件是fontconfig<EMAIL>config,在 Mac 上则是NSFontManager@<EMAIL>.NSFontManager。
// They'll also have to make sure they can read the editor's handwriting, checking they have the correct understanding of the input text. In the computer world, correctly handling some scripts may require processes of reordering and re-coding required so that the input is correctly interpreted. This is called Unicode processing, and as we will see in the next chapter, is often done using the [ICU](http://site.icu-project.org) library.
排版工还要有能力阅读编辑给的手写文本,并确认自己对这些文本的理解是否正确。在计算机世界中,可能需要经过重排序和重编码等过程才能正确解读输入的文本,尤其是对含有非拉丁#tr[script]的场景。这一过程称为Unicode处理,通常使用ICU程序库#[@UnicodeConsortium.ICU]完成,我们将在下一章中介绍这一步骤。
// > Yes, that example was a bit of a stretch. I know.
#note[好吧,我知道这个例子有点牵强。]
// Next, the hand compositor will pick the correct metal sorts for the text that they want to typeset.
接下来,排版工要挑选正确的金属#tr[sort]来#tr[typeset]文本。
#figure(
caption: [装有金属#tr[sort]的#tr[compositing stick]],
)[#image("512px-Handsatz.jpg", width: 80%)]
// They will need to be aware of selecting variants such as small capitals and swash characters. In doing this, they will also *interpret* the text that they are given; they will not simply pick up each letter one at a time, but will consider the desired typographic output. This might mean choosing ligatures (such as a single conjoined "fi" sort in a word with the two letters "f" and "i") and other variant forms when required. At the end of this process, the input text - perhaps a handwritten or typewritten note which represents "what we want to typeset" - will be given concrete instantiation in the actual pieces of metal for printing. When a computer does this selection, we call it *shaping*. On libre systems, this is usually done by [HarfBuzz](https://www.harfbuzz.org/); the Windows equivalent is called [DirectWrite](https://docs.microsoft.com/en-us/windows/win32/directwrite/direct-write-portal) (although this also manages some of the later stages in the process as well).
他们还会选取各种变体,例如小型大写字母和花笔#tr[character],这其实是对文本的一种*演绎*。他们不只是简单地逐个选取字母,而是会考虑所需的#tr[typography]效果。比如他们会根据需要选择连字(例如用一个fi的#tr[sort]代替单词中的字母f和i)等变体形式。这一步骤完成后,输入的文本——代表了“我们想要排版的东西”的手写或打字稿——就被转化为了用以交付印刷的金属块。当在计算机中做这些工作时,我们将其称为*文本#tr[shaping]*。在自由操作系统上,这通常交由HarfBuzz#[@Unknown.HarfBuzz]完成;在Windows上则可以采用DirectWrite API@Microsoft.DirectWriteAPI(虽然它也参与了若干后续过程)。
// At the same time that this shaping process is going on, the compositor is also performing *layout*. They take the metal sorts and arrange them on the compositing stick, being aware of limitations such as line length, and performing whatever spacing adjustments required to make the text look natural on the line: for some languages, this will involve hyphenation, the insertion of spaces of different widths, or even going back and choosing other variant metal sorts to make a nicer word image. For languages such as Thai, Japanese or Myanmar which are written without word breaks, they will need to be aware of the semantic content of the text and the typographic conventions of the script to decide the appropriate places to end a line and start a new one.
在#tr[shaping]的同时,排版工还需要进行*#tr[layout]*。他们会把金属#tr[sort]排列在#tr[compositing stick]上,同时考虑行高等限制。他们还会进行必要的间距调整,以使得文本看起来更加自然。对于一些语言,这需要引入连字符、插入不同宽度的空格,或者回过头重新选择看起来更舒服的其他变体。而对于泰文、日文和缅甸文等不需要断词的文本,则可能需要考虑其语义和排版习惯,以此来确定换行的合适位置。
// In a computer, this layout process is normally done within whatever application is handling the text - your word processor, desktop publishing software, or design tool - although there are some libraries which allow the job to be shared.
在计算机中,#tr[layout]的过程通常由操作文本的软件完成——比如文字处理软件、桌面出版软件、设计工具等——也有一些专门负责处理这一工作的公共库。
// Finally, the page of type is "locked up", inked, and printed. In a computer, this is called *rendering*, and involves *rasterizing* the font - turning the outlines into black and white (and sometimes other colored!) dots, taking instructions from the font about how to make the correct selection of dots for the font size requested. Once the type has been rasterized, it's generally up to the application to place it at the appropriate position on the screen or represent it at the appropriate point in the output file.
最后,这些排好的页面会被“固定”、上墨以及印刷。在计算机中。这一步称为*#tr[rendering]*,即对字体进行*#tr[rasterization]*。字体的#tr[outline]会被转化为黑白(有时候也会是彩色的!)的小点,而在特定字号下如何正确排布这些点则会根据字体中的指令来确定。一旦#tr[rasterization]完成,通常就会由应用程序将其放置在屏幕或输出文件的正确位置上。
// So using a font - particularly an OpenType font - is actually a complex dance between three actors: the top level providing *layout* services (language and script handling, line breaking, justification), the *shaping* engine (choosing the right glyphs for the input), and the font itself (which gives information to the shaping engine about its capabilities). <NAME> calls this the "OpenType collaborative model", and you can read more about it in his [Unicode Conference presentation](http://www.tiro.com/John/Hudson_IUC39_Beyond_Shaping.pdf).
因此,使用字体——尤其是OpenType字体——实际上是有三位演员参与的复杂舞蹈:顶层的*#tr[layout]*服务(语言和#tr[script]处理、断行、对齐等),*#tr[shaping]*引擎(为输入文本选择合适的#tr[glyph])以及字体本身(它会告知#tr[shaping]引擎自己带有的功能)。<NAME>称之为“OpenType 合作模型”<concept:opentype-collaborative-model>,关于这个模型的更多内容,可以参考他在Unicode会议上的报告@Hudson.ShapingGeneral.2015。
|
https://github.com/jgm/typst-hs | https://raw.githubusercontent.com/jgm/typst-hs/main/test/typ/compiler/show-bare-02.typ | typst | Other | // Test style precedence.
#set text(fill: eastern, size: 1.5em)
#show: text.with(fill: red)
Forest
|
https://github.com/japanoise/strategos-m | https://raw.githubusercontent.com/japanoise/strategos-m/main/README.md | markdown | Creative Commons Attribution Share Alike 4.0 International | # Strategos M
A medieval wargame inspired by <NAME>'s "Valley Forge" and "Strategos N",
and the [Twin Cities group's use of <NAME>'s
Strategos][twincities] in the pre-historic days of the fantasy roleplaying
hobby.
[twincities]: https://playingattheworld.blogspot.com/2013/01/strategos-in-twin-cities.html
## Downloads
Pre-built PDFs are available [in the releases section of this repository][tags].
[tags]: https://github.com/japanoise/strategos-m/releases
## Building a PDF
- Software: You will need [the typst compiler](https://github.com/typst/typst)
and a POSIX-compatible /bin/sh installed
- Font: Fonts are provided in `fonts/` directory.
These pre-requisites taken care of, `./build.sh` will build the PDF. If you
want to work on the PDF with live updates, `./build.sh watch` will instruct
typst to compile the file incrementally.
## License
See LICENSE; LICENSE-FONTS; and COPYING.
Strategos M © 2024 by japanoise is licensed under [CC BY-SA 4.0][ccbysa]
The code in `build.sh` is Copyright © 2024 japanoise licensed under the GNU GPL
Version 3; or, at your option, any later version.
### Fonts
- Balkara - Copyright (c) 2016, <NAME> & <NAME> (<<EMAIL>|<EMAIL>>).
- Combat Font - By <NAME>, 2015.
- Copyright 2024 The Cooper* Project Authors (https://github.com/indestructibletype/Cooper)
- Hyde Copyright 2008 by <NAME>
- Old Cupboard - Copyright 2019 <NAME> (https://www.coneofnegativeenergy.com)
- TT2020 Font - Copyright (c) 2020 <NAME> (<<EMAIL>>)
[ccbysa]: https://creativecommons.org/licenses/by-sa/4.0/?ref=chooser-v1
|
https://github.com/jgm/typst-hs | https://raw.githubusercontent.com/jgm/typst-hs/main/test/typ/text/linebreak-08.typ | typst | Other | // Test comments at the end of a line
First part//
Second part
// Test comments at the end of a line with pre-spacing
First part //
Second part
|
https://github.com/jgm/typst-hs | https://raw.githubusercontent.com/jgm/typst-hs/main/test/typ/layout/page-style-00.typ | typst | Other | // Empty with styles
// Should result in one green-colored A11 page.
#set page("a11", flipped: true, fill: green)
|
https://github.com/TypstApp-team/typst | https://raw.githubusercontent.com/TypstApp-team/typst/master/tests/typ/compiler/packages.typ | typst | Apache License 2.0 | // Test package imports
// Ref: false
---
// Test import without items.
#import "@test/adder:0.1.0"
#test(adder.add(2, 8), 10)
---
// Test import with items.
#import "@test/adder:0.1.0": add
#test(add(2, 8), 10)
---
// Test too high required compiler version.
// Error: 9-29 package requires typst 1.0.0 or newer (current version is VERSION)
#import "@test/future:0.1.0": future
---
// Error: 9-13 `@` is not a valid package namespace
#import "@@": *
---
// Error: 9-16 package specification is missing name
#import "@heya": *
---
// Error: 9-15 `123` is not a valid package namespace
#import "@123": *
---
// Error: 9-17 package specification is missing name
#import "@test/": *
---
// Error: 9-22 package specification is missing version
#import "@test/mypkg": *
---
// Error: 9-20 `$$$` is not a valid package name
#import "@test/$$$": *
---
// Error: 9-23 package specification is missing version
#import "@test/mypkg:": *
---
// Error: 9-24 version number is missing minor version
#import "@test/mypkg:0": *
---
// Error: 9-29 `latest` is not a valid major version
#import "@test/mypkg:latest": *
---
// Error: 9-29 `-3` is not a valid major version
#import "@test/mypkg:-3.0.0": *
---
// Error: 9-26 version number is missing patch version
#import "@test/mypkg:0.3": *
---
// Error: 9-27 version number is missing patch version
#import "@test/mypkg:0.3.": *
---
// Error: 9-28 file not found (searched at typ/compiler/#test/mypkg:1.0.0)
#import "#test/mypkg:1.0.0": *
|
https://github.com/yhtq/Notes | https://raw.githubusercontent.com/yhtq/Notes/main/抽象代数/作业/hw12.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: "作业12",
author: "YHTQ ",
date: none,
logo: none,
withOutlined: false
)
= 12.14
== P125
===
设 $f(x) = x^(p^e) - alpha$ 的分裂域为 $K$,在 $K$ 上显然有:
$
f(x) = (x - beta)^(p^e)
$
设 $beta$ 在 $F$ 上最小多项式为 $h(x)$,显有 $h(x) = (x- beta)^n$,且 $h(x)$ 不可约,这将意味着 $f(x) in (h(x))$ ,从分解式看出 $h(x) = (x-beta)^(p^i)$\
然而,这将意味着 $beta^(p^i) in F$, $alpha = beta^(p^e) = (beta^(p^(e-1)))^p = ((beta^(p^(i)))^(p^(e-1-i)))^p in F^p$,矛盾!
===
+
假设 $f(x)$ 可分,将有 $f(x) = g(x^p) => p | deg(f(x))$,矛盾
+
任取 $alpha in K$,它的最小多项式的次数是扩张次数的因子,因此也与 $p$ 互素。由 1 知 $alpha$ 可分,进而这是可分扩张
===
- 假设 $quotient(K, F)$ 可分,则:
- $forall alpha in K$ 在 $E$ 上的最小多项式是在 $F$ 上最小多项式的因子,当然也无重根,因此 $quotient(K, E)$ 可分
- $forall beta in E$ 在 $F$ 上的最小多项式也是将其看作 $K$ 中元素时在 $F$ 上的最小多项式,当然无重根,进而 $quotient(E, F)$ 可分
- 假设 $quotient(K, E), quotient(E, F)$ 均可分\
任取 $alpha in K$
- 若 $alpha in E$,显然 $alpha$ 在 $F$ 可分
- 反之,取 $alpha$ 在 $E$ 上最小多项式 $h(x)$,不妨设 $K = E(alpha)$, $E$ 恰好是 $F$ 扩充所有 $h(x)$ 的系数,进而扩张都是有限扩张,而有限扩张的情形由书上命题的断言是显然的。
===
+ $sqrt(2) + sqrt(3)$ 就是一个本原元,只需注意到这个扩张次数只能为2或4,但 $sqrt(6)$ 也在扩张之中,因此只能是 4\
+ 类似上面可以证明 $sqrt(3) + i $ 就是一个本原元。
===
+
$K$ 中元素均形如 $h = f(x, y)/g(x, y)$, 从而:
$
h^p = (f^p (x, y))/(g^p (x, y)) = (f(x^p, y^p))/(g(x^p, y^p))
$
因此结论成立
+
容易看出 $quotient(K, F)$ 中所有元素的最小多项式不超过 $p$ 次($forall x in K, x^p in F$),但扩张次数为 $p^2$,因此不能成为单扩张
+
任取 $k in F$,$F(x+u y)$ 即是满足要求的中间域
== 补充题
===
显然有:
$
f(x)^p = (sum_i a_i x^i)^p = sum_i a_i^p x^(p i) = sum_i a_i x^(p i) = f(x^p)
$
进而:
$
sum_(i=0)^n vec(n, i) x^(p i) = (1 +x^p)^n = ((1 + x)^p)^n = (1 + x)^(n p) = sum_(i=0)^(n p) vec(n p, i) x^i
$
比照系数可得 $vec(p n, p r) = vec(n, r)$
===
- 注意到有限域恰为 $x^(p^r) - x$ 的分裂域,且所有元素都是它的根。从而多项式:
$
x^(p^r) -x +1
$
将在这个域上没有根,进而不分裂。因此代数封闭域一定无限
- 另一方面,设 $F$ 是特征 $p$ 的代数封闭域域。对任意 $alpha in F$ ,显然 $x^p - alpha$ 在 $F$ 上至少有一个根 $beta$,进而:
$
F^p = F
$
故它是完全域
===
容易看出它在 $QQ(sqrt(2))$ 上可做不可约分解:
$
x^4 + 1 = (x^2 + sqrt(2) x + 1) (x^2 - sqrt(2) x + 1)
$
(后两者不可约是因为它们在 $RR$ 上没有根)
而这两者都不在 $QQ$ 上,因此在 $QQ$ 上不可约。\
若 $k=2$ 结论是显然的。\
否则:
- 若 $p = 1 mod 4$ 由于 $ZZ_p^times$ 是乘法群,因此存在 $a$ 使得:
$
a^(p-1) = 1, a^((p-1)/2) = -1
$
从而:
$
x^4 + 1 = (x^2 + a^((p-1)/2))(x^2 - a^((p-1)/2))
$
进而原多项式可约
- 若 $p = 3 mod 4$,将有:
$
(2^((p+1)/4))^2 = 2^((p+1)/2) = 2^((p-1)/2) dot 2 = plus.minus 2
$
从而 $sqrt(plus.minus 2)$ 至少有一个在 $ZZ_p$ 上,因此分解:
$
x^4 + 1 = (x^2 + sqrt(2)x + 1)(x^2 - sqrt(2)x + 1)\
x^4 + 1 = (x^2 + sqrt(-2)x - 1)(x^2 - sqrt(-2)x - 1)
$
至少有一个在 $ZZ_p$ 上,进而原多项式可约
===
由于 $quotient(F(alpha), F)$ 是有限代数扩张,有有限的次数。令 $K ' = F(a_0, a_1, ..., a_n)$ ,显然 $K' subset K$\
事实上,$g(x)$ 在 $K$ 上不可约表明 $g(x)$ 在 $K'$ 上当然也不可约,进而成为 $alpha$ 在 $K'$ 上的不可约零化多项式,也即一个最小多项式,因此有:
$
[K': F] = deg(g(x)) = [K : F]
$
这就表明 $K' = K$
===
- 假设 $quotient(F(S), F)$ 是可分扩张,显然 $S$ 中所有元素均可分
- 假设 $S$ 中所有元素均可分。任取 $alpha in F(S)$,显然可以选取 $S$ 中有限多个元素 $x_1, x_2, ..., x_n$ 使得:
$
alpha in F(x_1, x_2, ..., x_n)
$
利用有限扩张版本的熟知定理即可得 $alpha$ 可分。
= 12.18
== P129
===
之前已经证明了 $[K : QQ] = 2^n = |Gal(quotient(K, QQ))|$\
归纳证明 $Gal(quotient(K, QQ)) = (Z_2)^n$\
事实上,假设结论对 $n-1$ 成立,则考虑:
$
K_n = K_(n-1)(sqrt(p_n))
$
$K_n$ 恰好是 $K_(n-1)$ 上不可约多项式 $f(x) = x^2 - p_n$ 的分裂域,如此任取 $sigma in Gal(quotient(K_(n-1), QQ))$,注意到 $sigma(f(x)) = f(x)$,因此将存在延拓 $sigma', sigma''$ 满足:
$
sigma', sigma'' |_(K_(n-1)) = sigma\
sigma' (sqrt(p_n)) = sqrt(p_n), sigma' (sqrt(p_n)) = -sqrt(p_n)
$
显然不同 $sigma$ 取值延拓出的 $sigma', sigma''$ 互不相同,这就得到 $2^n$ 个 $QQ-$自同构,恰好是 $Gal(quotient(K_(n), QQ))$ 中所有元素。\
其次,不难发现这些延拓由 $K_(n-1)$ 的限制和 $sqrt(p_n)$ 的像唯一确定,不难验证 $Gal(quotient(K_(n), QQ)) tilde.eq Gal(quotient(K_(n-1), QQ)) times ZZ_2$,进而结论成立
===
容易发现两题中整数根只能为 $plus.minus 1$,但都不是根,因此两多项式都不可约
+
判别式 $D = -4 dot (-3)^3 - 27 = 27 dot 3 = 81 in QQ^2$,因此 $Gal(quotient(K, QQ))$ 中元素作用于 ${alpha_1, alpha_2, alpha_3}$ 均为偶置换,进而 $Gal(quotient(K, QQ)) = A_3 = ZZ_3$,它没有非平凡子群
+
判别式 $D = -4 dot (-1)^3 - 27 = -23 in.not QQ^2$,表明 $Gal(quotient(K, QQ)) != A_3$,进而恰为 $S_3$,非平凡子群包括三个非正规的 2 阶子群和正规的 3 阶子群 $A_3$。\
设三根分别为 $alpha_1, alpha_2, alpha_3$,对换 $(alpha_1, alpha_2)$ 对应不动域为:
$
QQ(alpha_3)
$
$A_3$ 对应不动域为:
$
QQ(sqrt(D)) = QQ(sqrt(-23))
$
===
注意到四个根恰为 $root(4, 2), root(4, 2)i, -root(4, 2)i, -root(4, 2)$\
因此 $x^4 - 2$ 在 $QQ(i)$ 上没有根。\
假设 $f(x)$ 有因子 $(x - z_1)(x-z_2)$,则 $(z_1 z_2)^2 = plus.minus sqrt(2) in QQ(i)$,这是荒谬的,因此 $f(x)$ 就是不可约多项式\
因此分裂域恰为 $QQ(i, root(4, 2))$,扩张次数为 $4$\
故 $|Gal(quotient(K, F))| = 4$,而其中的元素由 $root(4, 2)$ 的像唯一确定,容易验证:
$
root(4, 2) -> root(4, 2)i
$
的阶为 $4$,因此这就是 $ZZ_4$
===
取 $theta = e^((2 pi i)/(p^n))$,容易发现 $x^(p^n) - 1$ 的所有根都形如 $theta^i, i = 0,1,2,..,.,p^(n-1)$\
因此分裂域恰为 $QQ(theta)$\
同时,$QQ(theta)$ 上所有 $Q-$自同构当然由 $theta$ 的像唯一确定,而任取自同构 $sigma$,$sigma(theta)$ 当然包含在 $theta^i$ 之中,且应该生成所有的 $theta^i$ 。这意味着 $sigma$ 与 $ZZ_(p^n)$ 的一个自同构一一对应,显然恰有 $p^n - p^(n-1)$ 个,这同时成为伽罗华群的阶数和扩张次数。\
进一步,容易验证 $Gal(quotient(K, QQ)) = Z_(p^n)^times$,它是循环群
===
由柯西方程,只需验证 $RR$ 上满足:
$
f(x) + f(y) = f(x + y)\
f(x y) = f(x) f(y)\
$
的函数 $f(x)$ 一定单调,从而只能为恒同函数。\
事实上,由:
$
f((sqrt(x))^2) = (f(sqrt(x)))^2 >=0
$
知 $forall x >= 0. f(x) >= 0$,进而函数单调上升,原命题成立。
== 补充题
===
显然后者当且仅当 $quotient(E, F)$ 即是可分扩张也是正规扩张,进而是伽罗华扩张
===
$QQ -> QQ(sqrt(2)) -> QQ(root(4, 2))$,两个二次扩张均正规,但合成不是正规扩张
===
伽罗华群的子群当然确定一个不动域,因此是满射。\
当它是一一映射时,将立刻有 $"Inv" = Inv(Gal)$,进而 $"Inv"(Gal(quotient(K, F))) = F$,进而是伽罗华扩张
===
容易发现 $E$ 是多项式:
$
(x^2 - 2)(x^2 - 3)(x^2 - 5)
$
的分裂域,从而是可分正规扩张即伽罗华扩张。\
之前习题已经给出它的伽罗华群恰为 $(ZZ_2)^3$
===
显然若 $i in E$,则 $[Q(i) : Q] | [E : Q]$,矛盾
===
取 $a = (sqrt(2) + sqrt(2)i)/2$ 满足 $a^2 = i$,不难发现它的所有根恰为:
$
root(8, 2) a^k, k=0,1,2,...,7
$
因此 $E = QQ(a, root(8, 2)) = QQ(i, root(8, 2))$\
由埃森斯坦判别法,$x^8 - 2$ 在 $QQ$ 上不可约。同时,容易验证 $i in.not QQ(root(8, 2))$,进而这是 16 次扩张\
注意到 $QQ(i)$ 对应的子群是 8 阶子群,$QQ(root(8, 2))$ 对应 $2$ 阶子群,且两个子群的交只有平凡元,因此:
$
G = H_1 times.r ZZ_2
$
- 先考虑 $H_1$,由扩张次数可以看出 $x^8 - 2$ 也是 $QQ(i)$ 上不可约多项式,因此 $|H_1| = 8$,恰好将 $root(8, 2)$ 映到 $root(8, 2) a^k$\
同时,取 $sigma in H_1: sigma(root(8, 2)) = root(8, 2) a$,应当有:
$
sigma(a) = (sigma(root(8, 2)^4) + sigma(root(8, 2)^4)i)/2 = - a = a^5
$
进而记 $sigma^k(root(8, 2)) = root(8, 2)a^(b_n)$,有:
$
b_n = 5 b_(n-1) + 1
$
从而列出 $b_n$:
$
0, 1, 6, -1, 4, -3, 2, 3, 0
$
表明 $sigma$ 确实是生成元
- 其次,取 $sigma in H_1: sigma(root(8, 2)) = root(8, 2) a, phi in H_2: phi(i) = -i$,将有:
$
sigma compose phi(root(8, 2)) = sigma(root(8, 2)) = root(8, 2) a\
phi compose sigma(root(8, 2)) = phi(root(8, 2) a) = root(8, 2) phi(a) = root(8, 2) a^7 = sigma^3(root(8, 2))
$
因此两群中元素不交换,半直积由:
$
phi compose sigma compose phi = sigma^3
$
给出
===
+
记 $p(x) = f(x)/(x-1)$,则:
$
p(x+1) = f(x+1)/x = sum_(i=0)^6 vec(7, i+1)x^i
$
由埃森斯坦判别法这是不可约多项式。它的所有根当然是 $xi_7^k = e^((2 k pi i)/7)$\
注意到 $E$ 可被任何一个根生成,特别的 $E = QQ(xi_7)$,所有 $QQ-$自同构将由 $xi_7$ 的像决定,容易验证恰为 $ZZ_7^times = ZZ_6$
+
$6$ 的每个因子恰对应一个子群,分别为:
$
{e}, ZZ_2, ZZ_3, ZZ_6
$
由伽罗华定理这就恰对应四个子域。显然 ${e}, ZZ_6$ 分别对应 $QQ, E$\
$ZZ_2$ 的一个生成元为:
$
xi -> xi^6
$
它保持 $xi + Inv(xi) in E - Q$ 不动,因此 $QQ(xi + Inv(xi)) subset "Inv"(ZZ_2)$。考虑扩张次数 $3$ 是素数,只能取等。\
$ZZ_3$ 的一个生成元为:
$
xi -> xi^2
$
它保持 $xi + xi^2 + xi^4$ 不动,考虑扩张次数它就是 $QQ(xi + xi^2 + xi^4)$
+
$29$ 是素数从而上面的证明同样成立,因此伽罗华群恰为 $ZZ_28$,它的子群恰为:
$
{e}, ZZ_2, ZZ_4, ZZ_7, ZZ_14, ZZ_28
$
除了平凡情况,生成元分别为:
$
xi -> xi\
xi -> xi^28\
xi -> xi^12\
xi -> xi^7\
xi -> xi^9
$
同样可以写出子域
===
+
同态性,单、满射都容易验证
+
$
(sum_i a_i t^i)/(sum_i b_i t^i) = sigma((sum_i a_i t^i)/(sum_i b_i t^i)) = (sum_i a_i (1/t)^i)/(sum_i b_i (1/t)^i) = \
= (sum_i a_i t^i + sum_i a_i t^(-i))/(sum_i b_i t^i + sum_i b_i t^(-i)) := (f(t) + f(1/t))/(g(t) + g(1/t))
$
由对称多项式理论,将有:
$
f(t) + f(1/t) = k(t + 1/t, t dot 1/t) = k'(t+1/t)\
g(t) + g(1/t) = h'(t + 1/t)
$
综上,$L = F(t + 1/t)$\
接下来计算 $t$ 的最小多项式,注意到:
$
x^2 -(t + 1/t)x + 1
$
将成为 $t$ 的零化多项式,它是二次的,当然不可约,因此 $[F(t) : F(t + 1/t)] = 2$
+
上面已经给出
+
前面的证明都是类似的,生成元为 $t(1-t)$,$t$ 在其上最小多项式为:
$
x^2 -x + t(1-t)
$
+
计算得:
$
sigma(tau(t)) = 1/(1-t)
$
令 $x = t, y = 1/(1-t), z = (t - 1)/t$,类似的被 $sigma compose tau$ 保持不动的有理分式均形如 $h(x, y, z)$,同时我们有:
$
x y z = 1\
x y + y z + x z = t/(1-t) - 1/t + (t - 1) = (t^3 - 3t + 1)/(t(1-t))\
x + y + z = 1/t + t/(1-t) + (t - 1)/t = (t^3 - 3t + 1)/(t(1-t)) = x y + y z + x z
$
因此被 $sigma compose tau$ 恰为 $E' = F(x + y + z)$,容易计算 $[E : E'] = 3$\
同时 $sigma$ 并不保持其上所有元素,因此所有求 $L := Inv(G)$ 比其更小。此外,(2) 表明 $2 | [E : L]$,因此后者至少为 $6$\
容易验证 $h$ 被 $sigma, tau$ 均保持,且最小多项式次数为 6(之前习题已经证明),因此恰好是一个生成元。
===
我们不妨将 $x^9 - t$ 视作 $(ZZ_37 (t))[x]$ 上元素,进而由高斯引理,只需证明它在 $(ZZ_37 [t])[x]$ 不可约\
令 $x^9 - t = h(x, t)k(x, t)$,观察次数和 $t$ 首项系数,有:
$
h(x, t) = h'(x) - h''(x)t\
k(x, t) = k'(x)
$
且 $k'(x) h''(x) = 1 => k'(x) ~ h''(x) ~ 1$,从而它不可约。\
对于可分性,求导发现:
$
(x^9 - t)' = 9 x^8 != 0\
$
进而结论成立\
对于第二个结论,计算可得 $ZZ_37$ 上 $x^9 - 1$ 恰有 9 个不同的根 $1 = xi_0, xi_1, xi_2, ..., xi_8$,它们对乘法封闭,进而构成 $ZZ_37$ 的一个子群,当然是循环子群\
其次,任取 $alpha$ 是 $x^9 - t$ 的一个根,显然:
$
alpha xi_i
$
恰为它的所有根,进而扩张的次数就是 $9$\
显然每个 $ZZ_37-$自同构应该保持 $xi_i$ 并把 $alpha$ 映到 $alpha xi_k$。任给 $alpha$ 的像,可以唯一确定一个这样的映射(注意任何一个根都是生成元)。\
因此记:
$
sigma_i : alpha -> alpha xi_i
$
将有:
$
sigma_i compose sigma_j (alpha) = alpha xi_i xi_j = alpha xi_(i+j)
$
因此伽罗华群恰为 $ZZ_9$
|
|
https://github.com/Complex2-Liu/macmo | https://raw.githubusercontent.com/Complex2-Liu/macmo/main/contests/2023/content/problem-06.typ | typst | #import "../lib/math.typ": problem, proof, note, ans
#problem[
已知 $A B C D$ 是凸四边形, 求证以下不等式
$ max(A B + C D, A D + B C) < A C + B D < A B + B C + C D + D A. $
]
#proof[
设 $A C, B D$ 的交点为 $O$. 我们有 $ O A + O B &> A B \ O C + O D &> C D $
所以 $A C + B D > A B + C D$. 同理可证 $A C + B D > A D + B C$.
另一方面, 我们有 $ A B + B C &> A C \ B C + C D &> B D \ C D + D A &> C A \
D A + A B &> D B $ 四项加起来便证明了 $A C + B D < A B + B C + C D + D A$.
]
/* vim: set ft=typst: */
|
|
https://github.com/maucejo/presentation_polylux | https://raw.githubusercontent.com/maucejo/presentation_polylux/main/template/main.typ | typst | MIT License | #import "@preview/presentation-template:0.3.0": *
#import "../src/presentation-template.typ": *
// Titre - Facultatif - Peut être écrit directement dans le #title-slide
#let title = [Titre
#v(-0.5em)
#line(length: 15%, stroke: 0.075em + colors.red)
#v(-0.5em)
#text(size: 0.8em, [Sous-titre])
]
// Laboratoire - Facultatif - Peut être écrit directement dans le #title-slide
#let labo = [Laboratoire de Mécanique des Structures et des Systèmes Couplés
#v(-0.5em)
Conservatoire National des Arts et Métiers
]
// Auteur - Facultatif - Peut être écrit directement dans le #title-slide
#let auteur = [#text(fill: colors.red, [Auteur A]) #h(1em) Auteur B]
// Appel du thème
#show: presentation.with(
title: title,
author: auteur,
laboratory: labo,
lang: "fr",
)
// Slide de titre
#title-slide
// Slide pour le plan
#content-slide()
// Slide pour définir une nouvelle section
#new-section-slide([First section])
#slide(title: [Titre de la diapositive], subtitle: "Un sous-titre")[
#boxeq[
$
bold(z)_(k + 1) = bold(A) bold(z)_k + bold(B) bold(u)_k + bold(w)_k \
bold(y)_k = bold(C) bold(z)_k + bold(v)_k
$
]
- #lorem(20)
#link-box(<code-slide>, "Aller à la diapositive de code")
<first-slide>
]
#slide(title: [Titre])[
#lorem(10)
]
#new-section-slide("Second section")
#slide(title: "Titre de la diapositive")[
#info[#lorem(10)]
#tip[#lorem(10)]
#important[#lorem(10)]
#question[#lorem(10)]
]
#new-section-slide("Third section")
#slide(title: "Titre de la diapositive")[
Un petit bout de code
#code(lang:"Julia")[
```julia
# Un commentaire
function squared(x)
return x^2
end
```
]
#link-box(<first-slide>, "Retour à la première diapositive")<code-slide>
]
// Slide pour réveiller l'assistance
#focus-slide[
Merci de votre attention
Questions ?
]
#appendix-slide[
Une annexe
]
#appendix-slide[
Une annexe
] |
https://github.com/Origami404/kaoyan-shuxueyi | https://raw.githubusercontent.com/Origami404/kaoyan-shuxueyi/main/概率与统计.typ | typst | #import "./template.typ": sectionline, gray_table, colored
#let Ex = $upright(E)$
#let Var = $upright(D)$
#let Cov = $"Cov"$
= 概率与统计
== 常用概念
#set list(marker: ([★], [⤥], [›]))
- 抽签原理: 不放回抽样, 第 $k$ 次抽到的概率和第一次抽到的概率是一样的
- 多个变量互相独立 $=>$ 两两独立, 反之不然
- 随机变量是样本空间到 $RR$ 的函数
- 累积分布函数 (CDF) $F(x) = P{X <= x}$
- 概率分布函数 PDF $f(x)$ 定义为能积分得到 CDF 的函数 (注意*不是* $P{X = x}$)
- 两个变量独立 $=>$ 不相关, 反之不然
- 不相关 *且* 遵循二维正态 $=>$ 独立
两个常用积分:
$
integral_0^(+infinity) x^n e^(-x) dif x = n!
quad quad
integral_0^(+infinity) e^(-x^2) dif x = sqrt(pi)/2
$
#gray_table(
columns: (auto, 1fr, 1fr, 1fr),
[], [二项分布], [几何分布], [泊松分布],
[符号], [$B(n, p)$], [$G(p)$], [$P(lambda)$],
[分布律], [$P{X=k} = C_n^k p^k (1-p)^(n-k)$], [$P{X=k}=(1-p)^(k-1) p$], [$P{X=k} = lambda^k / k! e^(-lambda)$],
[期望], [$n p$], [$1/p$], [$lambda$],
[方差], [$n p (1-p)$], [$(1-p)/p^2$], [$lambda$]
)
#gray_table(
columns: (auto, 1fr, 1fr, 1fr),
[], [均匀分布], [指数分布], [正态分布],
[符号], [$U(a, b)$], [$E(lambda)$], [$N(mu, sigma^2)$],
[范围], [$(a, b)$], [$(0, +infinity)$], [$(-infinity, +infinity)$],
[PDF], [$f(x) = 1/(b-a)$], [$f(x) = lambda e^(- lambda x)$], [$f(x) = 1/sqrt(2 pi sigma^2) e^(-(x-mu)^2 / (2 sigma^2))$],
[期望], [$(a+b)/2$], [$1/lambda$], [$mu$],
[方差], [$(a-b)^2/12$], [$1/lambda^2$], [$sigma^2$]
)
指数分布有无记忆性: $P{X > s + t | Y > s} = P{Y > t}$
== 分布函数求法
$
F(x) = integral_0^x f(x) dif x
quad quad
f(x) = dif / (dif x) F(x)
$
$
F(x, y) = integral_0^x integral_0^y f(x, y) dif y dif x
quad quad
f(x, y) = partial^2 / (partial x partial y) F(x, y)
$
$
F_X (x) = lim_(y -> + infinity) F(x, y)
quad quad
f_X (x) = integral_0^(+infinity) f(x, y) dif y
$
$
f_(X|Y) = f(x, y) / (f_X (x))
$
== 随机变量的函数与特征
记 $Y = g(X)$, 若 $g$ 可逆则记 $X = h(Y)$
$
F_Y (y) = F_X (h(y))
quad quad
f_Y (y) = f_X (h(y)) colored(|h'(y)|)
$
期望, 方差, 协方差:
$
Ex(X) = sum x p(x) = integral x f(x) dif x \
Var(X) = Ex((X - Ex(X))^2) = Ex(X^2) - [Ex(X)]^2 = Cov(X, X) \
Cov(X, Y) = Ex((X - Ex(X))(Y - Ex(Y))) = Ex(X Y) - Ex(X)Ex(Y) \
rho_(X Y) = Cov(X, Y) / sqrt(Var(X) * Var(Y))
$
常用性质
$
Ex(c) = c quad Ex(a X) = a Ex(X) quad E(X+Y) = Ex(X) + Ex(Y) \
Var(c) = 0 quad Var(a X) = a^2 Var(X) quad Var(X plus.minus Y) = Var(X) + Var(Y) colored(plus.minus 2 Cov(X, Y)) \
Cov(X, Y) = Cov(Y, X) quad Cov(X, a Y) = a Cov(X, Y) \
Cov(X, Y+Z) = Cov(X, Y) + Cov(X, Z) \
\
|rho_(X Y)| = 1 <=> P{Y = a X + b} = 1
$
*正交*性质 (只有 $X tack.t Y$ 时才成立)
$
Ex(X, Y) = Ex(X) Ex(Y) \
Var(X + Y) = Var(X) + Var(Y) \
rho_(X Y) = Cov(X, Y) = 0
$
- 做题的时候一定要看清楚:
1. 求的是 $Var$ 还是 $Ex$
2. 里边是 $X Y$ 还是 $X + Y$
== 数理统计
#let avg(x) = $overline(#x)$
研究许多独立同分布 (i.i.d.) 的随机变量的学科.
- 基本概念
- 总体: 一个分布
- 样本: $n$ 个独立同分布的随机变量
- 样本值: 样本的一个取值
- 统计量: 样本上的一个函数: $g(X_1, ..., X_n)$ (因此也是一个随机变量)
- 重要统计量
- 均值: $avg(X) = 1/n sum X_i$
- 方差: $S^2 = colored(1/(n-1)) sum (X_i - avg(X))^2$
- $k$ 阶原点矩: $A_k = 1/n sum X_i^k$
- $k$ 阶中心矩: $B_k = 1/n sum (X_i - avg(X))^k$
- 重要统计量性质
- $Ex(avg(X)) = Ex("分布")$, $Var(avg(X)) = 1/n Var("分布")$
- $Ex(S^2) = Var("分布")$
=== 抽样分布
标准正态分布总体的样本的一些统计量满足的分布比较有用, 这类分布统称为抽样分布.
- $chi^2$ 分布
- 对 ${X_i}_n ~ N(0, 1)$: 统计量 $chi^2 = sum X_i^2$ 满足的分布, 记为 $chi^2(n)$
- 可加性: 若 $chi_1^2 tack.t chi_2^2$, 则 $chi_1^2 + chi_2^2 ~ chi^2(n_1 + n_2)$
- 期望和方差: $Ex(chi^2) = n$, $Var(chi^2) = 2 n$
- $t$ 分布
- 对 $X ~ N(0, 1), Y ~ chi^2(n), X tack.t Y$: 统计量 $t = X/sqrt(Y \/ n)$ 满足的分布, 记为 $t(n)$
- PDF 为偶函数, 即 $f_t (x) = f_t (-x)$
- $F$ 分布
- 对 $U ~ chi^2(n_1), V ~ chi^2(n_2), U tack.t V$: 统计量 $F = (U\/n_1) / (V\/n_2)$ 满足的分布, 记为 $F(n_1, n_2)$
- $1/F ~ F(n_2, n_1)$
- $t^2 ~ F(1, n)$
利用上边的抽样分布, 可以得到一些非标准正态分布总体下样本的统计量性质. 设样本 ${X_i}_n ~ N(mu, sigma^2)$:
$
avg(X) ~ N(mu, sigma^2 / n) quad quad avg(X) tack.t S^2 quad quad sum ((X_i - mu) / sigma)^2 ~ chi^2(n) \
((n-1)S^2) / sigma^2 = sum ((X_i - avg(X))/sigma)^2 ~ chi^2(n - 1) quad quad Var(S^2) = (2 sigma^2)/(n - 1) \
(avg(X) - mu) / (S \/ sqrt(n)) quad~quad t(n - 1)
$
== 参数估计
- 矩估计
- 原理: 可以假设 样本矩 $approx$ 分布矩
- 先将分布矩表示为参数的函数, 再用样本值计算样本矩, 然后令二者相等, 解方程即可
- 最大似然估计
- 原理: 假设参数是使得样本值出现的可能性最大的那个参数
- 先计算在任意参数 $theta$ 下能取到样本值 $X_1, ..., X_n$ 的概率, 然后取对数后用拉格朗日求最大值即可
- 评价参数估计方法的好坏
- 由于估计参数是样本的统计量, 我们可以用随机变量的特征来评判参数估计方法的好坏
- 无偏性: $Ex(hat(theta)) = theta$
- 比较哪个估计更有效: $Var(hat(theta_1)) < Var(hat(theta_2))$
- 相合性: $n -> +infinity$ 时, $hat(theta)$ 依概率收敛到 $theta$
|
|
https://github.com/azzamsa/cv-template | https://raw.githubusercontent.com/azzamsa/cv-template/master/utils.typ | typst | Apache License 2.0 | // Helper Functions
#let monthname(n, display: "short") = {
n = int(n)
let month = ""
if n == 1 {
month = "January"
} else if n == 3 {
month = "March"
} else if n == 2 {
month = "February"
} else if n == 4 {
month = "April"
} else if n == 5 {
month = "May"
} else if n == 6 {
month = "June"
} else if n == 7 {
month = "July"
} else if n == 8 {
month = "August"
} else if n == 9 {
month = "September"
} else if n == 10 {
month = "October"
} else if n == 11 {
month = "November"
} else if n == 12 {
month = "December"
} else {
month = none
}
if month != none {
if display == "short" {
month = month.slice(0, 3)
} else {
month
}
}
month
}
#let strpdate(isodate) = {
let date = ""
if lower(isodate) != "present" {
let year = int(isodate.slice(0, 4))
let month = int(isodate.slice(5, 7))
let day = int(isodate.slice(8, 10))
let monthName = monthname(month, display: "short")
date = datetime(year: year, month: month, day: day)
date = monthName + " " + date.display("[year repr:full]")
} else if lower(isodate) == "present" {
date = "Present"
}
return date
}
#let daterange(start, end) = {
if start != none and end != none [
#start #sym.dash.en #end
]
if start == none and end != none [
#end
]
if start != none and end == none [
#start
]
}
|
https://github.com/AnsgarLichter/hka-thesis-template | https://raw.githubusercontent.com/AnsgarLichter/hka-thesis-template/main/chapters/1_introduction.typ | typst |
#import "/common/todo.typ": *
#import "@preview/glossarium:0.2.6": gls, glspl
#import "/thesis/template.typ": flex-caption
= Introduction
#lorem(800)
== Motivation
#lorem(250)
#lorem(36)
#lorem(30)
=== Third Level
#lorem(550)
== Objective
#lorem(300)
This is an example citation @Smith.2020. #gls("oidc") means @oidc. @figure describes @table which is shown in @listing. Test a b c d.
#figure(
image("/figures/tiger.png", width: 80%),
caption: flex-caption(
[This is my long caption text in the document. @a],
[This is short],
)
) <figure>
#figure(
table(
columns: (1fr, auto, auto),
inset: 10pt,
align: horizon,
[], [*Area*], [*Parameters*],
"Text",
$ pi h (D^2 - d^2) / 4 $,
[
$h$: height \
$D$: outer radius \
$d$: inner radius
],
"Text",
$ sqrt(2) / 12 a^3 $,
[$a$: edge length]
),
caption: flex-caption(
[This is my long caption text in the document. @b],
[This is short],
)
) <table>
#figure(
```rust
fn main() {
println!("Hello World!");
}
```,
caption: flex-caption(
[This is my long caption text in the document. @c],
[This is short],
)
) <listing> |
|
https://github.com/Myriad-Dreamin/tinymist | https://raw.githubusercontent.com/Myriad-Dreamin/tinymist/main/crates/tinymist-query/src/fixtures/type_check/with.typ | typst | Apache License 2.0 | #let f(x) = x;
#let g = f.with(1);
#let x = g() |
https://github.com/jgm/typst-hs | https://raw.githubusercontent.com/jgm/typst-hs/main/test/typ/compute/calc-10.typ | typst | Other | // Error: 14-15 divisor must not be zero
#calc.rem(5, 0)
|
https://github.com/HeZeBang/shtthesis-typst | https://raw.githubusercontent.com/HeZeBang/shtthesis-typst/main/README.md | markdown | MIT License | # [Building] ShangHaiTech university THESIS (shtthesis-typst)
An unofficial **Typst** thesis template for ShanghaiTech University. (Building)
> [!warning]
>
> This project is currently under development! Despite our efforts, we are unable to guarantee the accuracy of the template.
>
> Additionally, **Typst** is continuously evolving at a rapid pace. The existing version may be out of date.
# Getting Started
1. Download the source code.
2. Start writing by
- Add the following code to your document:
```typst
#import "template.typ": *
#show: project.with(
...
)
```
- Or simply start from our main.typ
|
https://github.com/sitandr/typst-examples-book | https://raw.githubusercontent.com/sitandr/typst-examples-book/main/src/basics/states/states.md | markdown | MIT License | # States
<div class="warning">This section is outdated. It may be still useful, but it is strongly recommended to study new context system (using the reference).</div>
Before we start something practical, it is important to understand states in general.
Here is a good explanation of why do we _need_ them: [Official Reference about states](https://typst.app/docs/reference/meta/state/). It is highly recommended to read it first.
So instead of
```typ -norender
#let x = 0
#let compute(expr) = {
// eval evaluates string as Typst code
// to calculate new x value
x = eval(
expr.replace("x", str(x))
)
[New value is #x.]
}
#compute("10") \
#compute("x + 3") \
#compute("x * 2") \
#compute("x - 5")
```
**THIS DOES NOT COMPILE:** Variables from outside the function are read-only and cannot be modified
Instead, you should write
```typ
#let s = state("x", 0)
#let compute(expr) = [
// updates x current state with this function
#s.update(x =>
eval(expr.replace("x", str(x)))
)
// and displays it
New value is #context s.get().
]
#compute("10") \
#compute("x + 3") \
#compute("x * 2") \
#compute("x - 5")
The computations will be made _in order_ they are _located_ in the document. So if you create computations first, but put them in the document later... See yourself:
#let more = [
#compute("x * 2") \
#compute("x - 5")
]
#compute("10") \
#compute("x + 3") \
#more
```
## Context magic
So what does this magic `context s.get()` mean?
> [Context in Reference](https://typst.app/docs/reference/context/)
In short, it specifies what part of your code (or markup) can _depend on states outside_. This context-expression is packed then as one object, and it is evaluated on layout stage.
That means it is impossible to look from "normal" code at whatever is inside the `context`. This is a black box that would be known _only after putting it into the document_.
We will discuss `context` features later.
## Operations with states
### Creating new state
```typ
#let x = state("state-id")
#let y = state("state-id", 2)
#x, #y
State is #context x.get() \ // the same as
#context [State is #y.get()] \ // the same as
#context {"State is" + str(y.get())}
```
### Update
Updating is _a content_ that is an instruction. That instruction tells compiler that in this place of document the state _should be updated_.
```typ
#let x = state("x", 0)
#context x.get() \
#let _ = x.update(3)
// nothing happens, we don't put `update` into the document flow
#context x.get()
#repr(x.update(3)) // this is how that content looks \
#context x.update(3)
#context x.get() // Finally!
```
Here we can see one of _important `context` traits_: it "sees" states from outside, but can't see how they change inside it:
```typ
#let x = state("x", 0)
#context {
x.update(3)
str(x.get())
}
```
### ID collision
_TLDR; **Never allow colliding states.**_
<div class="warning">
States are described by their id-s, if they are the same, the code will break.
</div>
So, if you write functions or loops that are used several times, _be careful_!
```typ
#let f(x) = {
// return new state…
// …but their id-s are the same!
// so it will always be the same state!
let y = state("x", 0)
y.update(y => y + x)
context y.get()
}
#let a = f(2)
#let b = f(3)
#a, #b \
#raw(repr(a) + "\n" + repr(b))
```
However, this _may seem_ okay:
```typ
// locations in code are different!
#let x = state("state-id")
#let y = state("state-id", 2)
#x, #y
```
But in fact, it _isn't_:
```typ
#let x = state("state-id")
#let y = state("state-id", 2)
#context [#x.get(); #y.get()]
#x.update(3)
#context [#x.get(); #y.get()]
```
|
https://github.com/veilkev/jvvslead | https://raw.githubusercontent.com/veilkev/jvvslead/Typst/files/7_prices.typ | typst | #import "../sys/packages.typ": *
#import "../sys/sys.typ": *
#import "../sys/header.typ": *
|
|
https://github.com/chamik/gympl-skripta | https://raw.githubusercontent.com/chamik/gympl-skripta/main/cj-autori/orwell.typ | typst | Creative Commons Attribution Share Alike 4.0 International | #import "/helper.typ": autor
#autor("jorjor wel", "1903", "1950 (46 let)", "žurnalista, esejista, literární kritik", "Eton College", "antiautoritářský, dystopie", "/cj-autori/media/orwell.jpg")
<NAME>, vlastním jménem <NAME>, byl britský spisovatel, novinář a esejista, známý svou ostrou kritikou totalitních režimů a manipulace mocí. Narodil se v roce 1903 v Indii a zemřel v roce 1950. Jeho literární dílo je pečlivě propracovaným zrcadlem společnosti, ve které žil, a jeho názory se formovaly v turbulentním období 20. století, které zahrnovalo období mezi dvěma světovými válkami a studenou válku. Zapojil se do Španělské občanské války za vládní (marxistickou) stranu. V ČSSR byl ve své době na seznamu zakázaných autorů, jeho knihy vycházely v exilu.
Orwell byl člověk komplikovaný. Byl to sice zarytý marxista, ale naprosto odmítal autoritářství. Umělecky Orwell zastupoval především literární směr známý jako dystopie, ve kterém se zaměřuje na odhalení temných stránek společnosti a varuje před možnými důsledky mocenského zneužití. Jeho styl psaní je přímočarý, strohý a plný sarkastického humoru. Zemřel na tuberkulózu, kvůli které se neúčastnil WWII.
Mezi další nejslavnější díla <NAME> patří:
1. *1984* -- Dystopický román, který popisuje totalitní společnost ovládanou jedinou stranou, Big Brotherem. Orwell v tomto díle varuje před nadměrným vládním dohledem, manipulací informací a ztrátou osobní svobody.
2. *Hold Katalánsku* -- osobní zkušenosti a poznatky z doby od prosince 1936 do června 1937 o španělské občanské válce, které se aktivně zúčastnil v řadách milice strany POUM (antistalinistická a marxistická).
*Současníci*\
_<NAME>_ -- 451° F. (@fahrenheit[]), 1984 \
_<NAME>_ -- R. <NAME>. (@rur[]), 1920 \
_<NAME>_ -- Já, robot, 1950 \
#pagebreak() |
https://github.com/justmejulian/typst-documentation-template | https://raw.githubusercontent.com/justmejulian/typst-documentation-template/main/theme/constant.typ | typst | #let body-font = "Helvetica Neue"
#let sans-font = "Helvetica Neue"
#let font-size = 12pt
|
|
https://github.com/SWATEngineering/Docs | https://raw.githubusercontent.com/SWATEngineering/Docs/main/src/3_PB/VerbaliEsterni/VerbaleEsterno_240313/meta.typ | typst | MIT License | #let data_incontro = "13-03-2024"
#let inizio_incontro = "16:30"
#let fine_incontro = "17:00"
#let luogo_incontro = "Google Meet"
#let company = "Sync Lab" |
https://github.com/piepert/philodidaktik-hro-phf-ifp | https://raw.githubusercontent.com/piepert/philodidaktik-hro-phf-ifp/main/src/main.typ | typst | Other | //#ONLY_COMPILE_US
//#COMPILE_NAME:KÜK.pdf
//#COMPILE_NAME:KÜK-{YEAR}-{MONTH}.pdf
#import "/src/template.typ": *
#show: project.with()
#include "parts/ephid/ephid.typ"
#include "parts/spue/spue.typ" |
https://github.com/Myriad-Dreamin/typst.ts | https://raw.githubusercontent.com/Myriad-Dreamin/typst.ts/main/fuzzers/corpora/bugs/2105-linebreak-tofu_00.typ | typst | Apache License 2.0 |
#import "/contrib/templates/std-tests/preset.typ": *
#show: test-page
#linebreak()中文
|
https://github.com/Mc-Zen/tidy | https://raw.githubusercontent.com/Mc-Zen/tidy/main/examples/funny-math/custom-style.typ | typst | MIT License | #import "../../src/tidy.typ"
#import tidy.utilities: *
// Color to highlight function names in
#let fn-color = rgb("#4b69c6")
// Colors for Typst types
#let type-colors = (
"content": rgb("#a6ebe6"),
"color": rgb("#a6ebe6"),
"string": rgb("#d1ffe2"),
"none": rgb("#ffcbc4"),
"auto": rgb("#ffcbc4"),
"boolean": rgb("#ffedc1"),
"integer": rgb("#e7d9ff"),
"float": rgb("#e7d9ff"),
"ratio": rgb("#e7d9ff"),
"length": rgb("#e7d9ff"),
"angle": rgb("#e7d9ff"),
"relative-length": rgb("#e7d9ff"),
"fraction": rgb("#e7d9ff"),
"symbol": rgb("#eff0f3"),
"array": rgb("#eff0f3"),
"dictionary": rgb("#eff0f3"),
"arguments": rgb("#eff0f3"),
"selector": rgb("#eff0f3"),
"module": rgb("#eff0f3"),
"stroke": rgb("#eff0f3"),
"function": rgb("#f9dfff"),
)
#let get-type-color(type) = type-colors.at(type, default: rgb("#eff0f3"))
// Create beautiful, colored type box
#let show-type(type) = {
h(2pt)
box(outset: 2pt, fill: get-type-color(type), radius: 2pt, raw(type))
h(2pt)
}
#let show-parameter-list(fn, display-type-function) = {
pad(x: 10pt, {
set text(font: "Cascadia Mono", size: 0.85em, weight: 340)
text(fn.name, fill: fn-color)
"("
let inline-args = fn.args.len() < 2
if not inline-args { "\n " }
let items = ()
for (arg-name, info) in fn.args {
let types
if "types" in info {
types = ": " + info.types.map(x => display-type-function(x)).join(" ")
}
items.push(arg-name + types)
}
items.join( if inline-args {", "} else { ",\n "})
if not inline-args { "\n" } + ")"
if fn.return-types != none {
" -> "
fn.return-types.map(x => display-type-function(x)).join(" ")
}
})
}
// Create a parameter description block, containing name, type, description and optionally the default value.
#let show-parameter-block(
name, types, content, style-args,
show-default: false,
default: none,
) = block(
inset: 10pt, fill: luma(98%), width: 100%,
breakable: style-args.break-param-descriptions,
[
#box(heading(level: style-args.first-heading-level + 3, name))
#h(.5cm)
#types.map(x => (style-args.style.show-type)(x)).join([ #text("or",size:.6em) ])
#content
#if show-default [ #parbreak() Default: #raw(lang: "typc", default) ]
]
)
#let show-function(
fn, style-args,
) = {
[
#heading(fn.name, level: style-args.first-heading-level + 1)
#label(style-args.label-prefix + fn.name + "()")
]
eval-docstring(fn.description, style-args)
block(breakable: style-args.break-param-descriptions, {
heading("Parameters", level: style-args.first-heading-level + 2)
(style-args.style.show-parameter-list)(fn, style-args.style.show-type)
})
for (name, info) in fn.args {
let types = info.at("types", default: ())
let description = info.at("description", default: "")
if description == "" and style-args.omit-empty-param-descriptions { continue }
(style-args.style.show-parameter-block)(
name, types, eval-docstring(description, style-args),
style-args,
show-default: "default" in info,
default: info.at("default", default: none),
)
}
v(4.8em, weak: true)
}
#let show-reference(label, name, style-args: none) = {
let output
if "no-namespace" in style-args {
output = text(fill: fn-color, raw(name))
} else {
output = text(fill: purple, raw("#" + style-args.label-prefix)) + text(fill: fn-color, raw("." + name))
}
link(label, output)
}
#let show-outline(module-doc, style-args: none) = {
let prefix = module-doc.label-prefix
style-args.insert("no-namespace", none)
let items = ()
for fn in module-doc.functions {
// items.push(link(label(prefix + fn.name + "()"), fn.name + "()"))
let ref = show-reference(label(prefix + fn.name + "()"), fn.name + "()", style-args: style-args)
items.push(ref)
}
list(..items)
}
#import tidy.show-example: show-example as show-example-base
#let show-example(
..args
) = {
show-example-base(
..args,
code-block: block.with(radius: 3pt, stroke: .5pt + luma(200)),
preview-block: block.with(radius: 3pt, fill: rgb("#e4e5ea")),
col-spacing: 5pt
)
} |
https://github.com/furkan/cv | https://raw.githubusercontent.com/furkan/cv/main/modules/experience.typ | typst | Apache License 2.0 | #import "../brilliant-CV/template.typ": *
#cvSection("Experience")
#cvEntry(
title: [Team Lead],
society: [Novit.AI],
date: [Oct 2023 - Present],
location: [Ankara, TR],
description: list(
[Lead a tech team of seven engineers.],
[Operated accumulation and distribution of know-how in the form of clear documentation.],
[Cloud / DevOps: (FastAPI, Docker, GitHub Actions, AWS EC2 & ECR & S3 & Lambda & DynamoDB & Lightsail) #[
- Oversaw development of a telemetry server for deployed devices.
- Improved environment setup speeds with containerization via Docker and distribution via AWS ECR.
- Reduced runtime errors and improved consistency across projects by introducing checks on code changes with GitHub Actions.
- Owned responsibility for reverse SSH and VPN servers for deployed devices and CVAT servers for annotation purposes.
- Managed and maintained Django-based websites for internal tools.]],
),
// tags: ("Leadership", "Docker", "GitHub Actions", "AWS")
)
#cvEntry(
title: [Machine Learning Engineer],
society: [Novit.AI],
date: [Mar 2022 - Oct 2023],
location: [Ankara, TR],
description: list(
[Renovated the company website and made it easier to create and modify its content. (React / Vue)],
[Ground Observation Unit: (NVIDIA Jetson, TensorRT, GPU, Docker, TAK, Edge AI) #[
- Refactored and maintained a legacy embedded AI camera system that is deployed on Jetsons with TensorRT object detection / tracking models.
- Improved setup automation to reduce development time and frictions.
- Investigated, figured out, and documented how to use the Team Awareness Kit (TAK) interface. Created modules that allow communication with TAK clients via images, videos, and chat.
- Documented the usage of routers, GPS modules, USB and IP cameras, AIS transmitters/receivers with NVIDIA Jetson devices.
]],
[ML / Data Engineering: (PyTorch, Web scraping, GitHub Actions, Django) #[
- Maintained and debugged a legacy data extraction pipeline that uses an undocumented third party API.
- Constructed projects to convert image segmentation results into more usable formats.
- Scraped and generated datasets with clean structures to aid training object detection models.
- Trained object detection models and prepared pipelines that compare the models' results against the state-of-the-art.
- Created and maintained parsers that convert between different annotation types for segmentation masks/polygons.
]],
),
// tags: ("PyTorch", "Web scraping", "React / Vue", "Fastapi")
)
#cvEntry(
title: [Research Assistant],
society: [METU Heart Research Laboratory],
date: [Oct 2020 - Mar 2022],
location: [Ankara, TR],
description: list(
[Worked with my thesis advisor on TUBITAK funded projects: (MATLAB, Digital Signal Processing, Bayesian MAP Estimation) #[
- Application of Bayesian Estimation Methods to Electrocardiographic Imaging: Prior Model Selection and Reduction of Noise Effects
- Performance Evaluation of Noninvasive Electrocardiographic Imaging for the Localization of Premature Ventricular Contractions from Clinical Data
]],
[Inspected and reduced the effect of errors in heart and torso geometric models on the performance of the inverse problem of electrocardiography.],
),
// tags: ("MATLAB", "Digital signal processing")
)
#cvEntry(
title: [Machine Learning Engineer Intern],
society: [Darkblue Telecommunications],
date: [Summer 2019],
location: [Ankara, TR],
description: list(
[Trained a road detecting model with CNNs and tested it on videos from a drone.],
)
)
#cvEntry(
title: [Electronics Engineer Intern],
society: [AirCar Corp],
date: [Summer 2019],
location: [Istanbul, TR],
description: list(
[Ensured the safety of electronic components and researched battery management systems.],
)
)
#cvEntry(
title: [Electrical Engineer Intern],
society: [ELTEMTEK],
date: [Summer 2018],
location: [Ankara, TR],
description: list(
[Designed and modeled new electric distribution networks for several districts in Turkey.],
)
) |
https://github.com/MattiaOldani/Informatica-Teorica | https://raw.githubusercontent.com/MattiaOldani/Informatica-Teorica/master/template.typ | typst | #let project(title: "", body) = {
set document(title: title)
set text(font: "Source Sans Pro", lang: "it")
set par(justify: true)
set heading(numbering: "1.")
set list(indent: 1.2em)
set enum(indent: 1.2em)
set page(numbering: "1")
align(center)[
#block(text(weight: 700, 1.75em, title))
]
v(1.75em)
show figure.where(kind: "parte"): it => {
counter(heading).update(0)
set page(
footer: {
set text(weight: "regular", size: 11pt)
counter(page).display()
}
)
if it.numbering != none {
set text(size: 20pt)
align(center + horizon,
strong(it.supplement + [ ] + it.counter.display(it.numbering)) + [ --- ] + strong(it.body)
)
}
}
show outline.entry: it => {
if it.element.func() == figure {
// https://github.com/typst/typst/issues/2461
let res = link(it.element.location(),
if it.element.numbering != none {
it.element.supplement + [ ]
numbering(it.element.numbering, ..it.element.counter.at(it.element.location()))
} + [ --- ] + it.element.body
)
res += h(1fr)
res += link(it.element.location(), it.page)
v(2.3em, weak: true)
strong(text(size: 13pt, res))
} else {
h(1em * (it.level - 1)) + it
}
}
show outline.entry.where(
level: 1
): it => {
v(12pt, weak: true)
strong(it)
}
let chapters-and-headings = figure.where(kind: "parte", outlined: true).or(heading.where(outlined: true))
pagebreak()
outline(indent: auto, target: chapters-and-headings)
show link: underline
body
}
#let parte = figure.with(
kind: "parte",
numbering: none,
supplement: "Parte",
caption: [],
)
#let parte = parte.with(numbering: "I")
|
|
https://github.com/vEnhance/1802 | https://raw.githubusercontent.com/vEnhance/1802/main/src/mt2.typ | typst | MIT License | #import "@local/evan:1.0.0":*
= Practice midterm 2 <ch-mt2>
Here is a practice midterm that I wrote to help students prepare for the actual exam.
(It was given on October 21, 2024 from 3:05pm-3:55pm.)
Unlike @ch-mt1, these are meant to be normal-ish difficulty problems,
not special hand-crafted challenges.
#prob[
A butterfly is fluttering in the $x y$ plane with position given by
$bf(r)(t) = angle.l cos(t), cos(t) angle.r$, starting from
time $t = 0$ at $bf(r)(0) = angle.l 1,1 angle.r$.
- Compute the speed of the butterfly at $t = pi/3$.
- Compute the arc length of the butterfly's trajectory from $t = 0$ to $t = 2 pi$.
- Sketch the butterfly's trajectory from $t = 0$ to $t = 2pi$ in the $x y$ plane.
] <prob-mt2p1>
#prob[
Let $k > 0$ be a fixed real number and let $f(x,y) = x^3 + k y^2$.
Assume that the level curve of $f$ for the value $21$ passes through the point $P = (1,2)$.
Compute the equation of the tangent line to this level curve at the point $P$.
] <prob-mt2p2>
#prob[
Let $f(x,y) = x^(5y)$ for $x,y > 0$.
Use linear approximation to estimate $f(1.001, 3.001)$ starting from the point $(1,3)$.
] <prob-mt2p3>
#prob[
Consider the function $f : RR^2 -> RR$ defined by
$ f(x,y) = cos(pi x) + y^4/4 - y^3/3 - y^2. $
- Compute all the critical points and classify them as saddle point, local minimum, or local maximum.
- Find the global minimums and global maximums of $f$, if they exist.
] <prob-mt2p4>
#prob[
Compute the minimum and maximum possible value of $x + 2 y + 2 z$
over real numbers $x$, $y$, $z$ satisfying $x^2 + y^2 + z^2 <= 100$.
] <prob-mt2p5>
#prob[
Consider the level surface of $f(x,y,z) = (x-1)^2 + (y-1)^3 + (z-1)^4$
that passes through the origin $O = (0,0,0)$.
Let $cal(H)$ denote the tangent plane to this surface at $O$.
Give an example of two nonzero tangent vectors to this surface at $O$ whose span is $cal(H)$.
] <prob-mt2p6>
Solutions are in @ch-sol-mt2.
|
https://github.com/jw2476/cslog | https://raw.githubusercontent.com/jw2476/cslog/master/devlogs/mod.typ | typst | = Devlogs
#include("triangle/mod.typ")
#include("buffer_race_conditions/mod.typ")
#include("client_server_data_representation/mod.typ") |
|
https://github.com/typst-tud/tud-slides | https://raw.githubusercontent.com/typst-tud/tud-slides/main/example/example.typ | typst | Apache License 2.0 | #import "@preview/touying:0.4.2": *
#import "../tud-slides.typ"
#let s = tud-slides.register(aspect-ratio: "16-9", debug: false)
#let s = (s.methods.info)(
self: s,
title: [Your Title],
subtitle: [Your Subtitle],
author: [<NAME>],
date: datetime.today(),
institution: [Institution],
location: [Location],
)
#let (init, slides, touying-outline, alert) = utils.methods(s)
#show: init
#let (slide, title-slide) = utils.slides(s)
#show: slides
= Title
== First Topic
#slide[
Hello, Touying!
#pause
Hello, Typst!
#lorem(40)
]
#slide(subtitle: "1st Subtitle")[
#lorem(40)
]
== Second Topic
#slide[
#lorem(40)
]
#slide(subtitle: "2nd Subtitle")[
#lorem(40)
]
== Third Topic
#slide(subtitle: "3nd Subtitle")[
#lorem(40)
]
|
https://github.com/typst/packages | https://raw.githubusercontent.com/typst/packages/main/packages/preview/salsa-dip/0.1.0/examples/74ls00.typ | typst | Apache License 2.0 | #import "@preview/salsa-dip:0.1.0": dip-chip-label
#set text(font: ("JetBrains Mono", "Fira Code", "DejaVu Sans Mono"), weight: "extrabold")
#set page(width: auto, height: auto, margin: .125cm)
/// Settings Values:
/// chip-label-size: Font size for the chip label
/// pin-number-margin: Margin to give next to pin numbers
/// pin-number-size: Font size for pin numbers
/// pin-label-size: Font size for pin labels
/// include-numbers: Boolean enabling pin numbers
/// pin-spacing: Spacing of pins
/// vertical-margin: Total margin to put into spacing above and below pin labels
#let labels = ("1A", "1B", "1Y", "2A", "2B", "2Y", "GND", "3Y", "3A", "3B", "4Y", "4A", "4B", "VCC")
#dip-chip-label(14, 0.24in, labels, "74LS00")
|
https://github.com/CardboardTurkey/CV | https://raw.githubusercontent.com/CardboardTurkey/CV/main/main.typ | typst | MIT License | #import "twentysecondcv.typ": *
#set text(font: "PT Sans")
#let blue_link(url, desc) = {
link(url, text(fill: blue, underline(desc)))
}
/*
#1 period, like From - To
#2 title
#3 note, basic note
#4 addtional_note
#5 body: the main body
*/
#let openwork(
period: "",
title: "",
note: "",
addtional_note: "",
body: ""
) = {
grid(
columns: (auto, 92%),
column-gutter: 0.5em,
period,
par([
#block()[
#strong(title)
#box(width: 1fr)
#text(size: fontSize.footnotesize, note)
]
#if (addtional_note.len() > 0) {
block(addtional_note)
}
#body
])
)
}
#main(
[
#profile(
name: "<NAME>, PhD",
jobtitle: "Senior Software Engineer",
)
#show_contacts(
(
(
icon: "linkedin",
fa-set: "Brands",
text: blue_link("https://www.linkedin.com/in/kiran-ostrolenk-b0b956176/", "linkedin.com/in/kiran-ostrolenk-b0b95617"),
),
(
icon: "gitlab",
fa-set: "Brands",
text: blue_link("https://gitlab.com/CardboardTurkey", "github.com/CardboardTurkey"),
),
(
icon: "github",
fa-set: "Brands",
text: blue_link("https://github.com/CardboardTurkey", "github.com/CardboardTurkey"),
),
(
icon: "globe",
fa-set: "Free Solid",
text: blue_link("https://kiran.ostrolenk.co.uk/blog", "kiran.ostrolenk.co.uk/blog"),
),
(
icon: "phone",
fa-set: "Free Solid",
text: "+44 795 7611 114",
),
(
icon: "envelope",
fa-set: "Free Solid",
text: "<EMAIL>",
),
)
)
#profile_section("Skills") My PhD in Physics required the translation of
complex mathematics into efficient computer algorithms for the simulation of
particle collisions. I developed strong skills:
- rapidly learning new and difficult concepts,
- communication of complex topics to experts and non-experts,
- working productively in large collaborative projects.
Since then I have deepened my expertise in engineering technology and practice
- developing expertise in Rust and its ecosystem,
- adhering to best practices such as continuous testing and reproducible builds,
- engaging in FOSS - upstream contributions and remote collaboration.
#profile_section("Interests")
#show_interests((
(
interest: "Rust",
score: 1,
),
(
interest: "Systems Engineering",
score: 0.8,
),
(
interest: "Nixos",
score: 0.8,
),
(
interest: "CI/CD",
score: 0.7,
),
))
],
[
#body_section("Experience")
#twentyitem(
period: [May. 2021 - \Now],
title: "Senior Software Engineer + Consultant",
note: "Codethink",
body: list(
"Advised and delivered for clients in a broad range of domains - focused on safe, reproducible and (where applicable) open solutions.",
"Engineered and led several Rust-based client projects. Most recently, delivered a performance-critical distributed system. Used " + emph("async") + " to meet performance requirements and carefully handled cancel/shutdown safety to ensure reliability.",
"Team leadership, interfacing with clients and justifying decisions/progress. Monitoring junior members, resolving day-to-day issues and working with PM to ensure work packages deliver on time",
)
)
#body_section("Work in the open")
#openwork(
period: " -",
title: blue_link("https://gitlab.com/rust-ci/rust-ci", "Rust CI for Gitlab"),
note: "Co-creator and lead maintainer",
body: "A generic pipeline for use in any Rust project."
)
#openwork(
period: " -",
title: blue_link("https://gitlab.com/CodethinkLabs/lorry/lorry2", "Lorry"),
note: "Lead maintainer",
body: "Mirroring service written in Rust. I was recently appointed maintainer. " + blue_link("https://gitlab.com/CodethinkLabs/lorry/lorry2/-/merge_requests?scope=all&state=merged&author_username=CardboardTurkey", "My improvements so far.")
)
#openwork(
period: " -",
title: "Upstream contributions",
body: list(
"Rust: " + blue_link("https://github.com/a-maier/hepmc2/pull/1", "Add async API to") + " " + raw("HepMC2") + " crate (WIP at time of writing)",
"Rust: " + blue_link("https://github.com/RonniSkansing/duration-string/pulls?q=is%3Apr+author%3Acardboardturkey", "Add feature and fixes") + " to " + raw("DurationString") + " library",
"C: " + blue_link("https://gitlab.com/qemu-project/qemu/-/commits/master?author=Kiran%20Ostrolenk", "Contributed towards RISC-V Vector Cryptography") + " in " + raw("QEMU"),
"Nix: Various additions/fixes to " + blue_link("https://github.com/NixOS/nixpkgs/pulls?q=is%3Apr+author%3Acardboardturkey+is%3Amerged", raw("nixpkgs")) + " and " + blue_link("https://github.com/nix-community/home-manager/pulls?q=is%3Apr+author%3Acardboardturkey+is%3Amerged", raw("home-manager")),
)
)
#body_section("Education")
#twentyitem(
period: [Sep. 2016 - \Dec. 2020],
title: "PhD Physics",
note: "University of Manchester",
// addtional_note: lorem(3),
body:
"Improved the mathematical accuracy and efficiency of two particle collision simulators: " + blue_link("https://launchpad.net/mg5amcnlo", "MadGraph") + " and " + blue_link("https://herwig.hepforge.org/", "Herwig") + " - large C++ projects." +
list(
"Accelerated some MadGraph calculations by 50% by re-modelling them as DAGs. "+blue_link("https://arxiv.org/abs/2102.00773", "arXiv:2102.00773"),
"Evaluated two competing mathematical algorithms within Herwig. Determined why they disagreed and which was more accurate.",
)
)
#twentyitem(
period: [Sep. 2012 - \Sep. 2016],
title: "MPhys Physics with Philosophy (first)",
note: "University of Manchester",
body: "Philosophy developed my critical thinking skills and the ability to solve abstract problems."
)
#body_section("Certificate")
#twentyitem(
period: [2022-09-14],
title: "LPIC-1",
note: blue_link("https://www.lpi.org/our-certifications/lpic-1-overview/")[Linux Professional Institute],
body: ""
)
// #twentyitem(
// period: [2018-07-10],
// title: "Functional Safety Practitioner ",
// note: blue_link("https://www.exida.com/Training/Course/iso_26262_road_vehicles_functional_safety")[Exida],
// body: ""
// )
#twentyitem(
period: [2022-06-09],
title: "Cyber Security Practitioner",
note: blue_link("https://www.exida.com/Training/Course/automotive-cybersecurity")[Exida],
body: ""
)
]
)
|
https://github.com/mdgrs/resume-typst | https://raw.githubusercontent.com/mdgrs/resume-typst/main/modules/professional.typ | typst | Apache License 2.0 | #import "../brilliant-CV/template.typ": *
#cvSection("Professional Experience")
#cvEntry(
title: [Senior Machine Learning Engineer],
society: [Inpher],
logo: "../src/logos/inpher.png",
date: [2020 - Present],
location: [Lausanne, Switzerland],
description: list(
[Design and adapt machine learning algorithms for cryptographical frameworks],
[Project lead for privacy preserving xgboost],
[Analyze and validate numerical precision of multiple parties algorithms],
[Design and implement a user facing system for private dataframes]
),
tags: ("Tree-based learning", "Recommender systems", "Data Independent Algorithms", "Cryptography")
)
#cvEntry(
title: [Data Scientist],
society: [UPC],
logo: "../src/logos/upc.png",
date: [2018 - 2020],
location: [Zurich, Switzerland],
description: list(
[Fault detection in the internet distribution network (hybrid fiber coaxial)],
[Manage and promote the CPD detection project, from exploratory data analysis to machine learning algorithm selection to deployment],
[Increase positive hit rate from 10% to above 85%],
[Generate visualizations and reports to help business partners and engineers better understand network status],
),
tags: ("Time series", "Data engineering", "Data Visualization")
)
#cvEntry(
title: [Technical Support],
society: [Pix4D],
logo: "../src/logos/pix4d.png",
date: [2015-2018],
location: [Lausanne, Switzerland],
description: list(
[Create a training program: workshops, educational videos, online material],
[Troubleshoot user issues, with a specialization in precision agriculture and multispectral imagery],
[Manage the elaboration of an online certification program],
[Liaise between technical and non technical teams],
),
tags: ("Online learning", "Precision Agriculture")
) |
https://github.com/Enter-tainer/delimitizer | https://raw.githubusercontent.com/Enter-tainer/delimitizer/main/demo.typ | typst | MIT License | #import "lib.typ": big, Big, bigg, Bigg, paired-delimiter
#set page(height: auto, width: auto, fill: white)
=== `delimitizer`: customize the size of the delimiter
#let parn = paired-delimiter("(", ")")
$
parn(size: bigg,
parn(size: big, (a+b)times (a-b))
div
parn(size: big, (c+d)times (c-d))
) + d \ = (a^2-b^2) / (c^2-d^2)+d
$
|
https://github.com/jrihon/cv | https://raw.githubusercontent.com/jrihon/cv/main/sections/other_skills.typ | typst | #import "../brilliant-template/template.typ": *
#pagebreak()
#cvSection("Other skills")
#columns(2, gutter: 11pt)[
#cvSubSection("Student Associations")
- *LHC Plutonica* #text("Secretary (2020-2021)", fill: regularColors.lightgray): Design template for annual magazine. Document and virtualise all activities.
- *LHC Plutonica* #text("Treasurer (2019-2020)", fill: regularColors.lightgray): Doubled cashflow w.r.t. the previous fiscal year. Introduced online management of funds. Established LHC Plutonica as a factual association.
- *Hades* #text("Vice President (2018-2019)", fill: regularColors.lightgray): Supportive role to the president of the association.
- *Farmaceutica* #text("Faculty Bar Manager (2015-2017)", fill: regularColors.lightgray): Responsible for all bar events. Manage inventory, maintain communication with distributors. General upkeep.
- *Farmaceutica* #text("Cantor (2016-2017)", fill: regularColors.lightgray): Head organiser and lead in all cantus events. Organised small events on student culture.
#colbreak()
#cvSubSection("Teaching assignments")
- *Teaching assistent*: Guide and supervise 3#super("rd") Bachelor Pharmaceutical Sciences students in the lab practicals of "Biopharmaceutical Analysis" (2020-Present, KU Leuven).
- *Supervisor* : Guide a master's student on the topic of nucleic acid _in silico_ research (2022-2023, Rega Institute for Medical Research). Student continues as colleague PhD.
- *Tutor* : Tutor in Chemistry for students taking part in the medicine and dentistry entrance exam (2018-2020, Slaagsleutels in Leuven).
]
|
|
https://github.com/dariakoz/Typst-Template | https://raw.githubusercontent.com/dariakoz/Typst-Template/main/Abschnitte/Thema%202.typ | typst | #import "@preview/sourcerer:0.2.1": code
= Analyse
== Ist-Zustand
=== Mobile Anwendung
Test:
#figure(
caption: [Auszug aus der `MainActivity.cs`],
kind: raw,
code(
number-align: right,
lang: "C#",
```cs
protected override void OnActivityResult([GeneratedEnum] int requestCode, Result resultCode, Intent intent)
{
if (resultCode != Result.Ok)
{
Log.Warning($"Received non-ok result. (request code: {resultCode}");
return;
}
// Check if we received an image result.
if (requestCode == CAMERA_REQUEST_CODE)
{
Bitmap bmp = (Bitmap)intent.Extras.Get("data");
Java.IO.File file = Java.IO.File.CreateTempFile("photo", ".png", CacheDir);
FileStream stream = System.IO.File.OpenWrite(file.AbsolutePath);
bmp.Compress(Bitmap.CompressFormat.Png, 0, stream);
stream.Close();
// [...]
}
base.OnActivityResult(requestCode, resultCode, intent);
}
```)
)
=== Web Services
=== Interaktion
== Soll-Zustand
== Handlungsbedarf
Nach voriger Auswertung ergeben sich grob folgende Anforderungen die bearbeitet werden müssen:
- Ananas
- Apfel
- Birne
@buch1
#pagebreak() |
|
https://github.com/typst/packages | https://raw.githubusercontent.com/typst/packages/main/packages/preview/g-exam/0.3.0/src/g-question.typ | typst | Apache License 2.0 | #import"./global.typ": *
/// Show a question.
///
/// *Example:*
/// ```
/// #g-question(point:2)[This is a question]
/// ```
///
/// - point (none, float): Points of the question.
/// - point-position (none, left, right): Position of points. If none, use the position defined in G-Exam.
/// - body (string, content): Body of question.
#let g-question(
point: none,
point-position: none,
body) = {
assert(point-position in (none, left, right),
message: "Invalid point position")
__g-question-number.step(level: 1)
[#hide[]<end-g-question-localization>]
__g-question-point.update(p =>
{
if point == none { 0 }
else { point }
})
locate(loc => {
let __g-question-point-position = point-position
if __g-question-point-position == none {
__g-question-point-position = __g-question-point-position-state.final(loc)
}
let __g-question-text-parameters = __g-question-text-parameters-state.final(loc)
if __g-question-point-position == left {
v(0.1em)
{
__g-question-number.display(__g-question-numbering)
if(point != none) {
__g-paint-tab(point:point, loc: loc)
h(0.2em)
}
}
set text(..__g-question-text-parameters)
body
}
else if __g-question-point-position == right {
v(0.1em)
if(point != none) {
place(right,
dx: 15%,
float: false,
__g-paint-tab(point: point, loc: loc))
}
__g-question-number.display(__g-question-numbering)
set text(..__g-question-text-parameters)
body
}
else {
v(0.1em)
__g-question-number.display(__g-question-numbering)
set text(..__g-question-text-parameters)
body
}
})
}
/// Show a sub-question.
///
/// *Example:*
/// ```
/// #g-subquestion(point:2)[This is a sub-question]
/// ```
///
/// - point (none, float): Points of the sub-question.
/// - point-position (none, left, right): Position of points. If none, use the position defined in G-Exam.
/// - body (string, content): Body of sub-question.
#let g-subquestion(
point: none,
point-position: none,
body) = {
assert(point-position in (none, left, right),
message: "Invalid point position")
__g-question-number.step(level: 2)
let subg-question-point = 0
if point != none { subg-question-point = point }
__g-question-point.update(p => p + subg-question-point )
locate(loc => {
let __g-question-point-position = point-position
if __g-question-point-position == none {
__g-question-point-position = __g-question-point-position-state.final(loc)
}
let __g-question-text-parameters = __g-question-text-parameters-state.final(loc)
if __g-question-point-position == left {
v(0.1em)
{
h(0.7em)
__g-question-number.display(__g-question-numbering)
if(point != none) {
__g-paint-tab(point: point, loc:loc)
h(0.2em)
}
}
set text(..__g-question-text-parameters)
body
}
else if __g-question-point-position == right {
v(0.1em)
if(point != none) {
place(right,
dx: 15%,
float: false,
__g-paint-tab(point: point, loc:loc))
}
{
h(0.7em)
__g-question-number.display(__g-question-numbering)
}
set text(..__g-question-text-parameters)
body
}
else {
v(0.1em)
{
h(0.7em)
__g-question-number.display(__g-question-numbering)
}
set text(..__g-question-text-parameters)
body
}
}
)
}
|
https://github.com/lyzynec/hys-or-kys | https://raw.githubusercontent.com/lyzynec/hys-or-kys/main/02/main.typ | typst | #import "../lib.typ": *
#knowledge[
#question(name: [Enumerate and explain the components of a Petri net
graph.])[]
#question(name: [Show how to encode the state of a system modelled by a
Petri net (graph).])[]
#question(name: [Write down a general form of state transition equations for
a Petri net.])[]
#question(name: [Explain how the untimed Petri net needs to be modified to
model a timed discrete-event system.])[]
]
#skills[
#question(name: [Create a model of a simple queing system in the form of a
Petri net.])[]
#question(name: [Find the firing times for transitions in a (simple) timed
Petri net.])[]
] |
|
https://github.com/MrAMS/FUJIFILM-X-T3-Note | https://raw.githubusercontent.com/MrAMS/FUJIFILM-X-T3-Note/master/FUJIFILM%20XT-3%20Note.typ | typst | #set text(
lang: "zh",
font: "Noto Serif CJK SC"
)
#set heading(numbering: "1.")
#show outline.entry.where(
level: 1
): it => {
v(12pt, weak: true)
strong(it)
}
#show outline.entry.where(
level: 2
): it => {
h(1em)
it
}
#let wordblock(term) = {
block(
fill: luma(230),
inset: 8pt,
radius: 4pt,
term,
)
}
#let amazed(term, color: blue) = {
text(color, box[✨ #term ✨])
}
#align(center, text(17pt)[
*富士XT-3个人实践*
])
#outline()
#pagebreak()
#show: rest => columns(2, rest)
= 曝光
== 光圈
光圈是用于控制镜头孔径大小的部件,通常用F值(镜头的焦距除以光圈口径)表示。
#figure(
image("imgs/F.png", width: 60%),
caption: [不同F值对应的光圈大小 @ref_pic_F],
) <F>
如@F 所示,F值越大,光圈越小,进光量越小。
#figure(
image("imgs/景深与光圈和焦距的关系.png", width: 80%),
caption: [景深与光圈的关系 @ref_pic_DOF],
) <DOF>
同时,F值越大,会导致景深越深,背景虚化效果越小。
#figure(
image("imgs/景深和焦距的关系.png", width: 80%),
caption: [景深与焦距的关系 @ref_pic_DOF],
) <DOF2>
值得注意的是,除了小F值(大光圈)能带来背景虚化效果之外,焦距更长、更近的拍摄距离也能带来更大的背景虚化效果。
富士相机支持*模式 A:光圈优先 AE*,此模式下相机会根据用户选择的光圈自动调整快门速度以获得理想曝光。
#figure(
image("imgs/模式A.png", width: 80%),
caption: [开启光圈优模式(A) @ref_pic_fujifilm_mode],
) <MODA>
== 快门
快门是照相机中控制曝光时间的重要元件,快门值N即表示快门时间为$1/N$秒。快门值越大,快门时间越短,进光量越少,照片越暗,但同时更容易捕捉到动作瞬间。
拍摄运动中的物体时,应该使用高速快门;但需要拍摄星轨,光绘等效果时,则需要使用低速快门。
富士相机支持*模式 S:快门优先 AE*,此模式下相机会根据用户选择的快门速度自动调整光圈以获得理想曝光,注意要将光圈调整至自动(A)。
#figure(
image("imgs/MODS.png", width: 80%),
caption: [开启快门优模式(S) @ref_pic_fujifilm_mode],
) <MODS>
除此之外,富士相机快门速度还支持长时间曝光的T门(T)、更长时间曝光的B门(B),建议使用三脚架。
== ISO
ISO即感光度,表示相机对光线的敏感度。
高ISO值可用于光线不足时提高照片亮度,但在较高值下会出现噪声、颗粒等问题。
#figure(
image("imgs/ISO和画面质量的关系.png", width: 80%),
caption: [不同ISO下的画面 @ref_pic_ISO],
) <ISO>
富士相机支持针对拍摄环境自动调整感光度。
#figure(
image("imgs/自动ISO.png", width: 50%),
caption: [自动感光度模式(A) @ref_pic_fujifilm_ISO],
) <ISO_MODA>
使用自动感光度模式下,相机自动在默认值和最大值之间选择感光度值;仅当获取理想曝光需要的快门速度将低于最低快门速度中的所选值时,感光度才会提高到默认值以上。@ref_pic_fujifilm_ISO 在*拍摄设置 > ISO 自动设定*有三个可自定义的自动ISO预设。
== 曝光补偿
#figure(
image("imgs/曝光补偿.png", width: 50%),
caption: [曝光补偿拨盘 @ref_pic_fujifilm_exposure],
) <ISO_M>
通过旋转曝光补偿拨盘调整曝光。如果采用光圈优模式(A),则相机自动调整快门速度;若为快门优模式(S),则自动调整光圈大小。
#v(2em)
= 胶片模拟
#figure(
image("imgs/胶片模拟坐标图.png", width: 100%),
caption: [富士胶片模拟坐标图 @ref_pic_fujifilm_film_simulation],
)
== PROVIA/标准
标准色彩。
== Velvia/鲜艳
高饱和度、高对比度。
#wordblock[
Velvia的精髓是通过更胜于现实的*色彩*向观者传达出特定的*情绪*。
The epitome of Velvia is the communication through *color* between the photographer and the viewer. There are certain emotions that only *"Image Color"* can deliver.@ref_pic_fujifilm_film_simulation_Velvia
]
== CLASSIC CHROME
低饱和度,暗部高对比度。
#wordblock[*克制*的色彩饱和度以彰显*故事*本身。
CLASSIC CHROME *omits* the element of color in order to make the *story* you want to tell stand out.@ref_pic_fujifilm_film_simulation_CLASSIC_CHROME]
== PRO Neg. Std
更柔和的色调,更柔和的肤色。依赖良好的灯光,需要更多时间精细考量,适合工作室肖像拍摄。
== PRO Neg. Hi
相较于PRO Neg. Std,*PRO Neg. Hi*拥有更鲜明的色调,但仍保持着柔和的肖像肤色,同时对灯光要求更宽容,适合街头、抓拍摄影。
== ASTIA/柔和
与PRO Neg.类似都是为了更柔和的肖像肤色,但*ASTIA*增加了暗部的对比度,对灯光的宽容度更高,并且饱和度更高,能更好体现出衣服的色彩。
== ETERNA/影院
使用色彩柔和且阴影较深的色调拍摄动画。
== ACROS
拍摄高渐变效果和高锐度的黑白照片。
#v(2em)
= 图像质量参数
此章介绍富士相机 *图像质量设置* 选项卡中的部分参数。
== 色彩
色彩的加减是整体饱和度的加减@ref_txt_settings,可以让颜色“更亮”。
== 白平衡
白平衡用于色调调节,原义是“在任何光源下都能将白色物体还原为白色”,不过也可以利用白平衡达到特殊的画面氛围效果。
富士相机可以自动调整白平衡,或者选择其他特定场景下的白平衡,见#link("https://fujifilm-dsc.com/zhs/manual/x-t3/menu_shooting/image_quality_setting/index.html")[手册详细描述]。
其中,色温是对光源色彩的一种客观衡量标准,以 Kelvin(K)表示。较低色温偏暖,带有黄色或红色氛围;而较高色温偏冷,带有蓝色调。
另外,当选择一个白平衡选项后,会显示微调白平衡界面,不同的白平衡偏移会带来不同的色彩风格,如@white_balance。
#figure(
image("imgs/白平衡偏移.png", width: 80%),
caption: [白平衡偏移 @ref_pic_white_balance],
) <white_balance>
== 锐度
锐化或柔化轮廓。锐度值越小,图片的梦幻感、蒙眬感更强。
== 降噪功能
降噪功能可以降低画面噪点,但是会增加画面“涂抹感”。在ISO值较低时,可以降低降噪值,让画面细节更丰富;在ISO值较高时,适当增加降噪值,以减少画面噪点@ref_txt_reduce_noise。
== 动态范围
用于恢复高光细节。较高值用于在拍摄高对比度场景(如包括阳光和较深阴影的场景)时降低高光区域的亮度,减少高光中细节的丢失。
值得注意的是,较高的动态范围会导致画质的轻微下降。
== 高光色调和阴影色调
降低高光色调即降低高光亮度,降低阴影色调即增加暗部亮度。可与*动态范围*叠加使用。
== D范围优先级
用于在拍摄高对比度场景时减少高光和阴影中细节的丢失,从而获取自然的效果@ref_txt_fujifilm_film_simulation_image_quality_setting
*D范围优先级*不能和*动态范围*以及*高光、阴影色调*叠加。选项 *强* 一档比*DR400*配合*高光-2阴影-2*在大光比场景下,效果更强@ref_txt_settings。
#v(2em)
#bibliography("ref.yml") |
|
https://github.com/LDemetrios/Typst4k | https://raw.githubusercontent.com/LDemetrios/Typst4k/master/src/test/resources/suite/syntax/escape.typ | typst | // Test escape sequences.
--- escape ---
// Escapable symbols.
\\ \/ \[ \] \{ \} \# \* \_ \+ \= \~ \
\` \$ \" \' \< \> \@ \( \) \A
// No need to escape.
( ) ;
// Escaped comments.
\//
\/\* \*\/
\/* \*/ *
// Unicode escape sequence.
\u{1F3D5} == 🏕
// Escaped escape sequence.
\u{41} vs. \\u\{41\}
// Some code stuff in text.
let f() , ; : | + - /= == 12 "string"
// Escaped dot.
10\. May
--- escape-invalid-codepoint ---
// Unicode codepoint does not exist.
// Error: 1-11 invalid Unicode codepoint: FFFFFF
\u{FFFFFF}
--- escape-unclosed ---
// Unterminated.
// Error: 1-6 unclosed Unicode escape sequence
\u{41[*Bold*]
|
|
https://github.com/EGmux/PCOM-2023.2 | https://raw.githubusercontent.com/EGmux/PCOM-2023.2/main/lista2/lista2q2.typ | typst |
=== Um sinal contínuo no tempo *$x(t)$* é obtido na saída de um filtro passa-baixas ideal com frequência de corte *$ω_c = 1000 π$* rad/s. Se um trem de impulsos for aplicado a*$x(t$*, quais dos seguintes períodos de amostragem garantem que*$x(t)$* pode ser recuperado a partir de suas amostras?
Ora se o filtro é passa baixas então ele corta qualquer espectro acima de $ω_c$ consequentemente
garantir a recuperação das amostras exige que $w_s$, taxa de amostragem em
rad/s, seja o dobro de $w_c$.
Além disso as alternativas só apresentam o período, mas sabemos que o período é
o inverso da frequência e que precisamos converter de radianos para Hz.
#math.equation(block: true, $ T = 1/F $)
#math.equation(block: true, $F = ω / (2 π )$)
no caso temos que o período mínimo para recuperação do sinal é de
#math.equation(block: true, $ T = (((1000 pi)/ (2 pi))^(-1))/2 = 1 dot 10^(-3) $)
lembremos que é o período do sinal, mas não o de sua amostragem, que deve ser o
dobro da frequência e consequentemente metade do período de $f_c$ o que
significa qualquer período menor que $1 dot 10^(-3) "s"$ deverá ser aceito visto
que a frequência de amostragem é maior que a de Nyquist.\
a) #math.equation(block: true, $ T = 0,5 dot 10^(-3) $)
pela justificativa acima a) deve ser aceito visto que é uma amostragem 2x mais
rápida que a de Nyquist, logo pelo teorema da amostragem aliasing não ocorre.
b) #math.equation(block: true, $ T = 2 dot 10^(-3) "s" $)
pela justificativa acima b) não deve ser aceita visto que é metade da frequência
de Nyquist, logo sobreposição irá ocorrer.
c) #math.equation(block: true, $ T = 10^(-4) "s" $)
pela justificativa acima c) deve ser aceita visto que é uma frequência ainda
maior que a)
|
|
https://github.com/soul667/typst | https://raw.githubusercontent.com/soul667/typst/main/PPT/typst-slides-fudan/themes/polylux/book/src/dynamic/alternatives.typ | typst | #import "../../../polylux.typ": *
#set page(paper: "presentation-16-9")
#set text(size: 40pt)
#polylux-slide[
#alternatives[Ann][Bob][Christopher]
likes
#alternatives[chocolate][strawberry][vanilla]
ice cream.
This sentence is a visual reference.
]
|
|
https://github.com/typst/packages | https://raw.githubusercontent.com/typst/packages/main/packages/preview/cetz/0.0.1/manual.typ | typst | Apache License 2.0 | #import "canvas.typ": canvas
#import "styles.typ"
#let canvas-background = gray.lighten(75%)
#let example(body, source, ..args, vertical: false) = {
block(if vertical {
align(
center,
stack(
dir: ttb,
spacing: 1em,
block(
canvas(body, ..args),
fill: canvas-background,
inset: 1em
),
align(left, source)
)
)
} else {
table(
columns: (auto, auto),
stroke: none,
fill: (x,y) => (canvas-background, none).at(x),
align: (x,y) => (center, left).at(x),
canvas(body, ..args),
source
)
}, breakable: false)
}
#let def-arg(term, type, default: none, description) = {
stack(dir: ltr, [/ #term: #type \ #description], align(right, if default != none {[(default: #default)]}))
}
#set page(
numbering: "1/1",
header: align(right)[The `CeTZ` package],
)
#set heading(numbering: "1.")
#set terms(indent: 1em)
#show link: set text(blue)
#let STYLING = heading(level: 4, numbering: none)[Styling]
#align(center, text(16pt)[*The `CeTZ` package*])
#align(center)[
#link("https://github.com/johannes-wolf")[<NAME>] and #link("https://github.com/fenjalien")[fenjalien] \
https://github.com/johannes-wolf/typst-canvas
]
#set par(justify: true)
#outline(indent: true, depth: 3)
#pagebreak(weak: true)
= Introduction
This package provides a way to draw stuff using a similar API to #link("https://processing.org/")[Processing] but with relative coordinates and anchors from #link("https://tikz.dev/")[Ti#[_k_]Z]. You also won't have to worry about accidentally drawing over other content as the canvas will automatically resize. And remember: up is positive!
The name CeTZ is a recursive acronym for "CeTZ, ein Typst Zeichenpacket" (german for "CeTZ, a Typst drawing package") and is pronounced like the word "Cats".
= Usage
This is the minimal starting point:
```typ
#import "@local/cetz:0.0.1"
#cetz.canvas({
import cetz.draw: *
...
})
```
Note that draw functions are imported inside the scope of the `canvas` block. This is recommended as draw functions override Typst's functions such as `line`.
== Argument Types
Argument types in this document are formatted in `monospace` and encased in angle brackets `<>`. Types such as `<integer>` and `<content>` are the same as Typst but additional are required:
/ `<coordinate>`: Any coordinate system. See @coordinate-systems.
/ `<number>`: `<integer> or <float>`
== Anchors <anchors>
Anchors are named positions relative to named elements.
To use an anchor of an element, you must give the element a name using the `name` argument.
#example({
import "draw.typ": *
circle((0,0), name: "circle")
fill(red)
stroke(none)
circle("circle.left", radius: 0.3)
},
[```typ
#canvas({
import "typst-canvas/draw.typ": *
// Name the circle
circle((0,0), name: "circle")
// Draw a smaller red circle at "circle"'s left anchor
fill(red)
stroke(none)
circle("circle.left", radius: 0.3)
})
```]
)
All elements will have default anchors based on their bounding box, they are: `center`, `left`, `right`, `above`/`top` and `below`/`bottom`, `top-left`, `top-right`, `bottom-left`, `bottom-right`. Some elements will have their own anchors.
Elements can be placed relative to their own anchors.
#example({
import "draw.typ": *
circle((0,0), anchor: "left")
fill(red)
stroke(none)
circle((0,0), radius: 0.3)
},
[```typ
#canvas({
import "typst-canvas/draw.typ": *
// An element does not have to be named
// in order to use its own anchors.
circle((0,0), anchor: "left")
// Draw a smaller red circle at the origin
fill(red)
stroke(none)
circle((0,0), radius: 0.3)
})
```]
)
= Draw Function Reference
== Canvas
```typ
#canvas(background: none, length: 1cm, debug: false, body)
```
#def-arg("background", `<color>`, default: "none", "A color to be used for the background of the canvas.")
#def-arg("length", `<length>`, default: "1cm", "Used to specify what 1 coordinate unit is.")
#def-arg("debug", `<bool>`, default: "false", "Shows the bounding boxes of each element when `true`.")
#def-arg("body", none, [A code block in which functions from `draw.typ` have been called.])
== Styling <styling>
You can style draw elements by passing the relevent named arguments to their draw functions. All elements have stroke and fill styling unless said otherwise.
#def-arg("fill", [`<color>` or `<none>`], default: "none", [How to fill the draw element.])
#def-arg("stroke", [`<none>` or `<auto>` or `<length>` \ or `<color>` or `<dicitionary>` or `<stroke>`], default: "black + 1pt", [How to stroke the border or the path of the draw element. See Typst's line documentation for more details: https://typst.app/docs/reference/visualize/line/#parameters-stroke])
#example({
import "draw.typ": *
// Draws a red circle with a blue border
circle((), fill: red, stroke: blue)
// Draws a green line
line((), (1,1), stroke: green)
},
[```typ
#cetz.canvas({
import cetz.draw: *
// Draws a red circle with a blue border
circle((0, 0), fill: red, stroke: blue)
// Draws a green line
line((0, 0), (1, 1), stroke: green)
})
```]
)
Instead of having to specify the same styling for each time you want to draw an element, you can use the `set-style` function to change the style for all elements after it. You can still pass styling to a draw function to override what has been set with `set-style`. You can also use the `fill()` and `stroke()` functions as a shorthand to set the fill and stroke respectively.
#example({
import "draw.typ": *
// Shows styling is applied after
rect((-1, -1), (1, 1))
// Shows how `set-style` works
set-style(stroke: blue, fill: red)
circle((0,0))
// Shows that styling can be overridden
line((), (1,1), stroke: green)
},
[```typ
#cetz.canvas({
import cetz.draw: *
// Draws an empty square with a black border
rect((-1, -1), (1, 1))
// Sets the global style to have a fill of red and a stroke of blue
set-style(stroke: blue, fill: red)
circle((0,0))
// Draws a green line despite the global stroke is blue
line((), (1,1), stroke: green)
})
```]
)
When using a dictionary for a style, it is important to note that they update each other instead of overriding the entire option like a non-dictionary value would do. For example, if the stroke is set to `(paint: red, thickness: 5pt)` and you pass `(paint: blue)`, the stroke would become `(paint: blue, thickness: 5pt)`.
#example({
import "draw.typ": *
set-style(stroke: (paint: red, thickness: 5pt))
line((0,0), (1,0))
line((0,0), (1,1), stroke: (paint: blue))
line((0,0), (0,1), stroke: yellow)
},
[```typ
#canvas({
import cetz.draw: *
// Sets the stroke to red with a thickness of 5pt
set-style(stroke: (paint: red, thickness: 5pt))
// Draws a line with the global stroke
line((0,0), (1,0))
// Draws a blue line with a thickness of 5pt because dictionaries update the style
line((0,0), (1,1), stroke: (paint: blue))
// Draws a yellow line with a thickness of 1pt because other values override the style
line((0,0), (0,1), stroke: yellow)
})
```]
)
You can also specify styling for each type of element. Note that dictionary values will still update with its global value, the full hierarchy is `function > element type > global`. When the value of a style is `auto`, it will become exactly its parent style.
#example({
import "draw.typ": *
set-style(
fill: green,
stroke: (thickness: 5pt),
rect: (stroke: (dash: "dashed"), fill: blue),
)
rect((0,0), (1,1))
circle((0.5, -1.5))
rect((0,-3), (1, -4), stroke: (thickness: 1pt))
},
[
```typ
#canvas({
import cetz.draw: *
set-style(
// Global fill and stroke
fill: green,
stroke: (thickness: 5pt),
// Stroke and fill for only rectangles
rect: (stroke: (dash: "dashed"), fill: blue),
)
rect((0,0), (1,1))
circle((0.5, -1.5))
rect((0,-3), (1, -4), stroke: (thickness: 1pt))
})
```])
#example({
import "draw.typ": *
set-style(
rect: (
fill: red,
stroke: none
),
line: (
fill: blue,
stroke: (dash: "dashed")
),
)
rect((0,0), (1,1))
line((0, -1.5), (0.5, -0.5), (1, -1.5), close: true)
circle((0.5, -2.5), radius: 0.5, fill: green)
},
[
```typ
// Its a nice drawing okay
#cetz.canvas({
import cetz.draw: *
set-style(
rect: (
fill: red,
stroke: none
),
line: (
fill: blue,
stroke: (dash: "dashed")
),
)
rect((0,0), (1,1))
line((0, -1.5), (0.5, -0.5), (1, -1.5), close: true)
circle((0.5, -2.5), radius: 0.5, fill: green)
})
```])
== Elements
=== Line
Draws a line (a direct path between two points) to the canvas. If multiplie coordinates are given, a line is drawn between each consecutive one.
```typ
#line(..pts, name: none, close: false, ..styling)
```
#def-arg("..pts", `<arguments of coordinates>`, [Coordinates to draw the lines between. A minimum of two must be given.])
#def-arg("name", `<string>`, [Sets the name of element for use with anchors.])
#def-arg("close", `<bool>`, default: false, [When `true` a straight line is drawn from the last coordinate to the first coordinate, essentially "closing" the shape.])
#example({
import "draw.typ": *
line((-1.5, 0), (1.5, 0))
line((0, -1.5), (0, 1.5))
},
[
```typ
#canvas({
import cetz.draw: *
line((-1.5, 0), (1.5, 0))
line((0, -1.5), (0, 1.5))
})
```])
#STYLING
#def-arg("mark", `<dictionary> or <auto>`, default: auto, [The styling to apply to marks on the line, see @marks.])
=== Rectangle
Draws a rectangle to the canvas.
```typ
#rect(a, b, name: none, anchor: none, ..styling)
```
#def-arg("a", `<coordinate>`, [The top left coordinate of the rectangle.])
#def-arg("b", `<coordinate>`, [The bottom right coordinate of the rectangle.])
#example({
import "draw.typ": *
rect((-1.5, 1.5), (1.5, -1.5))
},
[```typ
#canvas({
import cetz.draw: *
rect((-1.5, 1.5), (1.5, -1.5))
})
```])
=== Arc
Draws an arc to the canvas. Exactly two of the three values `start`, `stop`, and `delta` should be defined. You can set the radius of the arc by setting the `radius` style option. You can also draw an ellpitical arc by passing an array where the first number is the radius in the x direction and the second number is the radius in the y direction.
```typ
#arc(position, start: auto, stop: auto, delta: auto, name: none, anchor: none,)
```
#def-arg("position", `<coordinate>`, [The coordinate to start drawing the arc from.])
#def-arg("start", `<angle>`, [The angle to start the arc.])
#def-arg("stop", `<angle>`, [The angle to stop the arc.])
#def-arg("delta", `<angle>`, [The angle that is added to start or removed from stop.])
#example({
import "draw.typ": *
arc((0,0), start: 45deg, stop: 135deg)
arc((0,-0.5), start: 45deg, delta: 90deg, mode: "CLOSE")
arc((0,-1), stop: 135deg, delta: 90deg, mode: "PIE")
},
[```typ
#cetz.canvas({
import cetz.draw: *
arc((0,0), start: 45deg, stop: 135deg)
arc((0,-0.5), start: 45deg, delta: 90deg, mode: "CLOSE")
arc((0,-1), stop: 135deg, delta: 90deg, mode: "PIE")
})
```]
)
#STYLING
#def-arg("radius", `<number> or <array>`, default: 1, [The radius of the arc. This is also a global style shared with circle!])
#def-arg("mode", `<string>`, default: `"OPEN"`, [The options are "OPEN" (the default, just the arc), "CLOSE" (a circular segment) and "PIE" (a circular sector).])
=== Circle
Draws a circle to the canvas. An ellipse can be drawn by passing an array of length two to the `radius` argument to specify its `x` and `y` radii.
```typ
#circle(center, name: none, anchor: none)
```
#def-arg("center", `<coordinate>`, [The coordinate of the circle's origin.])
#example({
import "draw.typ": *
circle((0,0))
circle((0,-2), radius: (0.75, 0.5))
},
[```typ
#cetz.canvas({
import cetz.draw: *
circle((0,0))
// Draws an ellipse
circle((0,-2), radius: (0.75, 0.5))
})
```]
)
#STYLING
#def-arg("radius", `<number> or <length> or <array of <number> or <length>>`, default: "1", [The circle's radius. If an array is given an ellipse will be drawn where the first item is the `x` radius and the second item is the `y` radius. This is also a global style shared with arc!])
=== Bezier
Draws a bezier curve with 1 or 2 control points to the canvas.
```typ
#bezier(start, end, ..ctrl-style)
```
#def-arg("start", `<coordinate>`, "The coordinate to start drawing the bezier curve from.")
#def-arg("end", `<coordinate>`, "The coordinate to draw the bezier curve to.")
#def-arg("..ctrl-style", `<coordinates>`, "An argument sink for the control points and styles. Its positional part should be of one or two coordinates to specify the contorl points of the bezier curve.")
#example({
import "draw.typ": *
bezier((0, 0), (2, 0), (1, 1))
bezier((0, -1), (2, -1), (.5, -2), (1.5, 0))
},
[```typ
#cetz.canvas({
import cetz.draw: *
bezier((0, 0), (2, 0), (1, 1))
bezier((0, -1), (2, -1), (.5, -2), (1.5, 0))
})
```]
)
=== Content
Draws a content block to the canvas.
```typ
#content(pt, ct, angle: 0deg, name: none, anchor: none)
```
#def-arg("pt", `<coordinate>`, "The coordinate of the center of the content block.")
#def-arg("ct", `<content>`, "The content block.")
#def-arg("angle", `<angle>`, [The angle to rotate the content block by. Uses Typst's `rotate` function.])
#example({
import "draw.typ": *
content((0,0), [Hello World!])
},
[```typ
#cetz.canvas({
import cetz.draw: *
content((0,0), [Hello World!])
})
```]
)
#STYLING
This draw element is not affected by fill or stroke styling.
#def-arg("padding", `<length>`, default: 0em, "")
=== Grid
Draws a grid to the canavas.
```typ
#grid(from, to, step: 1, help-lines: false, name: none)
```
#def-arg("from", `<coordinate>`, "Specifies the bottom left position of the grid.")
#def-arg("to", `<coordinate>`, "Specifies the top right position of the grid.")
#def-arg("step", `<number> or <length> or <array of <number> or <length>>`, [The stepping in both $x$ and $y$ directions. An array can be given to specify the stepping for each direction.])
#def-arg("help-lines", `<bool>`, default: "false", [Styles the grid to look "subdued" by using thin gray lines (`0.2pt + gray`)])
#example({
import "draw.typ": *
grid((0,0), (3,3), help-lines: true)
},
[```typ
#cetz.canvas({
import cetz.draw: *
grid((0,0), (3,2), help-lines: true)
})
```]
)
=== Mark <marks>
Draws a mark or "arrow head", its styling influences marks being drawn on paths (e.g. lines).
```
#mark(from, to, ..style)
```
#example({
import "draw.typ": *
line((1, -1), (1, 5), stroke: (paint: gray, dash: "dotted"))
set-style(mark: (fill: black))
line((0, 4), (1, 4), mark: (end: "<>"))
line((0, 3), (1, 3), mark: (end: "o"))
line((0, 2), (1, 2), mark: (end: "|"))
line((0, 1), (1, 1), mark: (end: "<"))
line((0, 0), (1, 0), mark: (end: ">"))
},
[```typ
#cetz.canvas({
import cetz.draw: *
line((1, -1), (1, 5), stroke: (paint: gray, dash: "dotted"))
set-style(mark: (fill: black))
line((0, 4), (1, 4), mark: (end: "<>"))
line((0, 3), (1, 3), mark: (end: "o"))
line((0, 2), (1, 2), mark: (end: "|"))
line((0, 1), (1, 1), mark: (end: "<"))
line((0, 0), (1, 0), mark: (end: ">"))
})
```]
)
#STYLING
#def-arg("symbol", `<string>`, default: ">", [The type of mark to draw when using the `mark` function.])
#def-arg("start", `<string>`, [The type of mark to draw at the start of a path.])
#def-arg("end", `<string>`, [The type of mark to draw at the end of a path.])
#def-arg("size", `<number>`, default: "0.15", [The size of the marks.])
== Groups <groups>
Groups allow scoping context changes such as setting stroke-style, fill and transformations.
```typ
#group(content, name: none)
```
#example({
import "draw.typ": *
group({
stroke(5pt)
scale(.5); rotate(45deg)
rect((-1,-1),(1,1))
})
rect((-1,-1),(1,1))
}, ```typ
// Create group
group({
stroke(5pt)
scale(.5); rotate(45deg)
rect((-1,-1),(1,1))
})
rect((-1,-1),(1,1))
```)
== Transformations
All transformation functions push a transformation matrix onto the current transform stack.
To apply transformations scoped use a `group(...)` object.
=== Translate
```typ
#translate(coordinate)
```
#example({
import "draw.typ": *
rect((0,0), (2,2))
translate((.5,.5,0))
rect((0,0), (1,1))
}, ```typ
// Outer rect
rect((0,0), (2,2))
// Inner rect
translate((.5,.5,0))
rect((0,0), (1,1))
```)
=== Set Origin
```typ
#set-origin(position)
```
#example({
import "draw.typ": *
rect((0,0), (2,2), name: "r")
set-origin("r.above")
circle((0, 0), radius: .1)
}, ```typ
// Outer rect
rect((0,0), (2,2), name: "r")
// Move origin to top edge
set-origin("r.above")
circle((0, 0), radius: .1)
```)
=== Rotate
```typ
#rotate(axis-dictionary)
#rotate(z-angle)
```
#example({
import "draw.typ": *
rotate((z: 45deg))
rect((-1,-1), (1,1))
rotate((y: 80deg))
circle((0,0))
}, ```typ
// Rotate on z-axis
rotate((z: 45deg))
rect((-1,-1), (1,1))
// Rotate on y-axis
rotate((y: 80deg))
circle((0,0))
```)
=== Scale
```typ
#scale(axis-dictionary)
#scale(factor)
```
#example({
import "draw.typ": *
scale((x: 1.8))
circle((0,0))
}, ```typ
// Scale x-axis
scale((x: 1.8))
circle((0,0))
```)
= Coordinate Systems <coordinate-systems>
A _coordinate_ is a position on the canvas on which the picture is drawn. They take the form of dictionaries and the following sub-sections define the key value pairs for each system. Some systems have a more implicit form as an array of values and `CeTZ` attempts to infer the system based on the element types.
== XYZ <coordinate-xyz>
Defines a point `x` units right, `y` units upward, and `z` units away.
#def-arg("x", [`<number>` or `<length>`], default: 0, [The number of units in the `x` direction.])
#def-arg("y", [`<number>` or `<length>`], default: 0, [The number of units in the `y` direction.])
#def-arg("z", [`<number>` or `<length>`], default: 0, [The number of units in the `z` direction.])
The implicit form can be given as an array of two or three `<number>` or `<length>`, as in `(x,y)` and `(x,y,z)`.
#example(
{
import "draw.typ": *
line((0, 0), (x: 1))
line((0, 0), (y: 1))
line((0, 0), (z: 1))
// Implicit form
line((0, -2), (1, -2))
line((0, -2), (0, -1, 0))
line((0, -2), (0, -2, 1))
},
[```typ
#import "@local/cetz:0.0.1"
#cetz.canvas({
import cetz.draw: *
line((0,0), (x: 1))
line((0,0), (y: 1))
line((0,0), (z: 1))
// Implicit form
line((0, -2), (1, -2))
line((0, -2), (0, -1, 0))
line((0, -2), (0, -2, 1))
})
```]
)
== Previous <previous>
Use this to reference the position of the previous coordinate passed to a draw function. This will never reference the position of a coordinate used in to define another coordinate. It takes the form of an empty array `()`. The previous position initially will be `(0, 0, 0)`.
#example(
{
import "draw.typ": *
line((0,0), (1, 1))
circle(())
},
[```typ
#import "@local/cetz:0.0.1"
#cetz.canvas({
import cetz.draw: *
line((0,0), (1, 1))
// Draws a circle at (1,1)
circle(())
})
```]
)
== Relative <coordinate-relative>
Places the given coordinate relative to the previous coordinate. Or in other words, for the given coordinate, the previous coordinate will be used as the origin. Another coordinate can be given to act as the previous coordinate instead.
#def-arg("rel", `<coordinate>`, "The coordinate to be place relative to the previous coordinate.")
#def-arg("update", `<bool>`, default: true, "When false the previous position will not be updated.")
#def-arg("to", `<coordinate>`, default: (), "The coordinate to treat as the previous coordinate.")
In the example below, the red circle is placed one unit below the blue circle. If the blue circle was to be moved to a different position, the red circle will move with the blue circle to stay one unit below.
#example({
import "draw.typ": *
circle((0, 0), stroke: blue)
circle((rel: (0, -1)), stroke: red)
},
[```typ
#import "@local/cetz:0.0.1"
#cetz.canvas({
import cetz.draw: *
circle((0, 0), stroke: blue)
circle((rel: (0, -1)), stroke: red)
})
```]
)
== Polar
Defines a point a `radius` distance away from the origin at the given `angle`. An angle of zero degrees. An angle of zero degrees is to the right, a degree of 90 is upward.
#def-arg("angle", `<angle>`, [The angle of the coordinate.])
#def-arg("radius", `<number> or <length> or <array of length or number>`, [The distance from the origin. An array can be given, in the form `(x, y)` to define the `x` and `y` radii of an ellipse instead of a circle.])
#example(
{
import "draw.typ": *
line((0,0), (angle: 30deg, radius: 1cm))
},
[```typ
#import "@local/cetz:0.0.1"
#cetz.canvas({
import cetz.draw: *
line((0,0), (angle: 30deg, radius: 1cm))
})
```]
)
The implicit form is an array of the angle then the radius `(angle, radius)` or `(angle, (x, y))`.
#example(
{
import "draw.typ": *
line((0,0), (30deg, 1), (60deg, 1), (90deg, 1), (120deg, 1), (150deg, 1), (180deg, 1),)
},
[```typ
#import "@local/cetz:0.0.1"
#cetz.canvas({
import cetz.draw: *
line((0,0), (30deg, 1), (60deg, 1),
(90deg, 1), (120deg, 1), (150deg, 1), (180deg, 1))
})
```]
)
== Barycentric
In the barycentric coordinate system a point is expressed as the linear combination of multiple vectors. The idea is that you specify vectors $v_1$, $v_2$ ..., $v_n$ and numbers $alpha_1$, $alpha_2$, ..., $alpha_n$. Then the barycentric coordinate specified by these vectors and numbers is $ (alpha_1 v_1 + alpha_2 v_1 + dots.c + alpha_n v_n)/(alpha_1 + alpha_2 + dots.c + alpha_n) $
#def-arg("bary", `<dictionary>`, [A dictionary where the key is a named element and the value is a `<float>`. The `center` anchor of the named element is used as $v$ and the value is used as $a$.])
#example(
vertical: true,
{
import "draw.typ": *
circle((90deg, 3), radius: 0, name: "content")
circle((210deg, 3), radius: 0, name: "structure")
circle((-30deg, 3), radius: 0, name: "form")
for (c, a) in (("content", "bottom"), ("structure", "top-right"), ("form", "top-left")) {
content(c, box(c + " oriented", inset: 5pt), anchor: a)
}
stroke(gray + 1.2pt)
line("content", "structure", "form", close: true)
for (c, s, f, cont) in (
(0.5, 0.1, 1, "PostScript"),
(1, 0, 0.4, "DVI"),
(0.5, 0.5, 1, "PDF"),
(0, 0.25, 1, "CSS"),
(0.5, 1, 0, "XML"),
(0.5, 1, 0.4, "HTML"),
(1, 0.2, 0.8, "LaTeX"),
(1, 0.6, 0.8, "TeX"),
(0.8, 0.8, 1, "Word"),
(1, 0.05, 0.05, "ACII")
) {
content((bary: (content: c, structure: s, form: f)), cont)
}
},
[```typ
#import "@local/cetz:0.0.1"
#cetz.canvas({
import cetz.draw: *
circle((90deg, 3), radius: 0, name: "content")
circle((210deg, 3), radius: 0, name: "structure")
circle((-30deg, 3), radius: 0, name: "form")
for (c, a) in (
("content", "bottom"),
("structure", "top-right"),
("form", "top-left")
) {
content(c, box(c + " oriented", inset: 5pt), anchor: a)
}
stroke(gray + 1.2pt)
line("content", "structure", "form", close: true)
for (c, s, f, cont) in (
(0.5, 0.1, 1, "PostScript"),
(1, 0, 0.4, "DVI"),
(0.5, 0.5, 1, "PDF"),
(0, 0.25, 1, "CSS"),
(0.5, 1, 0, "XML"),
(0.5, 1, 0.4, "HTML"),
(1, 0.2, 0.8, "LaTeX"),
(1, 0.6, 0.8, "TeX"),
(0.8, 0.8, 1, "Word"),
(1, 0.05, 0.05, "ACII")
) {
content((bary: (content: c, structure: s, form: f)), cont)
}
})
```]
)
== Anchor
Defines a point relative to a named element using anchors, see @anchors.
#def-arg("name", `<string>`, [The name of the element that you wish to use to specify a coordinate.])
#def-arg("anchor", `<string>`, [An anchor of the element. If one is not given a default anchor will be used. On most elements this is `center` but it can be different.])
You can also use implicit syntax of a dot seperated string in the form `"name.anchor"`.
#example(
{
import "draw.typ": *
line((0,0), (3,2), name: "line")
circle("line.end", name: "circle")
rect("line.start", "circle.left")
},
[```typ
#import "@local/cetz:0.0.1"
#cetz.canvas({
import cetz.draw: *
line((0,0), (3,2), name: "line")
circle("line.end", name: "circle")
rect("line.start", "circle.left")
})
```]
)
== Tangent
This system allows you to compute the point that lies tangent to a shape. In detail, consider an element and a point. Now draw a straight line from the point so that it "touches" the element (more formally, so that it is _tangent_ to this element). The point where the line touches the shape is the point referred to by this coordinate system.
#def-arg("element", `<string>`, [The name of the element on whose border the tangent should lie.])
#def-arg("point", `<coordinate>`, [The point through which the tangent should go.])
#def-arg("solution", `<integer>`, [Which solution should be used if there are more than one.])
A special algorithm is needed in order to compute the tangent for a given shape. Currently it does this by assuming the distance between the center and top anchor (See @anchors) is the radius of a circle.
#example(
{
import "draw.typ": *
grid((0,0), (3,2), help-lines: true)
circle((3,2), name: "a", radius: 2pt)
circle((1,1), name: "c", radius: 0.75)
content("c", $ c $)
stroke(red)
line(
"a",
(element: "c", point: "a", solution: 1),
"c",
(element: "c", point: "a", solution: 2),
close: true
)
},
[```typ
#import "@local/cetz:0.0.1"
#cetz.canvas({
import cetz.draw: *
grid((0,0), (3,2), help-lines: true)
circle((3,2), name: "a", radius: 2pt)
circle((1,1), name: "c", radius: 0.75)
content("c", $ c $)
stroke(red)
line(
"a",
(element: "c", point: "a", solution: 1),
"c",
(node: "c", point: "a", solution: 2),
close: true
)
})
```]
)
== Perpendicular
Can be used to find the intersection of a vertical line going through a point $p$ and a horizontal line going through some other point $q$.
#def-arg("horizontal", `<coordinate>`, [The coordinate through which the horizontal line passes.])
#def-arg("vertical", `<coordinate>`, [The coordinate through which the vertical line passes.])
You can use the implicit syntax of `(horizontal, "-|", vertical)` or `(vertical, "|-", horizontal)`
#example(
{
import "draw.typ": *
content((30deg, 1), $ p_1 $, name: "p1")
content((75deg, 1), $ p_2 $, name: "p2")
line((-0.2, 0), (1.2, 0), name: "xline")
content("xline.end", $ q_1 $, anchor: "left")
line((2, -0.2), (2, 1.2), name: "yline")
content("yline.end", $ q_2 $, anchor: "bottom")
line("p1", (horizontal: (), vertical: "xline"))
line("p1", (vertical: (), horizontal: "yline"))
// Implicit form
line("p2", ((), "|-", "xline"))
line("p2", ((), "-|", "yline"))
},
[```typ
#import "@local/cetz:0.0.1"
#cetz.canvas({
import cetz.draw: *
content((30deg, 1), $ p_1 $, name: "p1")
content((75deg, 1), $ p_2 $, name: "p2")
line((-0.2, 0), (1.2, 0), name: "xline")
content("xline.end", $ q_1 $, anchor: "left")
line((2, -0.2), (2, 1.2), name: "yline")
content("yline.end", $ q_2 $, anchor: "bottom")
line("p1", (horizontal: (), vertical: "xline"))
line("p2", (horizontal: (), vertical: "xline"))
line("p1", (vertical: (), horizontal: "yline"))
line("p2", (vertical: (), horizontal: "yline"))
})
```]
)
== Interpolation
Use this to linearly interpolate between two coordinates `a` and `b` with a given factor `number`. If `number` is a `<length>` the position will be at the given distance away from `a` towards `b`.
An angle can also be given for the general meaning: "First consider the line from `a` to `b`. Then rotate this line by `angle` around point `a`. Then the two endpoints of this line will be `a` and some point `c`. Use this point `c` for the subsequent computation."
#def-arg("a", `<coordinate>`, [The coordinate to interpolate from.])
#def-arg("b", `<coordinate>`, [The coordinate to interpolate to.])
#def-arg("number", [`<number>` or `<length>`], [The factor to interpolate by or the distance away from `a` towards `b`.])
#def-arg("angle", `<angle>`, default: 0deg, "")
Can be used implicitly as an array in the form `(a, number, b)` or `(a, number, angle, b)`.
#example(
{
import "draw.typ": *
grid((0,0), (3,3), help-lines: true)
line((0,0), (2,2))
for i in (0, 0.2, 0.5, 0.9, 1, 1.5) {
content(((0,0), i, (2,2)), [#i])
}
},
[```typ
#import "@local/cetz:0.0.1"
#cetz.canvas({
import cetz.draw: *
grid((0,0), (3,3), help-lines: true)
line((0,0), (2,2))
for i in (0, 0.2, 0.5, 0.9, 1, 1.5) {
content(((0,0), i, (2,2)), [#i])
}
})
```]
)
#example(
{
import "draw.typ": *
grid((0,0), (3,3), help-lines: true)
line((1,0), (3,2))
line((1,0), ((1, 0), 1, 10deg, (3,2)))
fill(red)
stroke(none)
circle(((1, 0), 0.5, 10deg, (3, 2)), radius: 2pt)
},
[```typ
#import "@local/cetz:0.0.1"
#cetz.canvas({
import cetz.draw: *
grid((0,0), (3,3), help-lines: true)
line((1,0), (3,2))
line((1,0), ((1, 0), 1, 10deg, (3,2)))
fill(red)
stroke(none)
circle(((1, 0), 0.5, 10deg, (3, 2)), radius: 2pt)}
})
```]
)
#example(
{
import "draw.typ": *
grid((0,0), (4,4), help-lines: true)
fill(black)
stroke(none)
let n = 16
for i in range(0, n+1) {
circle(((2,2), i / 8, i * 22.5deg, (3,2)), radius: 2pt)
}
},
[```typ
#import "@local/cetz:0.0.1"
#cetz.canvas({
import cetz.draw: *
grid((0,0), (4,4), help-lines: true)
fill(black)
stroke(none)
let n = 16
for i in range(0, n+1) {
circle(((2,2), i / 8, i * 22.5deg, (3,2)), radius: 2pt)
}
})
```]
)
You can even chain them together!
#example(
{
import "draw.typ": *
grid((0,0), (3, 2), help-lines: true)
line((0,0), (3,2))
stroke(red)
line(((0,0), 0.3, (3,2)), (3,0))
fill(red)
stroke(none)
circle(
(
// a
(((0, 0), 0.3, (3, 2))),
0.7,
(3,0)
),
radius: 2pt
)
},
[```typ
#import "@local/cetz:0.0.1"
#cetz.canvas({
import cetz.draw: *
grid((0,0), (3, 2), help-lines: true)
line((0,0), (3,2))
stroke(red)
line(((0,0), 0.3, (3,2)), (3,0))
fill(red)
stroke(none)
circle(
(
// a
(((0, 0), 0.3, (3, 2))),
0.7,
(3,0)
),
radius: 2pt
)
})
```]
)
#example(
{
import "draw.typ": *
grid((0,0), (3, 2), help-lines: true)
line((1,0), (3,2))
for (l, c) in ((0cm, "0cm"), (1cm, "1cm"), (15mm, "15mm")) {
content(((1,0), l, (3,2)), $ #c $)
}
},
[```typ
#import "@local/cetz:0.0.1"
#cetz.canvas({
import cetz.draw: *
grid((0,0), (3, 2), help-lines: true)
line((1,0), (3,2))
for (l, c) in ((0cm, "0cm"), (1cm, "1cm"), (15mm, "15mm")) {
content(((1,0), l, (3,2)), $ #c $)
}
})
```]
)
== Function
An array where the first element is a function and the rest are coordinates will cause the function to be called with the resolved coordinates. The resolved coordinates have the same format as the implicit form of the 3-D XYZ coordinate system, @coordinate-xyz.
The example below shows how to use this system to create an offset from an anchor, however this could easily be replaced with a relative coordinate with the `to` argument set, @coordinate-relative.
#example(
{
import "draw.typ": *
circle((0, 0), name: "c")
fill(red)
circle((v => vector.add(v, (0, -1)), "c.right"), radius: 0.3)
},
[```typ
#import "@local/cetz:0.0.1"
#cetz.canvas({
import cetz.draw: *
circle((0, 0), name: "c")
fill(red)
circle((v => cetz.vector.add(v, (0, -1)), "c.right"), radius: 0.3)
})
```]
)
|
https://github.com/typst/packages | https://raw.githubusercontent.com/typst/packages/main/packages/preview/cetz/0.2.0/src/draw.typ | typst | Apache License 2.0 | #import "draw/grouping.typ": intersections, group, anchor, copy-anchors, place-anchors, set-ctx, get-ctx, for-each-anchor, on-layer, place-marks, hide
#import "draw/transformations.typ": set-transform, rotate, translate, scale, set-origin, move-to, set-viewport
#import "draw/styling.typ": set-style, fill, stroke
#import "draw/shapes.typ": circle, circle-through, arc, arc-through, mark, line, grid, content, rect, bezier, bezier-through, catmull, hobby, merge-path
|
https://github.com/lucannez64/Notes | https://raw.githubusercontent.com/lucannez64/Notes/master/Vectors%20Formula.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: "Vectors Formula",
authors: (
"<NAME>",
),
date: "30 Octobre, 2023",
)
#set heading(numbering: "1.1.")
= Vectors Formula
<vectors-formula>
Here are some of the main formulas associated with vectors:
Vector addition: v + w \= (v1 + w1)i + (v2 + w2)j + (v3 + w3)k Scalar
multiplication: kv \= k(v1)i + k(v2)j + k(v3)k Dot product: v • w \=
(v1w1) + (v2w2) + (v3w3) Cross product: v x w \= (v2w3 - v3w2)i + (v3w1
- v1w3)j + (v1w2 - v2w1)k where v and w are vectors, and v1, v2, and v3,
and w1, w2, and w3 are the components of the vectors in the x, y, and z
directions, respectively. These formulas provide a way to manipulate
vectors using mathematical operations, and are an important part of
vector algebra and vector calculus.
|
|
https://github.com/liuguangxi/suiji | https://raw.githubusercontent.com/liuguangxi/suiji/main/src/chinese.typ | typst | MIT License | //==============================================================================
// Blind text (Lorem ipsum) generator for Chinese
//
// Public functions:
// rand-sc
//==============================================================================
#import "random-fast.typ": gen-rng-f, integers-f, choice-f
//----------------------------------------------------------
// Private parameters
//----------------------------------------------------------
// Common Simplified Chinese characters (3500)
#let SC-CHARS = (
"乙一乃丁卜刀九了七八厂儿二几力人入十又久丸丈乞乡勺刃亏凡卫亿亡叉川寸弓巾女尸士夕么万三上下与习也之义于个千及大飞干工广己已口马门山才土小子",
"丰乏乌丹予丑勾勿匀厅允互井云匹凤冈劝凶仓介仇仅仆仁仍升午订双友艺屯夫巨币尺扎巴忆幻尤孔贝父户斤木牛欠犬氏瓦牙止爪中书无不专为公六历切元五区队内办从今以化什计认反太天引开少比长车斗方风火见毛片气日手水王文心月支分",
"卡册乎乐丘丙丛丝匆占厉刊兄兰印功击令付仙仪仔仗让讨讯训辽失央巧左归帅叨叼叮句古另叶司台叹右召闪宁奶奴犯尼饥扒扑扔汉汇汁纠圣幼冬孕轧灭斥末未旦旧礼永甘瓜禾矛母鸟皮甲申田穴甩玉业东且世主包北加务写出代们他半去记议发节边对头平布市号叫可史只它打四外处本术民必正白立龙目生石示电由用",
"乓乒乔丢买兴冰冲厌创刚刘刑兆亚匠防邪阳阴阵网劣企伞仰伐仿伏伙伤似伟伪伍休优协充亦访讽讲延芒芝巡州迈迁迅寺寻夺夹夸巩异庆庄帆师吃吊吓吉吗吐吸驰闭闯守宇宅妇奸妈妄岂岁屿尽壮扛扣扩扫托扬执池汗汤污纪纤圾尘尖忙孙字负贞毕轨死危爷戏灯灰考朵朴杀朽杂朱欢旬早旨曲肌臣虫耳齐肉舌羽舟竹页衣血羊份共决压争划列则光先阶那关再动军农会众传价件任全华产交论设许达过导并年当合各后名同向问安好如她江红级约场地在回团因多式存成观老机权收次有此百而米色西行至自",
"串丽乱兵冻冷冶初免龟判删医阿陈附邻陆邮阻卵助劫劲励努余伯伴佛估伶伸佣亩词评诉译诊苍芳芦芹苏芽彻役迟返违迎远寿弟弄弃床库序希帐吧吵呈吹呆吨否告含吼君启吞呜吴呀驳驴驱闷闲宏宋妨妙妥妖狂犹岔岛岗尿尾饭饮壳扮抄扯抖扶抚护拒抗扭抛批抢扰折投找抓沉泛沟汽沙沈汪沃纯纺纲纳纽纱纹纸纵坝坊坏坚均坑块坛址坐困围园怀忧孝财贡歼戒灿灵灾灶材村杜杆杠李束杏杨牢攻旱旷忌忍忘肠肚肝皂私秃秀钉针盯疗鸡男穷补良辰赤豆谷麦辛言足吩坟纷芬两严况别利际即却劳但低何你体位住作克县识证花还进近连运这张应听员间完形层局声把报技没快我极来条改状时社求志更步每究系角里身走",
"乖丧乳典净卧厕券兔刺刮剂刻刷降郊郎陕限郑凯凭势侧供佳佩侨侍依侦侄卖享诚诞诗试详询叔范苦茄茎茅茂苗苹若英彼径征迫述奔奉奇幸弦底店废庙录帘帖帜咐呼呢味咏驾驶驼驻闹闸宝官审宜宙宗姑姐妹妻姓狗狐岸岭岩届居屈饱饰饲拔拌抱拨拆抽担抵拐拣拘拦拢抹拍披抬拖押拥择招波泊沸河浅泪沫泥泡泼泄泻沿泳泽沾注练绍终垂垃垄坡坦固夜尚怖怪怜怕孤季孟败贩贯货贫贪贤责购轰轮软卷爸房炒炊炕炉炎视斧斩板杯柜杰枪松析枣枕枝牧版欧欣昂昌昏昆旺承环玩忽念态忠肥肺肤服股肩肯朋肾胁胀肢肿武爬秆钓盲鸣码罗畅画衬衫艰虎虏舍肃齿隶鱼雨顶顷奋事其具到制些例使单参京该话建变取受往府和命周定实始委拉法油治经细线织组国图性备学质转或所规现者构果林物放明易育的直矿知空采非金青表",
"临举厚厘剑剃削陡险卸冒勉勇冠促俘俭俊俩侵俗侮修亮亭诵误诱语叛叙草茶荡荒茧荐茫荣药待迹迷逆送逃退追封奖奏差弯庭帮帝哀哈咳哄哗哪咸哑咽咬咱骄骆骂阀阁闻宫客室宪宣姜娇姥娃威姨姻姿独狠狡狮狭狱峡屋饼饺饶挡挂挥挤挎括挠挪拼拾拴挑挺挖挣测洞洪浑浇洁津浓洽洒洗洋洲浊绑绘绞绝络绕绒巷城垫垦垮垒尝恨恒恢恼恰孩贷费贵贺贱贸贴轻残殃施扁炮烂炼炭炸既觉览柏柄栋架枯栏柳某染柔柿树柱牵牲故春显星映昼昨神祝祖拜泉玻珍怠急怒怨怎胞背胆胡脉胖胜胃歪皇皆甚秒秋钞钢钩钥钟竖盆盈毒盾眉盼眨疤疮疯疫鸦砍砌砖矩罚畏穿窃突袄虾虹蚂蚀虽蚁耐耍缸竿赴赵趴食骨鬼首香项顺美前除院养保便信南亲说很律适选将度带品响按持指活济派给结统型复点战标查政是段思总种科看省相研界类要重革面音须",
"乘羞凉剥剧剖匪陵陪陶陷兼冤倍倡倘倒俯健借俱倦倾倚债读课谅请谁谊诸谈荷获莲莫徒徐递逗逢逝透途逐射套弱座席啊唉唇哥唤哭哨唐哲阅宾害宽宵宴宰娘娱狼狸峰屑饿壶挨捕换捡捐捆捞捏捎损挽振捉涌浮浩浸浪涝润涉涛涂浴涨浙继绢绣埋恭悔悄悟悦夏贿贼毙烈轿载殊旁旅爹扇烦烘烤烧烫烟烛笔案柴档桂核桨校框栗桥桑桃桐栽株桌牺敌氧晃晋晒晌晓晕祥拿拳浆泰瓶班珠恶恩恳恐恋息脆胳脊胶朗脑胸脏脂爱秘秤秧秩租铃铅钱钳钻竞站监盐益盏眠病疾疲疼症鸭皱础破罢畜留窄袜袍袖蚕蚊耻耽缺虑耕耗紧索艳翅翁致舱航舰笋笑臭辱躬酒配赶顾顽顿预衰粉准原党部都候值调速通造验家容展海流消圆离资热较料格根样特效能称积铁真被素般起难高",
"匙凑减剪副隆随隐兽勒偿假偶偏停偷谎谜谋菠菜菊菌萝萌萍萄营著逮弹康廊庸唱啦售唯啄骑寄寇密宿婚婆婶猜猎猫猛猪崇崖崭彩屠馆馅掉捷掘控掠描排捧授探掏推掀掩淡混渐淋渠渗淘添淹液渔绸绩绿绵绳绪续堵堆培堂域圈够惭惨悼惯惊惧惕惜辅辆斜旋戚毫检梨梁梅梦梢梳梯桶械犁敢救敏欲晨晚祸球患您悉悬悠爽脖脚脸脱望甜移铲铜银竟章笼盛盗盖盒盘眯睁痕痒鸽票略窑蛋蛇聋职虚粗粒粘累衔船笨笛符野距跃雪雀黄鹿麻颈袭袋做得常商接据清深维基情族断教理眼着率第象领",
"羡厨厦割剩隔隙傲傍储傅博谦谢谣葱董葛葵落葡葬循御逼遍遗遇尊奥幅帽喘喊喝喉喇喷善喂喜骗阔富寒嫂猴猾屡馋插搭搁搅揭揪搂揉搜握援渡溉港湖滑渴湿湾游渣滋编缎缓缘堡塔堤堪悲惰慌慨愧禽愉赌赔赏焦煮辈辉殖焰毯棒棍椒棵棉棚棋森椅植棕牌敞敬散款欺晶景普晴暑暂智掌琴斑惩惠惑惹曾替朝腊脾腔登稍税稀锄锋锅链铺锐锁销锈铸童痛鹅硬短番窗窜窝疏裤裙裕蛮蜓蛙蛛粥絮紫舒艇策答筋筐筛筒筝筑释辜超趁趋跌践跑鲁雄雅雁黑颂街裁裂愤粪道强属提温就然斯最期程确联等量越集题装",
"鄙障勤催傻像谨叠蓝蒙蓬蒜蓄蒸微遣遥廉幕嗓嫁嫌摆搬搏搞摸摄摊携摇滨滚滥溜滤漠滩滔溪源缠缝墓塞塑塌塘填慎赖煎输煌煤楚概槐楼榆歇献暗暖福殿毁瑞愁慈愚愈腹腾腿腥腰稠锤错键锦锯锣锡盟睬督睛睡痰鹊碍碑碌碰碎碗矮禁罩罪蛾蜂舅粮粱肆筹简签触躲辟辞誉酬酱跟跪跨跳龄鉴雹雷零雾魂韵鼓鼠满照新数感想意置解路群",
"凳僚谱蔽蔑遭遮弊嘉嗽骡察寨嫩馒摧撇摔摘滴漏漫漂漆演缩境墙舞慕慢赛赚熊旗截熔熄榜榴模榨敲歌歉暮璃愿膀膊膏膜稳锻锹端竭瘦碧磁疑蜡蜜蜻蝇蜘聚腐裳裹翠箩豪辣誓酷酿貌静鲜魄鼻颗精管算酸需",
"劈僵僻蕉蔬德遵嘱播撤撑撒撕撞潮潜墨懂熟飘槽横橡樱暴摩毅慧慰膛膝稻稿镇瞒瞎蝶蝴聪糊艘箭篇箱躺醋醉趣趟踩踏踢踪靠霉震鞋黎额颜影增",
"凝薄薯薪避邀嘴操激澡缴壁懒赞赠燕燃橘膨稼镜磨融糕糖篮辨辩醒蹄餐雕默衡颠器整",
"藏骤擦赢戴燥臂穗瞧螺糠糟繁翼辫蹈霜霞鞠",
"镰鹰覆翻蹦鞭爆攀瓣疆警蹲颤嚼嚷灌壤耀籍躁魔蠢霸露囊罐",
"匕刁丐邓冗仑讥夭歹戈乍冯卢凹凸艾夯叭叽囚尔皿矢玄",
"匈邦阱邢凫伦伊仲亥讹讳诀讼讶廷芍芋迄迂夷弛吏吕吁吆驮驯妆屹汛纫旭肋臼",
"卤刨匣兑罕伺佃佑诈诅芭芙芥苇芜芯巫庇庐吠吭吝呐呕呛吮吻吟吱闰妒妓姊狈岖彤屁扳扼抠抡拟抒抑沧沪沥沦沐沛汰汹纬坎坞坠囱囤忱轩灸灼杈杉杖牡汞玖玛韧肛肖肘鸠甸甫邑",
"卦刹刽陌陋郁函侈侥侣侠卑卒卓叁诡苞苟苛茉苫苔茁奈奄弧弥庞帕帚呵哎咖咕咙咆呻咒驹宠宛姆狞岳屉拗拂拇拧拓拄拙泌沽沮泞泣沼绊绅绎坷坤坯坪怯怔贬账贮炬觅枫杭枚枢枉玫昙昔氓祈殴瓮肮肪肴歧秉疙疚矾衩虱疟忿氛",
"陨勃勋俄侯俐俏诲诫诬茬茴荤荠荚荆荔荞茸茵荧徊逊契奕哆咧咪哟咨骇闺闽宦娄娜姚狰峦屏屎饵拱拷拭挟拯洛洼涎垛垢恍恃恬恤幽贰轴飒烁炫毡柑枷柬柠柒栅栈氢昧昵昭祠泵玷玲珊胧胚胎秕钝钙钧钠钮钦盅盹鸥砂砚蚤虐籽衍韭",
"凌凄剔匿郭卿俺倔诽诺谆荸莱莉莽莺莹逞逛哺哼唧唠哩唆哮唁骏娩峻峭馁捌挫捣捍捅捂涤涡涣涧浦涩涕埃埂圃悍悯贾赁赂赃羔殉烙梆桦栖栓桅桩氨挚殷瓷斋恕胯脓脐胰秦秫钾铆疹鸵鸯鸳砾砰砸祟畔窍袒蚌蚪蚣蚜蚓耿聂耸舀耙耘紊笆酌豹豺颁袁衷",
"乾厢兜匾隅凰冕勘傀偎谍谓谐谚谒菲菇菱菩萨萎萧萤徘徙巢逻逸尉奢庵庶啡唬啃啰啤啥唾啸阐阎寂娶婉婴猖崩崔崎彪彬掺捶措掸掂捺捻掐掖掷淳淀涵淮淑涮淌淆涯淫淤渊绷绰综绽缀埠堕悴惦惋赊烹焊焕梗梭梧敛晦晤祷琅琉琐曹曼脯秽秸铛铐铝铭铣铡盔眷眶痊鸿硅硕矫祭畦窒裆袱蛆蛉蚯蛀聊翎舶舵舷笙笤赦麸躯酗酝趾颅颇衅",
"隘募凿谤蒂葫蒋遏遂逾奠喳啼喧喻骚寓媒媚婿猬猩嵌彭壹搀揣搓揩揽搔揖揍渤溅溃渺湃湘滞缔缆缕缅堰愕惶赐赋赎焙椎棺棘榔棱棠椭椰犀牍敦氮氯晾晰掰琳琼琢韩惫腌腕腋锉锌竣痘痪痢鹃甥硫硝畴窖窘蛤蛔蜒粟粤翘翔筏酣酥跋跛雳雇鼎黍颊焚",
"剿谬蓖蒿蒲蓉廓幌嗤嗜嗦嗡嗅寞寝嫉媳猿馏馍搪漓溺溶溯溢滓缤缚煞辐辑斟椿楷榄楞楣楔暇瑰瑟腻腮腺稚锭锚锰锨锥睹瞄睦痹痴鹏鹉碘碉硼禀署畸窟窥褂裸蜀蜕蜗蜈蛹聘肄筷誊酪跺跷靖雏靶靴魁颓颖频衙",
"兢隧僧谭蔼蔓蔫蔚箫蔗幔嘀嘁寡寥嫡彰漱漩漾缨墅慷孵赘熬熙熏辖辕榕榛摹镀瘩瘟碴碟碱碳褐褪蝉舆粹舔箍箕赫酵踊雌",
"凛谴蕊蕴幢嘲嘿嘹嘶嬉履撮撩撵撬擒撰澳澈澄澜潦潘澎潭缭墩懊憔憎樊橄樟敷憋憨膘稽镐镊瘪瘤瘫鹤磅磕碾褥蝙蝠蝗蝌蝎褒翩篓豌豫醇鲫鲤鞍",
"冀儒蕾薇薛噩噪撼擂擅濒缰憾懈辙燎橙橱擎膳瓢穆瘸瘾鹦窿蟆螟螃糙翰篡篙篱篷踱蹂鲸霍霎黔",
"儡藐徽嚎壕懦赡檩檬檀檐曙朦臊臀爵镣瞪瞭瞬瞳癌礁磷蟥蟀蟋糜簇豁蹋鳄魏",
"藕藤嚣瀑戳瞻癞襟璧鳍蘑藻攒孽癣蟹簸簿蹭蹬靡鳖羹巍攘蠕糯譬鳞鬓躏霹髓蘸瓤镶矗"
).join().codepoints()
#let SC-LEN = SC-CHARS.len()
//----------------------------------------------------------
// Private functions
//----------------------------------------------------------
// Generate blind text of Simplified Chinese with pure words
#let _rand-sc-pure(rng, words) = {
let arr = ()
(rng, arr) = integers-f(rng, low: 0, high: SC-LEN, size: words)
return arr.map(i => SC-CHARS.at(i)).join()
}
// Generate blind text of Simplified Chinese with mixing words and punctuations
#let _rand-sc-mix(rng, words, gap) = {
let u-punct = (0x3002, 0xFF0C, 0x3001, 0x201C, 0x201D) // period, comma, pause, left quote, right quote
let gap-min = calc.floor(gap * 0.9)
let gap-max = calc.ceil(gap * 1.1)
let arr = ()
let n-rest = words
let n-seg = 0
let w = ()
let punct = 0
let quote-dir = 0
while (n-rest > 0) {
(rng, n-seg) = integers-f(rng, low: gap-min, high: gap-max, endpoint: true)
if n-seg > n-rest {n-seg = n-rest}
n-rest -= n-seg
(rng, w) = integers-f(rng, low: 0, high: SC-LEN, size: n-seg)
arr += w.map(i => SC-CHARS.at(i))
(rng, punct) = choice-f(rng, u-punct)
if punct == 0x201D and quote-dir == 0 {punct = 0x201C}
if punct == 0x201C and quote-dir == 1 {punct = 0x201D}
if n-rest > 0 {
if punct == 0x201C {
quote-dir = 1
} else if punct == 0x201D {
quote-dir = 0
}
arr.push(str.from-unicode(punct))
}
}
if words > 0 {
if quote-dir == 1 {arr.push(str.from-unicode(0x201D))}
arr.push(str.from-unicode(u-punct.at(0)))
}
return arr.join()
}
//----------------------------------------------------------
// Public functions
//----------------------------------------------------------
// Generate blind text of Simplified Chinese
//
// Arguments:
// words: the length of the blind text in pure words
// seed: value of seed, effective value is an integer from [1, 2^32-1], optional
// punctuation: if true, insert punctuations in generated words, optional
// gap: average gap between punctuations, optional
//
// Returns:
// str: generated blind text of Simplified Chinese
#let rand-sc(words, seed: 42, punctuation: false, gap: 10) = {
assert(type(words) == int and words >= 0, message: "`words` should be non-negative")
assert(type(seed) == int, message: "`seed` should be an integer")
assert(type(punctuation) == bool, message: "`punctuation` should be bool")
assert(type(gap) == int and gap >= 3 and gap <= 5000, message: "`gap` should be in range [3, 5000]")
let rng = gen-rng-f(seed)
if punctuation {
return _rand-sc-mix(rng, words, gap)
} else {
return _rand-sc-pure(rng, words)
}
}
|
https://github.com/fuchs-fabian/typst-template-aio-studi-and-thesis | https://raw.githubusercontent.com/fuchs-fabian/typst-template-aio-studi-and-thesis/main/src/cover_sheet.typ | typst | MIT License | #let get-cover-sheet(
primary-color: none, // required
secondary-color: none, // required
text-color: none, // required
background-color: none, // required
visualise-content-boxes: ( // required
flag: false, // required
fill: none, // required
stroke: none // required
),
university: (
name: none, // required
street: none, // required
city: none, // required
logo: none
),
employer: (
name: none, // required
street: none, // required
city: none, // required
logo: none
),
cover-image: none,
date: none,
version: none,
title: none,
subtitle: none,
description: none,
authors: (
(
name: "Unknown author", // required
id: "",
email: ""
),
),
faculty: none,
programme: none,
semester: none,
course: none,
examiner: none,
submission-date: none
) = {
import "utils.typ": *
import "dictionary.typ": *
set text(size: 11pt)
let default-logo(size: 80pt) = {
box(
height: size,
width: size,
stroke: text-color,
fill: background-color
)[
#align(center)[Logo]
]
}
let bold-weight = 550
let div(height: 1em, body) = {
if body != none {
box(
fill: if visualise-content-boxes.flag { visualise-content-boxes.fill },
stroke: if visualise-content-boxes.flag { visualise-content-boxes.stroke },
width: 100%
)[
#body
]
} else {
box(
fill: if visualise { visualise-color } else { none },
stroke: none,
width: 100%,
height: height
)
}
}
// Facilities
let get-content-for-facility(facility) = {
set text(1.1em, weight: bold-weight)
if is-not-none-or-empty(facility) {
if is-not-none-or-empty(facility.name) and is-not-none-or-empty(facility.street) and is-not-none-or-empty(facility.city) {
grid(
columns: (75%, 25%),
align: horizon,
[
#div[
#facility.name
#linebreak()
#facility.street
#linebreak()
#facility.city
]
],
[
#div[
#let facility-dict-contains-key(key) = {
return dict-contains-key(dict: facility, key)
}
#if facility-dict-contains-key("logo") {
if is-not-none-or-empty(facility.logo) {
facility.logo
} else {
default-logo()
}
} else {
default-logo()
}
]
]
)
}
}
}
div[
#get-content-for-facility(university)
]
if is-not-none-or-empty(university) and is-not-none-or-empty(employer) {
if is-not-none-or-empty(university.name) and is-not-none-or-empty(employer.name) {
div[
#h(20pt) #text(1.1em, weight: bold-weight, style: "italic")[ #txt-cooperation ]
]
}
}
div[
#get-content-for-facility(employer)
]
// Cover image
if is-not-none-or-empty(cover-image) {
div[
#div(height: 0em)[]
#align(center, block(height: 10em)[
#div[
#cover-image
]
])
#div(height: 0em)[]
]
}
else {
v(2fr)
}
v(1fr)
// Date, version
div[
#text(1.1em)[ #date ]
#if is-not-none-or-empty(version) {
text(size: 15pt, weight: "regular")[ | ]
text(1.1em)[ Version: #version ]
}
]
v(2pt)
// Title
div[
#text(2.5em, weight: "bold", fill: primary-color, title)
]
// Subtitle
if is-not-none-or-empty(subtitle) {
linebreak()
div[
#text(1.4em, weight: 400, fill: secondary-color, subtitle)
]
}
// Description
if is-not-none-or-empty(description) {
v(1fr)
div[
#text(style: "italic", weight: bold-weight, description)
]
}
v(1fr)
// Authors
div[
#grid(
columns: (1fr,) * calc.min(3, authors.len()),
gutter: 1em,
..authors.map(author => align(start)[
#text(fill: primary-color, weight: "bold", size: 12pt)[ #author.name ]
#let author-dict-contains-key(key) = {
return dict-contains-key(dict: author, key)
}
#if author-dict-contains-key("id") {
if is-not-none-or-empty(author.id) {
linebreak()
author.id
}
}
#if author-dict-contains-key("email") {
if is-not-none-or-empty(author.email) {
linebreak()
link("mailto:" + author.email)[ #author.email ]
}
}
]
)
)
]
v(1fr)
// Information
div[
#let get-content(parameter, body) = if is-not-none-or-empty(parameter) { v(6pt) + body }
#let get-info-description(it) = { text(weight: "bold")[ #it: ] }
#grid(
columns: (8em, auto),
[ #get-content(faculty)[ #get-info-description(txt-faculty) ] ],
[ #get-content(faculty)[ #faculty ] ],
[ #get-content(programme)[ #get-info-description(txt-programme) ] ],
[ #get-content(programme)[ #programme ] ],
[ #get-content(semester)[ #get-info-description(txt-semester) ] ],
[ #get-content(semester)[ #semester ] ],
[ #get-content(course)[ #get-info-description(txt-course) ] ],
[ #get-content(course)[ #course ] ],
[ #get-content(examiner)[ #get-info-description(txt-examiner) ] ],
[ #get-content(examiner)[ #examiner ] ],
[ #get-content(submission-date)[ #get-info-description(txt-submission-date) ] ],
[ #get-content(submission-date)[ #submission-date ] ],
)
]
} |
https://github.com/kacper-uminski/math-notes | https://raw.githubusercontent.com/kacper-uminski/math-notes/main/tams11/notes.typ | typst | Creative Commons Zero v1.0 Universal | #import "@preview/cetz:0.2.2"
#import "@preview/fletcher:0.4.2" as fletcher: node, edge
#import "book.typ": *
#show: doc => book_template(
title: "A Concise Course in Probability and Statistics",
author: [<NAME> #footnote[
Department of Mathematics, Linköping University,
#link("https://liu.se/en/employee/xiaza52")
]],
course: "TAMS11",
doc)
#set page(numbering: "i")
#heading(numbering: none)[Preface]
One aim is to limit the book within 100 pages in order to keep the book as
concise as possible, therefore many proofs are referred to references and
thus omitted.
????all problems with solutions!!!???
#pagebreak(weak: true)
#outline()
#set page(numbering: "1")
#counter(page).update(1)
= Basics on probability
In this chapter, we introduce the (intuitive) definition of “probability” and
its several computation techniques. To this end, we first give the definitions
of sample spaces, events and their operations.
== Sample spaces and events
=== Definition <def1.1.1>
The _Sample space_ (usually denoted as $S$) of an experiment (or a trial)
is the set of all possible outcomes of the experiment.
=== Example <eg1.1.2>
_Now let us do an experiment: throw a fair die and observe the upper side.
The sample space is $ S = {1,2,3,4,5,6} $_
=== Example <eg1.1.3>
_Let us do another experiment: throw two fair dice, one by one, and
observe the two sides. The sample space is
$ S = {(1,1),...,(1,6); (2,1),...,(2,6);(6,1),...,(6,6)} $_
=== Definition <def1.1.4>
An _event_ (usually denoted as $A, B, C, ...$)
=== Example <eg1.1.5>
_In @eg1.1.2[Example], one can define three events as follows
$ A = {2,4}, #h(12pt) B = {2,3}, #h(12pt)
C = {"Even numbers"} = {2,4,6} $_
=== Example <eg1.1.6>
_In @eg1.1.3[Example], two events can be defined as
$ D = {(5,6)}, #h(12pt)
E = {"Sum of two upper sides is 6"} =
{(1,5),(5,1),(2,4),(4,2),(3,3)} $_
There are two special events: the sample space $S$ and the empty set
$emptyset$. The fact that the sample space is an event is clear since it
can be regarded as a subset of itself ($S subset.eq S$). The empty event
$emptyset$ simply means that there are no elements inside. For instance,
in @eg1.1.3[Example], if we define an event
$F = {"Sum of two upper sides is 20"}$, then $F = emptyset$ as there is
no element in the sample space for which the sum is 20.
A very useful way to visually see a sample space and its events is as a
_Venn diagram_ in which a rectangle represents the sample space $S$ and
circles represent the events:
#figure(caption: [Venn diagram],
align(center)[
#cetz.canvas({
import cetz.draw: *
rect((-3,-2), (3,2))
content((2.8,1.8), [S])
circle((-0.8,0), radius: 1.5)
content((-0.8,0), [A])
circle((1.2,0), radius: 1)
content((1.2,0), [B])
})
]
)
== Operations on events
For real numbers, there are four basic operations $+,-,times,div$. It is
clear that these operations can not be applied to events, and in this
section we introduce three basic operations on events.
=== Definition <def1.2.1>
_Intersection_ of two events, $A$ and $B$, is denoted and defined as
$ A sect B = {#[Elements in both $A$ and $B$]} $
=== Definition <def1.2.2>
_Union_ of two events, $A$ and $B$, is denoted and defined as
$ A union B = {#[Elements in at least one of $A$ and $b$]}$
=== Definition <def1.2.3>
_Complement_ of an event $A$ is denoted and defied as
$ A' = {#[Elements in S that are not in $A$]} $
In @eg1.1.5[Example], it directly follows from the definitions that
$A sect B = {2}, A union B = {2,3,4},$ and $A' = {1,3,5,6}$. It should be
noted that Venn diagram can greatly help us to visually see and perform
these operations:
#align(center, grid(columns: (1fr, 1fr, 1fr),
[
#figure(caption: [$A sect B$],
cetz.canvas(length: 0.8cm, {
import cetz.draw: *
rect((-3,-2), (3,2))
content((2.8,1.8), [S])
circle((-0.8,0), radius: 1.5, name: "A", stroke: none)
content((-0.8,0), [A])
circle((1.2,0), radius: 1, name: "B", stroke: none)
content((1.2,0), [B])
intersections("i", "A", "B")
arc-through("i.0", "A.east", "i.1", mode: "CLOSE", stroke: gray, fill: gray)
arc-through("i.0", "B.west", "i.1", mode: "CLOSE", stroke: gray, fill: gray)
circle((-0.8,0), radius: 1.5)
circle((1.2,0), radius: 1)
})
)
],
[
#figure(caption: [$A union B$],
cetz.canvas(length: 0.8cm, {
import cetz.draw: *
rect((-3,-2), (3,2))
content((2.8,1.8), [S])
circle((-0.8,0), radius: 1.5, stroke: none, fill: gray)
content((-0.8,0), [A])
circle((1.2,0), radius: 1, fill: gray)
circle((-0.8,0), radius: 1.5)
content((1.2,0), [B])
})
)
],
[
#figure(caption: [$A'$],
cetz.canvas(
length: 0.8cm,
background: gray,
{
import cetz.draw: *
rect((-3,-2), (3,2))
content((2.8,1.8), [S])
circle((-0.8,0), radius: 1.5, fill: white)
content((-0.8,0), [A])
}
)
)
],
))
=== Definition <def1.2.4>
Two events, $A$ and $B$, are _disjoint_ if $A sect B = emptyset$
=== Theorem <th1.2.5>
_It holds that
$(A sect B)' = A' union B'$ and
$(A union B)' = A' sect B'$._
The proof of @th1.2.5[Theorem] can be seen by drawing a Venn diagram for
each side of the equality.
== Probabilities of events
=== The (intuitive) definition of "probability"
An essential concept in the theory of probability theory is “probability
of an event” which is written as $P(A)$ for an event $A$. The very first
task is to define $P(A)$. However, to rigorously define a probability, one
needs to recall Kolmogorov Axioms (see @Chernoff1954)#footnote[
The triple $(S, cal(F), P)$ is said to be a probability space if $P$
satisfies the Kolmogorov Axioms:
#set enum(numbering: "(i)")
+ $P(A) >= 0$ for any event $A in cal(F)$
+ $P(S) = 1$
+ $P(union.big_(n=1)^oo A_n) = sum_(n=1)^oo P(A_n)$ for disjoint
events $A_1, A_2, ...$
In this setting, $S$ is called the sample space, $cal(F)$ is the
collection of events and $P$ is a probability.
]. But for an undergraduate course, let us just intuitively understand a
probability as a chance. Even in this intuitive setting, some remarks seem
to be necessary. If one looks at an experiment of tossing a fair coin,
then one usually understands the word “fair” as the 50% chance of getting
a head (and of course the 50% chance of getting a tail). However this 50%
chance should be understood as follows: one tosses a fair coin $n$ times
and counts the relative frequencies of getting heads, then it is shown
that the limit of these relative frequencies as $n$ tends to infinity is
50%. Note that for each fixed $n$, it can only be said that the relative
frequency of getting heads is close (possibly not exactly equal) to 50%.
=== Computation techniques of probabilities
#[
#set enum(full: true, numbering: (..n) => {
let format = if n.pos().len() > 1 {
"(a)"
} else {
it => strong(numbering("(I)", it))
}
numbering(format, n.pos().last())
})
+ *Rules*
+ $P(S) = 1, P(emptyset) = 0$;
+ $P(A') = 1-P(A)$;
+ $P(union.big_(i=1)^n A_i) = sum_(i=1)^n P(A_i)$ for disjoint
events $A_1,...,A_n$;
+ $P(A union B) = P(A) + P(B) - P(A sect B)$, for any events $A$
and $B$;
+ For any events $A$, $B$, and $C$,
$ P(A union B union C) = P(A)+P(B)+P(C)-P(A sect B)-P(A sect C)
-P(B sect C)+P(A sect B sect C) $
All of these rules can be directly seen from Venn diagrams.
+ *An essential formula* Assume that outcomes of an experiment are
equally likely, then
#math.equation(
numbering: "(1)",
supplement: "Eq.",
block: true)[$ P(A) = N(A)/N $ ] <eq1>
where $N(A)$ represents the number of elements in $A$ (alternatively
the number of different ways to achieve $A$), and $N$ is the number
of total outcomes (alternatively the number of different ways in
total.) Sometimes it is very easy to count $N(A)$ and $N$, and below
is such an example.
]
=== Example <eg1.3.3>
_If we throw a fair die and observe the upper side, then the outcomes of
this experiment are equally likely. Define an event $A = {2,4}$. It follows
from the essential formula (@eq1) that
$ P(A) = N(A)/N = 2/6 = 1/3 $_
However, sometimes it is not easy to count $N(A)$ and $N$, and we need to
use suitable counting techniques. Below we include three such techniques.
/ Product: #[
Suppose that for a counting there are $k$ steps, (or places): #[
#set box(stroke: 0.5pt, height: 11pt, baseline: 20%)
#box[$n_1$]#box[$n_2$]...#box[$n_k$]
], and in the $i$-th step there are $n_i$ different elements (or
ways.) Then, in total, there are $product_(i=1)^k n_i$ different
elements (or ways.)
]
/ Combination: #[
Suppose that there are $n$ different objects from which one
wants to choose $k$ different objects. Then the number of ways to
choose is $C_(k,n) = vec(n,k) = n!/(k!(n-k)!)$. It should be noted
that for these $k$ chosen objects, the order is not important.
]
/ Permutation: #[
Suppose that there are $n$ different objects, and now one wants to
choose $k$ different objects and then arrange them according to an
order. Then the number of different ways is $P_(k,n) = n!/(n−k)!$.
Here for these $k$ chosen objects, the order is important!
]
We can now apply these counting techniques to one specific example.
=== Example <eg1.3.3>
_A group of 60 students will have a party, and 2 of these students will be
randomly selected to buy beers and snacks for the party. Suppose that in
this group there is (only) one student named <NAME>. Now define an
event $A = {"<NAME> is selected"}$. What is the probability $P(A)$?
We will answer this question using two different approaches._
_Solution:_
#enum(numbering: "(i)", tight: false)[
The first approach is based on combinations. If we think that these 2
students always go together, then the order in which they are selected
is not important (namely we can think of selecting these 2 students at
once), therefore the essential formula (@eq1) implies
$ P(A) = N(A)/N = (1 dot 59)/C_(2,60) = 1/30 $
The counting of $N(A)$ uses the product technique since there are two
steps: step one is to select David (for which there is only 1 way) and
step two is to select someone else (there are 59 ways). Note that here
the order does not matter since these 2 students are considered as a
group. The counting of $N$ here follows directly from the combination.
][
The second approach is based on permutations. If we now think that
these 2 students do not go together (one goes to buy beers and one
goes to buy snacks), then the order really matters (imagine that David
and Lisa are selected, then it could happen that David buys beers and
Lisa buys snacks, or vice versa). Keeping this in mind, the essential
formula (@eq1) implies
$ P(A) = N(A)/N = (1 dot 59 + 59 dot 1)/P_(2,60) = 1/30 $
]
== Conditional probabilities, total probabilities and Bayes’ Theorem
In this section we introduce three more techniques to compute probabilities
(techniques involving conditional probabilities, total probabilities and
Bayes’ Theorem), together with two approaches (the tree approach and the
table approach.)
=== Conditional probabilities
Given two events, $A$ and $B$ with $P(B) > 0$, the _conditional
probability_ of $A$ given $B$, written as $P(A|B)$, is defined as
$ P(A|B) = P(A sect B)/P(B) $
How to intuitively understand a conditional probability: just regard the
condition $B$ as a new sample space! For instance, if we throw a fair die
and set $A = {2}$ and $B = {2,3}$, then the conditional probability
$P(A|B) = 1/2$. With the condition $B = {2, 3}$, one simply thinks that
the die can only show 2 or 3, therefore the probability of getting
$A = {2}$ is $1/2$. The main motivation for introducing conditional
probabilities is the fact that for many applications, suitable
conditions can only be expressed as conditional probabilities which will
be partially explained in the following example.
=== Example <eg1.4.2>
_Suppose that a factory makes items (such as computers.) Before these
items are sold they have to pass the quality control established by this
factory. Assume that the defective rate of these items is 5% (which means
that 5% of all the items that the factory makes are defective). Further
assume that a defective item can pass the quality control at a rate of 1%
and that good items always pass. What is the probability that a randomly
selected item is defective and can pass the quality control?_
_Solution:_ Define the following events:
$ A & = {"A randomly selected item is defective"} \
B & = {"A randomly selected item can pass"} $
The problem asks for the probability of $P(A sect B)$ with the following
being given:
$ P(A) & = 5%, #h(12pt) P(B|A) & = 1%, #h(12pt) P(B|A') & = 100% $
We can proceed in three ways:
#enum(numbering: "(i)", tight: false)[
It follows directly from the definition of conditional probabilities
that $ P(A sect B) = P(B|A) dot P(A) = 1% dot 5% = 0.05% $
][
We draw a tree with two levels. Level 1 specifies whether or not an
item is defective, and level 2 specifies whether or not an item can
pass through quality control:
#align(center,
cetz.canvas(({
import cetz.tree
import cetz.draw: *
let data = ([A randomly selected item],
([$A$ (defective, 5%)],
([$B$ (pass, 1%)], ([$ P(A sect B) \ = 5% dot 1% $])),
([$B'$ (fail, 99%)], ([$ P(A sect B') \ = 5% dot 99% $]))),
([$A'$ (good, 95%)],
([$B$ (pass, 100%)], ([$ P(A' sect B) \ = 95% dot 100% $])),
([$B'$ (fail, 0%)], ([$ P(A' sect B') \ = 95% dot 0% $]))))
cetz.tree.tree(
data,
draw-node: (node, ..) => {
content((), text([#block(
inset: 4pt,
radius: 3pt,
stroke: 0.5pt,
node.content)]))
},
spread: 4,
grow: 1.2
)
})))
][
We take 10 000 such items and classify them as follows:
#align(center,table(columns: 3,
[],[$A$ (defective, 500 items)],[$A'$ (good, 9500 items)],
[$B$ (pass)],[5],[9500],
[$B'$ (fail)],[495],[0]
))
It then directly follows from the table (and formula @eq1) that
$P(A sect B) = 5/10000 #h(12pt) qed$
]
=== Total Probabilities
If ${A_i}_(i=1)^k$ is a separation of the sample space $S$ (namely
$A_i$ are disjoint $forall i$ and the union $union.big_(i=1)^k A_i = S$)
then the _total probability formula_ is
#math.equation(block: true, numbering: "(1)")[
$P(B) = sum_(i=1)^k P(B|A_i) dot P(A_i)$
] <eq2>
Loosely speaking, the total probability $P(B)$ can be split into $k$
smaller probabilities. This begs the question of why we would want to do
split a probability. This is answered in the following example.
=== Example <eg1.4.4>
_In @eg1.4.2[Example], what is the probability that a randomly selected
item can pass the quality control?_
_Solution:_
#enum(numbering: "(i)")[
The first approach uses total probability. We want to find $P(B)$,
however $P(B)$ is not given directly. Instead, two conditional
probabilities are given, $P(B|A) = 1%$ and $P(B|A') = 100%$.
Therefore a splitting is desired and the total probability formula can
be used:
$ P(B) = P(B|A) dot P(A) + P(B|A') dot P(A')
= 1% dot 5% + 100% dot 95%
= 95.05% $
][
The second approach uses the table from @eg1.4.2[Example] (Approach 3
therein). From the table and @eq1 it directly follows that
$P(B) = (5 + 9500)/10000 = 95.05% #h(12pt) qed $
]
=== Bayes' Theorem
If two events, $A$ and $B$, both have positive probabilities, $P(A) > 0$
and $P(B) > 0$ then _Bayes' Theorem_ states that
$ P(A|B) = (P(B|A) dot P(A))/P(B) $
namely, the positions of $A$ and $B$ can be reversed in this way. See the
following example for why this can be necessary.
=== Example <eg1.4.6>
_In @eg1.4.2[Example], given that a randomly selected item passes the
quality control, what is the probability that this item is defective?
(This is a basic problem in control theory.)_
_Solution:_
#enum(numbering: "(i)")[
Approach 1 uses Bayes' theorem. What needs to be calculated is
$P(A|B)$. However, what we know is that $P(B|A) = 1%$, therefore we
want to switch the positions of $A$ and $B$. To this end, Bayes'
Theorem implies that
$ P(A|B) = (P(B|A) dot P(A))/P(B)
= (1% dot 5%)/underbrace(95.05%, #[@eg1.4.4[Example]])
= 0.0526% $
][
Approach 2 once again uses the table from @eg1.4.2[Example] and @eq1.
These give that $ P(A|B) = 5/(5+9500) = 0.0526% #h(12pt) qed $
]
== Independence of events
=== Definition <def1.5.1>
Two events, $A$ and $B$, are said to be _independent_ if
$P(A sect B) = P(A) dot P(B)$.
Intuitively speaking, if $A$ and $B$ are independent, then the occurrence
of $A$ does not affect the occurrence of $B$ and vice versa. For instance,
if we throw a fair die and set $A = {2}$, $B = {2, 3}$ and $C = S$ (the
sample space), then one can see that $A$ and $B$ are NOT independent
(because if $A$ happens, then $B$ will happen consequently), but $A$ and
$C$ are independent (since the occurrence of $A$ will not at all affect
the occurrence of S, which happens for sure). It should be noted that if
$A$ and $B$ are independent, then $A′$ and $B$ are also independent (the
same is true for the pairs $A$ and $B′$ as well as $A′$ and $B′$.)
=== Definition <def1.5.2>
Events $A_1, A_2,...,A_n$ are said to be _independent_ if
$forall {i_1, i_2, ..., i_k} subset.eq {1,2,...,n}$ it holds that
$P(sect.big_(j=1)^k A_i_j) = product_(j=1)^k P(A_i_j)$
One should notice the fact that in order to make events $A_1, A_2,...,A_n$
independent, it is NOT enough to only require that
$P(union.big_(i=1)^n A_i) = product_(i=1)^n P(A_i)$, since it can not
be deduced from this equality that $A_i$ and $A_j$ are independent
$forall i,j$.
=== Example <eg1.5.3>
#enum(numbering: "(i)")[
_(Serial system) Suppose that a signal is transmitted from a to b
through a serial system with four independent stations,
$(T_i)_(i=1)^4$ as follows:_
#align(center,
fletcher.diagram(
cell-size: 5mm,
$
a edge("r", ->)
& T_1 edge("r", ->)
& T_2 edge("r", ->)
& T_3 edge("r", ->)
& T_4 edge("r", ->)
& b
$))
_Suppose that the successful transmission probability of each station
is $P(T_i) = 90%, 1 <= i <= 4$. What is the probability the signal can
be successfully transmitted from $a$ to $b$_?
][
_(Parallel system) Suppose that a signal is transmitted from $a$ to
$b$ through a parallel system with four independent stations
$T_i, 1 <= i <= 4$ as follows:_
#align(center,
fletcher.diagram(
cell-size: 5mm,
$
& & & & T_1 edge("ddrr") \
& & & & T_2 edge("drr") \
a edge("rr", ->) &&
edge("uurr", ->) edge("urr", ->) edge("drr", ->) edge("ddrr", ->)
& & & & edge("rr", ->) & & b \
& & & & T_3 edge("urr") \
& & & & T_4 edge("uurr")
$))
_Suppose that the successful transmission probability of each station
is $P(T_i) = 90%, 1 <= i <= 4$. What is the probability the signal can
be successfully transmitted from $a$ to $b$_?
]
_Solution_
#enum(numbering: "(i)")[
The probability is, based on the independence,
$ P(sect.big_(i=1)^4 T_i) = product_(i=1)^4 P(T_i) = (90%)^4 = 65.61% $
][
The probability is, based on the independence,
$ P(union.big_(i=1)^4 T_i) & = 1 - P((union.big_(i=1)^4 T_i)') \
& = 1 - P(sect.big_(i=1)^4 T_i) \
& = 1 - product_(i=1)^4 P(T'_i) \
& = 1 - (1 - 90%)^4 \
& = 99.99% $
]
= Random variables
In this chapter we introduce the most basic concept in probability,
_random variable_, which will be used throughout the book. Again, we will
choose an intuitive definition of random variables, although a rigorous
definition is given for completeness. After discussions on one-dimensional
random variables, we also explore two-dimensional random variables (also
called _random vectors_). Two essential concepts of a random variable, mean
and variance, are also defined and explained.
Throughout the book, any one-dimensional random variable is assumed to take
values on the real line for the sake of simplicity.
== One dimensional random variables
#pagebreak(weak: true)
#bibliography("sources.bib")
|
https://github.com/Raunak12775/aloecius-aip | https://raw.githubusercontent.com/Raunak12775/aloecius-aip/main/lib.typ | typst | // Dependencies
#import "@preview/physica:0.9.3": *
#import "@preview/cetz:0.2.2"
#import "@preview/whalogen:0.2.0": ce
// Global functions and variables
#let indent = h(1em)
// Author Metadata
#let author-meta(
..affiliation,
email: none,
alias: none,
address: none,
cofirst: false
) = {
let info = (
"affiliation": affiliation
)
if email != none {
info.insert("email", email)
}
if alias != none {
info.insert("name", alias)
}
if address != none {
info.insert("address", address)
}
if cofirst != none {
info.insert("cofirst", cofirst)
}
info // return info
}
// Title of Article
#let default-title(title) = {
show: block.with(width: 100%)
set align(left)
set text(font: "New Computer Modern Sans", weight: "bold", size: 12pt)
title
}
// Author Print
#let default-author(author) = {
h(0.5em)
set text(font: "New Computer Modern Sans", size: 12pt)
text(author.name)
super(author.insts.map(it => str(it+1)).join(","))
if author.corresponding {
footnote[
#if author.email != none {
[Electronic mail: #underline(author.email).]
}
]
}
if author.cofirst == "thefirst" {
footnote("cofirst-author-mark")
} else if author.cofirst == "cofirst" {
locate(loc => query(footnote.where(body: [cofirst-author-mark]), loc).last())
}
}
// Affiliation Print
#let default-affiliation(id, address) = {
h(0.5em)
set text(style: "italic", size: 12pt)
super([#(id+1)])
address
}
// Author info print
#let default-author-info(authors, affiliations) = {
{
show: block.with(width: 100%)
authors.map(it => default-author(it)).join(", ", last:text(font: "New Computer Modern Sans", size: 12pt)[, and])
}
let used_affiliations = authors.map(it => it.insts).flatten().dedup().map(it => affiliations.keys().at(it - 1))
{
show: block.with(width: 100%)
set par(leading: 0.4em)
used_affiliations.enumerate().map(((ik, key)) => {
default-affiliation(ik, affiliations.at(key))
}).join(linebreak())
}
}
// Abstract Print
#let default-abstract(abstract, keywords) = {
// Abstract and keyword block
if abstract != [] {
v(2em)
set text(font: "New Computer Modern", size: 12pt)
set par(justify: true, leading: 1.5em)
pad(left: 0.5em, right: 0.5em, [#indent #abstract])
pagebreak()
}
}
// Bibliography
#let default-bibliography(bib) = {
pagebreak()
align(left, text(size: 12pt, font: "New Computer Modern", weight: "bold")[References])
set bibliography(title: none, style: "american-physics-society")
bib
}
// Body of the text
#let default-body(body) = {
set text(font: "New Computer Modern", size: 12pt)
set par(
first-line-indent: 1em,
justify: true,
leading: 1.5em
)
show heading.where(level: 1): set heading(numbering: "I.")
show heading.where(level: 1): upper
show heading.where(level: 1): set text(size: 12pt)
show heading: set block(above: 2em, below: 2em)
//level 2
show heading.where(level: 2): set heading(numbering:( _ , last) => numbering("A.", last))
show heading.where(level: 2): set text(size: 12pt)
show heading: set block(above: 2em, below: 2em)
set footnote(numbering: "1")
// math numbering
show link: underline
show link: set text(font: "New Computer Modern Mono", fill: red)
set math.equation(numbering: "(1)")
body
}
#let article(
// Article's Title
title: "Article Title",
// A dictionary of authors.
// Dictionary keys are authors' names.
// Dictionary values are meta data of every author, including
// label(s) of affiliation(s), email, contact address,
// or a self-defined name (to avoid name conflicts).
// Once the email or address exists, the author(s) will be labelled
// as the corresponding author(s), and their address will show in footnotes.
//
// Example:
// (
// "<NAME>": (
// "affiliation": "affil-1",
// "email": "<EMAIL>", // Optional
// "address": "Mail address", // Optional
// "name": "<NAME>", // Optional
// "cofirst": false // Optional, identify whether this author is the co-first author
// )
// )
authors: ("<NAME>": author-meta("affiliation-label")),
// A dictionary of affiliation.
// Dictionary keys are affiliations' labels.
// These labels show be constent with those used in authors' meta data.
// Dictionary values are addresses of every affiliation.
//
// Example:
// (
// "affiliation-label": "Institution Name, University Name, Road, Post Code, Country"
// )
affiliations: ("affiliation-label": "Affiliation address"),
// The paper's abstract.
abstract: [],
// The paper's keywords.
keywords: (),
// The bibliography. Accept value from the built-in `bibliography` function.
bib: none,
// Templates for the following parts:
// - `title`: how to show the title of this article.
// - `author-list`: how to show the list of the authors.
// - `author`: how to show each author's information.
// - `affiliation`: how to show the affiliations.
// - `abstract`: how to show the abstract and keywords.
// - `bibliography`: how to show the bibliography.
// - `body`: how to show main text.
// Please see below for more infomation.
template: (:),
// Paper's content
body
) = {
// Set document properties
set document(title: title, author: authors.keys())
show footnote.entry: it => [
#set par(hanging-indent: 0.54em)
#it.note #it.note.body
]
set footnote(numbering: "*")
show "cofirst-author-mark": [These authors contributed equally to this work.]
let template = (
title: default-title,
author-info: default-author-info,
abstract: default-abstract,
bibliography: default-bibliography,
body: default-body,
..template,
)
// Title block
(template.title)(title)
// set align(left)
// Restore affiliations' keys for looking up later
// to show superscript labels of affiliations for each author.
let inst_keys = affiliations.keys()
// Find co-fisrt authors
let cofirst_index = authors.values().enumerate().filter(
meta => "cofirst" in meta.at(1) and meta.at(1).at("cofirst") == true
).map(it => it.at(0))
let author_list = ()
// Authors and affiliations
// Authors' block
// Process the text for each author one by one
for (ai, au) in authors.keys().enumerate() {
let author_list_item = (
name: none,
insts: (),
corresponding: false,
cofirst: "no",
address: none,
email: none,
)
let au_meta = authors.at(au)
// Write auther's name
let aname = if au_meta.keys().contains("name") and au_meta.name != none {
au_meta.name
} else {
au
}
author_list_item.insert("name", aname)
// Get labels of author's affiliation
let au_inst_id = au_meta.affiliation.pos()
let au_inst_primary = ""
// Test whether the author belongs to multiple affiliations
if type(au_inst_id) == array {
// If the author belongs to multiple affiliations,
// record the first affiliation as the primary affiliation,
au_inst_primary = affiliations.at(au_inst_id.first())
// and convert each affiliation's label to index
let au_inst_index = au_inst_id.map(id => inst_keys.position(key => key == id))
// Output affiliation
author_list_item.insert("insts", au_inst_index)
} else if (type(au_inst_id) == str) {
// If the author belongs to only one affiliation,
// set this as the primary affiliation
au_inst_primary = affiliations.at(au_inst_id)
// convert the affiliation's label to index
let au_inst_index = inst_keys.position(key => key == au_inst_id)
// Output affiliation
author_list_item.insert("insts", (au_inst_index,))
}
// Corresponding author
if au_meta.keys().contains("email") or au_meta.keys().contains("address") {
author_list_item.insert("corresponding", true)
let address = if not au_meta.keys().contains("address") or au_meta.address == "" {
au_inst_primary
} else { au_meta.address }
author_list_item.insert("address", address)
let email = if au_meta.keys().contains("email") and au_meta.email != none {
au_meta.email
} else { none }
author_list_item.insert("email", email)
}
if cofirst_index.len() > 0 {
if ai == 0 {
author_list_item.insert("cofirst", "thefirst")
} else if cofirst_index.contains(ai) {
author_list_item.insert("cofirst", "cofirst")
}
}
author_list.push(author_list_item)
}
(template.author-info)(author_list, affiliations)
(template.abstract)(abstract, keywords)
show: template.body
body
// Display bibliography.
if bib != none {
(template.bibliography)(bib)
}
}
|
|
https://github.com/daniel-eder/typst-template-jku | https://raw.githubusercontent.com/daniel-eder/typst-template-jku/main/src/template/definitions/thesis_types.typ | typst | // SPDX-FileCopyrightText: 2023 <NAME>
//
// SPDX-License-Identifier: Apache-2.0
#let thesis_types = (
diploma: "Diploma Thesis",
doctorate: "Doctoral Thesis",
master: "Master's Thesis"
) |
|
https://github.com/yankydoo/repro-typst-stroke-issue | https://raw.githubusercontent.com/yankydoo/repro-typst-stroke-issue/main/repro.typ | typst | #set text(
font: "REM",
fallback: false,
)
#text("AKQR bkmqu",
weight: "bold",
fill: rgb("#BF8F00"),
stroke: black,
size: 40pt
)
#text("AKQR bkmqu",
weight: "semibold",
fill: white,
stroke: black,
size: 24pt
)
#text("AKQR bkmqu",
fill: white,
stroke: black,
size: 24pt
)
|
|
https://github.com/platformer/typst-homework-template | https://raw.githubusercontent.com/platformer/typst-homework-template/main/hw-template.typ | typst | MIT License | // counter to track the total number of problems,
// regardless of problem titles
#let _problem-count-ckey = "_problem-count"
// counter to track problem number
#let _problem-number-ckey = "_problem-number"
// state value to store height of content area
#let _content-area-size = state("_hw-content-area-size", none)
// Creates a problem header with automatic numbering.
//
// Parameters:
// body: Text to place in header.
// Defaults to "{supplement} {problem number}".
// supplement: Content to precede the problem number.
// Defaults to "Problem".
// inset: Inner padding.
// fill: Fill color.
// stroke: Border stroke.
// header-margin-bottom: Space below header.
#let problem-header(
body: none,
supplement: "Problem",
inset: 12pt,
fill: none,
stroke: 2pt + black,
header-margin-bottom: 20pt,
) = {
counter(_problem-count-ckey).step()
if body == none {
counter(_problem-number-ckey).step()
}
rect(
width: 100%,
height: auto,
inset: inset,
outset: 0pt,
fill: fill,
stroke: stroke
)[
#text(weight: 700, size: 1.5em)[
#if body != none {
body
} else {
[#supplement #counter(_problem-number-ckey).display()]
}
]
]
v(weak: true, header-margin-bottom)
}
// Combines a problem-header with a body for the problem resopnse.
//
// Parameters:
// body: Problem response.
// title: Title of the problem.
// Defaults to "{supplement} {problem number}".
// supplement: Content to precede the problem number.
// Defaults to "Problem".
// break-strategy: Pagebreak strategy. Ignored for first problem.
// "break": insert pagebreak before problem
// "no-break": place problem directly after preceding content
// "fit": pagebreak only if problem cannot fit on the page
// header-margin-bottom: Space below problem header.
// problem-margin-bottom: Space below problem response.
#let problem(
body,
title: none,
supplement: "Problem",
break-strategy: "break",
header-margin-bottom: 20pt,
problem-margin-bottom: 30pt,
) = {
assert(
(
break-strategy == "break"
or break-strategy == "no-break"
or break-strategy == "fit"
),
message: "break-strategy must be \"break\" or \"no-break\" or \"fit\""
)
// combine problem header and response
let problem-content = [
#if title != none {
problem-header(
body: title,
supplement: supplement,
header-margin-bottom: header-margin-bottom,
)
} else {
problem-header(
supplement: supplement,
header-margin-bottom: header-margin-bottom,
)
}
#body
]
// place problem-content based on page break strategy
counter(_problem-count-ckey).display(prob-num => {
if prob-num == 0 or break-strategy == "no-break" {
problem-content
} else if break-strategy == "break" {
pagebreak(weak: true)
problem-content
} else if break-strategy == "fit" {
_content-area-size.display(size => style(styles => {
let content-height = measure(
block(width: size.width, problem-content),
styles
).height
if content-height > size.height {
pagebreak(weak: true)
problem-content
} else {
block(breakable: false)[#problem-content]
}
}))
}
v(weak: true, problem-margin-bottom)
})
}
// Homework document template.
//
// Parameters:
// doc: Document content.
// title: Document Title.
// number: Homework number.
// class: Class name.
// authors: List of author names.
// date: Date string.
#let hw(
doc,
title: "Homework",
number: none,
class: none,
authors: (),
date: none
) = {
// PLEASE CHANGE PAGE DIMENSIONS HERE
// DON'T SET paper PARAMETER IN page
let paper-width = 8.5in
let paper-height = 11in
let margin = (x: 1.25in, y: 1in)
let real_title = title + " " + str(number)
set document(
author: authors,
title: real_title
)
set page(
"us-letter",
width: paper-width,
height: paper-height,
margin: margin,
numbering: "1",
header: locate(loc =>
if loc.page() != 1 {
align(right)[#text(size: 10pt)[
#class\
#real_title\
#authors.fold("", (acc, author) => acc + h(1em) + author)
]]
}
)
)
set par(
first-line-indent: 0in,
justify: true,
)
set text(
size: 12pt,
)
set heading(
numbering: none,
)
_content-area-size.update((
width: paper-width - margin.at("x") * 2,
height: paper-height - margin.at("y") * 2
))
// title
align(center)[
#block(text(weight: 700, 1.75em, real_title))
]
// class info
align(center)[
#class
]
// date
align(center)[
#date
]
// Author information.
pad(
top: 0.5em,
bottom: 0.5em,
grid(
columns: (1fr,) * calc.min(3, authors.len()),
gutter: 1em,
..authors.map(author => align(center, strong(author))),
),
)
doc
}
|
https://github.com/leesum1/brilliant-cv | https://raw.githubusercontent.com/leesum1/brilliant-cv/master/modules_en/projects.typ | typst | // Imports
#import "@preview/brilliant-cv:2.0.2": *
#import "@preview/fontawesome:0.4.0": *
#let metadata = toml("../metadata.toml")
#let cvSection = cvSection.with(metadata: metadata)
#let cvEntry = cvEntry.with(metadata: metadata)
#cvSection("Projects & Associations")
#cvEntry(
society: [One Student One Chip - Phase IV],
title: link("https://docs.qq.com/sheet/DY0tRa2hMdUh1aXdD?tab=BB08J2")[#fa-icon("link") Study Record #hBar() ] + link(
"https://ysyx.oscc.cc/project/intro-past.html#%E7%AC%AC%E5%9B%9B%E6%9C%9F",
)[#fa-icon("link") Tapeout Certification],
date: [June 2022 - November 2022],
location: [Student ID: ysyx_22041514],
description: list(
[Designed a classic 5-stage pipeline processor NPC in Verilog supporting the RISCV64IM ISA, M U privilege modes, ICache,
DCache, static branch prediction, and AXI4 bus.],
[Developed NEMU (a RISC-V emulator) in C, supporting the RISCV64IM ISA and MU privilege modes.],
[Successfully ran RT-Thread OS, and nanos-lite OS on NPC and NEMU, ported the LVGL graphics library.],
[Completed all content of the 4th "One Student One Chip," passed the final assessment, and successfully integrated NPC to
the ysyx-SOC using the AXI4 bus.],
),
)
#cvEntry(
society: link("https://github.com/leesum1/RV64emu-rs")[RV64emu-rs],
title: link("https://github.com/leesum1/RV64emu-rs")[#fa-icon("github") leesum1/RV64emu-rs],
date: [December 2022 - now],
location: [RV64emu-rs is a RISC-V emulator written in Rust],
description: list(
[Developed an emulator in Rust supporting the RISCV64IMAC ISA and MSUD privilege modes.],
[Added ICache, DCache, TLB, and Decode Cache to accelerate program execution.],
[Implemented a comprehensive device framework and added peripherals such as PLIC, CLINT, VGA, UART, Keyboard, and Mouse.],
[Successfully ported the RT-Thread OS and ran complex applications like LVGL demo; Additionally, I ported the mainline
Linux kernel, allowing it to run shell programs such as ls, top, and others.],
[Successfully ported the emulator to ESP32-S3 board using embedded Rust, and enabling it to boot Linux.],
[Implemented Debug mode in compliance with the RISC-V debug specification, enabling OpenOCD/GDB to interface with the
emulator via SimJTAG for operations such as register and memory read/write, single-step execution, watchpoints, and
breakpoints.],
),
)
#cvEntry(
society: link("https://github.com/leesum1/FishCore")[FishCore],
title: link("https://github.com/leesum1/FishCore")[#fa-icon("github") leesum1/FishCore],
date: [June 2023 - now],
location: [FishCore is a RISC-V core written in Chisel],
description: list(
[Implemented a processor supporting the RISCV64IMAC ISA and MSUD privilege modes using Chisel.],
[Developed configurable ICache (VIPT) and DCache (PIPT), as well as a fully associative TLB cache to accelerate processor
performance.],
[Implemented a multi-level branch prediction framework in the frontend pipeline to ensure branch prediction accuracy, and
implemented in-order dual-issue and out-of-order execution scheduling in the backend.],
[Supported various peripherals such as PLIC, CLINT, UART, MEM, and interconnected them through an AXI4 bus to build a
minimal SOC system (FishSOC) capable of running Linux successfully.],
[Implemented Debug mode according to the RISC-V debug specification, allowing OpenOCD/GDB to connect to the processor via
SimJTAG for operations like register read/write, memory read/write, single-step execution, watchpoints, and breakpoints.],
[Gained experience and implemented concepts such as AXI4 bus, bus arbitration, and cross-clock domain handshaking
throughout the project.],
),
)
|
|
https://github.com/TypstApp-team/typst | https://raw.githubusercontent.com/TypstApp-team/typst/master/tests/typ/layout/hide.typ | typst | Apache License 2.0 | // Test the `hide` function.
---
AB #h(1fr) CD \
#hide[A]B #h(1fr) C#hide[D]
|
https://github.com/jgm/typst-hs | https://raw.githubusercontent.com/jgm/typst-hs/main/test/typ/layout/terms-02.typ | typst | Other | // Test multiline.
#set text(8pt)
/ Fruit: A tasty, edible thing.
/ Veggie:
An important energy source
for vegetarians.
|
https://github.com/pklaschka/typst-hidden-bib | https://raw.githubusercontent.com/pklaschka/typst-hidden-bib/main/README.md | markdown | MIT License | # Typst Hidden-Bib
[GitHub Repository including Examples](https://github.com/pklaschka/typst-hidden-bib)
A Typst package to create hidden bibliographies or bibliographies with unmentioned (hidden) citations.
## Use Cases
### Hidden Bibliographies
In some documents, such as a letter, you may want to cite a reference without printing a bibliography.
This can easily be achieved by wrapping your `bibliography(...)` with the `hidden-bibliography` function after importing the `hidden-bib` package.
The code then looks like this:
```typ
#import "@preview/hidden-bib:0.1.0": hidden-bibliography
#lorem(20) @example1
#lorem(40) @example2[p. 2]
#hidden-bibliography(
bibliography("/refs.yml")
)
```
_Note that this automatically sets the `style` option to `"chicago-notes"` unless you specify a different style._
### Hidden Citations
In some documents, it may be necessary to include items in your bibliography which weren't explicitly cited at any specific point in your document.
The code then looks like this:
```typ
#import "@preview/hidden-bib:0.1.0": hidden-cite
#hidden-cite("example1")
```
### Multiple Hidden Citations
If you want to include a large number of items in your bibliography without having to use `hidden-cite` (to still get autocompletion in the web editor), you can use the `hidden-citations` environment.
The code then looks like this:
```typ
#import "@preview/hidden-bib:0.1.0": hidden-citations
#hidden-citations[
@example1
@example2
]
```
## FAQ
### Why would I want to have hidden citations and a hidden bibliography?
You don't. While this package solves both (related) problems, you should only use one of them at a time. Otherwise, you'll simply see nothing at all.
### Why would I want to have hidden citations?
That's for you to decide. It essentially enables you to include "uncited references", similar to LaTeX's `\nocite{}` command.
## License
This package is licensed under the MIT license. See the [LICENSE](./LICENSE) file for details.
|
https://github.com/Area-53-Robotics/53E-Notebook-Over-Under-2023-2024 | https://raw.githubusercontent.com/Area-53-Robotics/53E-Notebook-Over-Under-2023-2024/giga-notebook/entries/build-catapult-upgrade/entry.typ | typst | Creative Commons Attribution Share Alike 4.0 International | #import "/packages.typ": notebookinator
#import notebookinator: *
#import themes.radial.components: *
#show: create-body-entry.with(
title: "Build: Catapult Upgrade",
type: "build",
date: datetime(year: 2023, month: 10, day: 31),
author: "<NAME>",
witness: "<NAME>",
)
#grid(
columns: (2fr, 1fr),
gutter: 20pt,
[
After the scrimmage it was evident that our catapult needed some upgrades. The
most pressing issue was the lack of power. The catapult couldn't shoot over the
barrier, making it almost useless. We couldn't add more rubber bands due to the
motor running out of torque, so we'll need to find another solution.
#heading[Longer Arm]
The following equations show that the velocity of an object rotating around a
fixed point is directly proportional to the radius of the movement, and that
kinetic energy is greatly increased by by velocity.
#admonition(type: "equation")[
$ v = r #sym.omega $
$ E_k = 1/2 m v^2 $
]
This means that we can improve the catapult's output simply by making the arm
longer.
#heading[Rotation Sensor]
We noticed that the limit switch we were using didn't work very well. It didn't
get consistently pressed, and had to be bent to get into the correct position.
In addition, the catapult has no concept of how far away it is from the targeted
position.
We replaced the limit switch with a rotation sensor. This sensor is not only
more accurate, but it also doesn't forget the position of the catapult when the
program is turned off.
#heading[New Ratchet]
With the rotation sensor replacing the old ratchet, we needed to reposition it.
We used a design inspired from one of 7686B's Spin Up robots #footnote(link("https://www.youtube.com/watch?v=giECYNrFSWM")).
This design consists of a pillow bearing interfacing with a gear below.
],
[
#figure(image("./iso.jpg", width: 75%), caption: "Lengthened arm")
#figure(image("./sensor.jpg", width: 75%), caption: "New sensor")
#figure(
image("./ratchet.jpg", width: 75%),
caption: "Ratchet, with temporary 3D printed gear",
)
],
)
|
https://github.com/DashieTM/nix-introduction | https://raw.githubusercontent.com/DashieTM/nix-introduction/main/nix.typ | typst | #import "./utils.typ": *
#set page(paper: "presentation-16-9")
#set text(size: 20pt, font: "DejaVu Sans")
// #set text(size: 20pt,
#pdfpc.config(
default-transition: (
type: "push", duration-seconds: 0.2, angle: rtl, alignment: "vertical", direction: "outward",
),
)
// pdfpc ReSetPresentation.pdf --duration=35 --last-minutes=25
//
// in /home/dashie/.config/pdfpc/pdfpcrc
//
// option current-size 50
// option current-height 50
// option next-height 40
// option transition-fps 90
#polylux-slide[
#align(horizon + center)[
= Nix
#image("./figures/nix.png", width: 150pt)
<NAME>
07.07.2024
]
]
#set page(background: regular_page_design(), footer: default_footer())
#show heading.where(level: 3).or(heading.where(level: 2)): content => [
#content
#v(-20pt)
#line(
start: (0%, 0%), end: (97%, 0%), stroke: 2pt + gradient.linear(black, white),
)
]
#polylux-slide[
== Table of Contents
#v(15pt)
- Nix the language
- NixOS
- Home-manager
- Flakes
- Specializations
#pdfpc.speaker-note(```md
- context -> what is nix ? - why do we even use it? just another linux distro?
```)
]
#include "./topics/nix-lang.typ"
#include "./topics/nixos.typ"
#include "./topics/homemanager.typ"
#include "./topics/flakes.typ"
#include "./topics/specializations.typ"
|
|
https://github.com/weeebdev/cv | https://raw.githubusercontent.com/weeebdev/cv/main/modules/projects.typ | typst | Apache License 2.0 | #import "../brilliant-CV/template.typ": *
#cvSection("Projects & Associations")
#cvEntry(
title: [Volunteer Translator],
society: [WikigapKazakhstan, Wikipedia],
date: [Mar 2021 - Apr 2021],
location: [Almaty, Kazakhstan],
description: list(
[Participated in the \#WikigapKazakhstan project to close the gender gap on Wikipedia],
)
)
#cvEntry(
title: [Volunteer Translator],
society: [notabenoid],
date: [Jul 2016 - Present],
location: [Remote],
description: list(
[Occasionally translate shows/books/games/etc on a closed translators community notabenoid.org]
)
)
#cvEntry(
title: [Volunteer Developer],
society: [GitHub],
date: [Jul 2019 - Present],
location: [Remote],
description: list(
[Issue bugs and features in various projects],
[Solve them],
[Participate in discussions],
[Create my own projects],
)
)
|
https://github.com/artemist/typstcard | https://raw.githubusercontent.com/artemist/typstcard/canon/labels_lettersheet.typ | typst | #{
set page("us-letter", margin: 0em)
import "common.typ"
let options = json("options.json")
let cards = options.cards
let args = options.args
let printer_offset = 1in/16
let label_position(idx) = {
let offset_idx = idx + args.skip
let col = calc.rem(offset_idx, 3)
let row = calc.rem(calc.floor(offset_idx / 3), 10)
let x_pos = 3in/16 + 2.75in * col
let y_pos = printer_offset + 1in/2 + 1in * row
(x_pos, y_pos)
}
for (idx, card) in cards.enumerate() {
if idx != 0 and calc.rem(idx + args.skip, 30) == 0 {
pagebreak()
}
let (dx, dy) = label_position(idx)
place(
top + left,
dx: dx,
dy: dy,
common.address_block(2in + 5in/8, 7in/8, card)
)
}
}
|
|
https://github.com/typst/packages | https://raw.githubusercontent.com/typst/packages/main/packages/preview/chuli-cv/0.1.0/README.md | markdown | Apache License 2.0 | # CV in Typst
These are a minimalistic and modern CV and cover letter written in Typst.
![thumbnail](thumbnail.png)
## Setup
- Install [Typst](https://typst.app) and the font awesome fonts on your system, see [guide](https://github.com/duskmoon314/typst-fontawesome).
- Run `typst init @preview/chuli-cv:0.1.0` to start your own CV.
## Inspiration
- [brilliant-CV](https://github.com/mintyfrankie/brilliant-CV).
- [light-cv](https://github.com/AnsgarLichter/light-cv).
- [Awesome CV
](https://github.com/posquit0/Awesome-CV).
- [<NAME> CV](https://www.overleaf.com/articles/ritabh-ranjans-cv/ngtndgryfykt).
- [hipster-cv](https://github.com/latex-ninja/hipster-cv).
|
https://github.com/bpkleer/typst-modern-acad-cv | https://raw.githubusercontent.com/bpkleer/typst-modern-acad-cv/main/template/example.typ | typst | MIT License | // #import "modern-acad-cv.typ": *
#import "@preview/modern-acad-cv:0.1.0": *
// loading meta data and databases (needs to be ad this directory)
#let metadata = yaml("metadata.yaml")
#let multilingual = yaml("dbs/i18n.yaml")
#let work = yaml("dbs/work.yaml")
#let education = yaml("dbs/education.yaml")
#let grants = yaml("dbs/grants.yaml")
#let refs = yaml("dbs/refs.yaml")
#let conferences = yaml("dbs/conferences.yaml")
#let talks = yaml("dbs/talks.yaml")
#let committee = yaml("dbs/committee.yaml")
#let teaching = yaml("dbs/teaching.yaml")
#let training = yaml("dbs/training.yaml")
#let skills = yaml("dbs/skills.yaml")
// set the language of the document
#let language = "en"
// defining variables
#let headerLabs = create-headers(multilingual, lang: language)
#show: modern-acad-cv.with(
metadata,
multilingual,
lang: language,
font: "Fira Sans",
show-date: true
)
= #headerLabs.at("work")
#cv-auto-stc(work, multilingual, lang: language)
= #headerLabs.at("education")
#cv-auto-stp(education, multilingual, lang: language)
= #headerLabs.at("grants")
#cv-auto-stp(grants, multilingual, lang: language)
= #headerLabs.at("pubs")
#cv-cols(
"",
for lang in multilingual.lang.keys() {
if language == lang [
#multilingual.lang.at(lang).pubs-note
]
}
)
== #headerLabs.at("pubs-peer")
#cv-refs(refs, multilingual, tag: "peer", me: [Mustermensch, M.], lang: language)
== #headerLabs.at("pubs-edited")
#cv-refs(refs, multilingual, tag: "edited", me: [Mustermensch, M.], lang: language)
== #headerLabs.at("pubs-book")
#cv-refs(refs, multilingual, tag: "book", me: [Mustermensch, M.], lang: language)
== #headerLabs.at("pubs-reports")
#cv-refs(refs, multilingual, tag: "other", me: [Mustermensch, M.], lang: language)
== #headerLabs.at("pubs-upcoming")
#cv-refs(refs, multilingual, tag: "planned", me: [Mustermensch, M.], lang: language)
= #headerLabs.at("confs")
== #headerLabs.at("confs-conf")
#cv-cols(
"",
headerLabs.at("exp-confs")
)
#cv-auto-list(conferences, multilingual, lang: language)
== #headerLabs.at("confs-talks")
#cv-auto(talks, multilingual, lang: language)
= #headerLabs.at("committee")
#cv-auto(committee, multilingual, lang: language)
= #headerLabs.at("teaching")
== #headerLabs.at("teaching-thesis")
#if language == "de" [
#cv-two-items[Bachelor][9][Master][2]
] else if language == "en" [
#cv-two-items[Bachelor][9][Master][2]
] else if language == "pt" [
#cv-two-items[Graduação][9][Pós-Graduação][2]
] else [
#cv-two-items[Bachelor][9][Master][2]
]
== #headerLabs.at("teaching-courses")
#cv-table-teaching(teaching, multilingual, lang: language)
= #headerLabs.at("training")
#cv-auto-cats(training, multilingual, headerLabs, lang: language)
= #headerLabs.at("others")
#cv-auto-skills(skills, multilingual, metadata, lang: language)
|
https://github.com/EstebanMunoz/typst-template-auxiliar | https://raw.githubusercontent.com/EstebanMunoz/typst-template-auxiliar/main/README.md | markdown | MIT No Attribution | # typst-template-auxiliar
Template para la creación de clases auxiliares usando Typst.
|
https://github.com/magicwenli/keyle | https://raw.githubusercontent.com/magicwenli/keyle/main/README.md | markdown | MIT License | # keyle
<p align="center">
<a href="https://raw.githubusercontent.com/magicwenli/keyle/main/doc/keyle.pdf">
<img alt="Documentation" src="https://img.shields.io/website?down_message=offline&label=manual&up_color=007aff&up_message=online&url=https://raw.githubusercontent.com/magicwenli/keyle/main/doc/keyle.pdf" />
</a>
<a href="https://github.com/magicwenli/keyle/blob/main/LICENSE">
<img alt="MIT License" src="https://img.shields.io/badge/license-MIT-brightgreen">
</a>
</p>
A simple way to style keyboard shortcuts in your documentation.
This package was inspired by [auth0/kbd](https://auth0.github.io/kbd/) and [dogezen/badgery](https://github.com/dogezen/badgery). Also thanks to [tweh/menukeys](https://github.com/tweh/menukeys) -- A LaTeX package for menu keys generation.
Document generating using [jneug/typst-mantys](https://github.com/jneug/typst-mantys).
Send them respect and love.
## Usage
Please see the [keyle.pdf](https://github.com/magicwenli/keyle/blob/main/doc/keyle.pdf) for more documentation.
`keyle` is imported using:
```typst
#import "@preview/keyle:0.2.0"
```
### Example
#### Custom Delimiter
```tpy
#let kbd = keyle.config()
#kbd("Ctrl", "Shift", "K", delim: "-")
```
![Custom Delimiter](test/test-1.png)
#### Compact Mode
```tpy
#let kbd = keyle.config()
#kbd("Ctrl", "Shift", "K", compact: true)
```
![Compact Mode](test/test-2.png)
#### Standard Theme
```tpy
#let kbd = keyle.config(theme: keyle.themes.standard)
#keyle.gen-examples(kbd)
```
![Standard Theme](test/test-3.png)
#### Deep Blue Theme
```tpy
#let kbd = keyle.config(theme: keyle.themes.deep-blue)
#keyle.gen-examples(kbd)
```
![Deep Blue Theme](test/test-4.png)
#### Type Writer Theme
```tpy
#let kbd = keyle.config(theme: keyle.themes.type-writer)
#keyle.gen-examples(kbd)
```
![Type Writer Theme](test/test-5.png)
#### Biolinum Theme
```tpy
#let kbd = keyle.config(theme: keyle.themes.biolinum, delim: keyle.biolinum-key.delim_plus)
#keyle.gen-examples(kbd)
```
![Biolinum Theme](test/test-6.png)
#### Custom Theme
```tpy
// https://www.radix-ui.com/themes/playground#kbd
#let radix_kdb(content) = box(
rect(
inset: (x: 0.5em),
outset: (y:0.05em),
stroke: rgb("#1c2024") + 0.3pt,
radius: 0.35em,
fill: rgb("#fcfcfd"),
text(fill: black, font: (
"Roboto",
"Helvetica Neue",
), content),
),
)
#let kbd = keyle.config(theme: radix_kdb)
#keyle.gen-examples(kbd)
```
![Custom Theme](test/test-7.png)
## License
MIT
|
https://github.com/polarkac/MTG-Stories | https://raw.githubusercontent.com/polarkac/MTG-Stories/master/stories/032%20-%20Ixalan/001_Jace%2C%20Alone.typ | typst | #import "@local/mtgstory:0.2.0": conf
#show: doc => conf(
"<NAME>",
set_name: "Ixalan",
story_date: datetime(day: 06, month: 09, year: 2017),
author: "<NAME> & <NAME>",
doc
)
The man opened his eyes.
He lay on his back, looking up through a canopy of delicate green toward the darkening blue of the sky. Stalks of bamboo were rustling in a warm, drowsy breeze. He could feel through his bruises (and a tremendous headache) that the ground beneath him was plush with fallen leaves. It was quiet here, under the bamboo. The air tasted faintly of salt, and he could hear waves in the distance.
Something snapped a twig to the man's left. He startled and spun his head searching for the source of the sound, then froze.
#figure(image("001_Jace, Alone/01.jpg", width: 100%), caption: [Art by <NAME>], supplement: none, numbering: none)
It was a lizard-like thing covered in brilliant blue and yellow feathers. Standing on its hind legs and clutching an egg between its oversized claws, the creature briefly turned its orange eyes to regard the man on the ground. It gave a small chirp before continuing on its way, kicking up a few leaves as it trotted by. A moment later it was gone, disappearing as quickly as it had come.
The man took a moment to process the encounter. The lizard-thing was novel, but everything else about his current situation manifested a curious sense of déjà vu.
He lifted his head for a better look at himself. He wore a blue cloak, long pants, and a tight leather breastplate.
None of it looked familiar.
The man sat up and groaned with the effort. He stood and began to stumble his way out, following the path of the lizard-thing.
The bamboo thicket gave way to a sparser stand of palms, and likewise the rich soil of the forest floor grew thinner and sandier as the space between trees grew wider. The man could hear the waves grow louder and stumbled faster toward the water.
He emerged onto an endless beach. The sand beneath his boots was soft as flour. The air was thick and humid—he felt soaked even though he stood on dry land. A few rock structures formed a natural arch between the beach and the sea, and the lush jungle formed a harsh and immediate wall at the edge of the sand.
The man looked up. The sun was starting to descend in the distance, and he could hear the calls of seabirds darting through the sky above.
He looked in either direction down the beach.
"Hello?"
The gentle tide lapped at his boots.
"HELLO?!" He called, fear creeping into his voice.
As logical explanations were methodically checked off his mental list, the man drew closer and closer to a state of panic.
He did not know how he had gotten here. He did not know his own name. He did not know where this jungle was, or why he was on a beach, or what in the world that lizard-thing was. Why was he covered in bruises? And why did his head hurt? And what the hell did he need to do to get out of here?
An image of an unfamiliar place flashed through the man's mind—color and light and the idea of #emph[away.] The man felt a tingle run down the back of his neck—and in a refreshingly cool rush of energy, he felt his entire body attempt to break apart from itself, particles flickering and vanishing, his physical form wavering between one place and another. It was pleasant, familiar . . . comforting. He had done this before. His body was dissolving and breaking apart—it should have felt terrible, but instead it felt like #emph[him. ] He pushed toward the feeling, praying that if more of his body vanished, then more of his mind would return—only to feel himself #emph[yanked ] #emph[backward, pulled by some massive force back through whatever metaphysical door he had begun to walk through. Away and away and down and down until he smashed ] back together on the same beach he tried to depart. He fell to the ground with the shock of it.
#figure(image("001_Jace, Alone/02.jpg", width: 100%), caption: [Art by <NAME>], supplement: none, numbering: none)
A shining triangle enclosed by a circle appeared in the air above him, and the man gasped through mended lungs.
The pleasant chill receded. His body was whole, his hands were clammy with sweat, and his knees sunk into the sand.
The man drew in breath after panicked, ragged breath. His heart beat a bruise against the inside of his chest.
The man gripped his fists in confusion, took a full breath, and yelled the most illustrative swear he could think of. A single, long, satisfying word, and into it he poured all the confusion and frustration he could muster.
He finally stopped and could only hear the rhythm of waves lapping the shore.
Night was settling in.
He took stock of his physical state. His bruises and aching muscles needed rest more than anything else—food and water could wait until the morning.
He sat on the sand for some time trying to recall how he had arrived, but the only thing he could remember was the swaying of bamboo when he first opened his eyes.
After trying to remember how he got here, he tried to remember his name.
The man remembered plenty of names. Lazlo was a name. So was Sam. But he didn't think either of those names belonged to him.
He then decided he could figure out how he got here in other ways.
There were no people about, so the man took off his heavy leather breastplate, cloak, and gloves. He removed his shirt and trousers, folded them neatly, and laid them on the sand, sighing as he felt the relief of a cool breeze on his skin. He looked down at his belongings, then paused as he looked at his ungloved right hand for the first time.
A scar ran in a perfect line down his right forearm. It was straight as a surgeon's cut; someone had intentionally done this.
The man assessed himself for further clues. He was bruised from recent battle, but he could feel several more of the deep, stick-straight scars running along his back. Were these as old as the scar on his arm? Who had done this to him?
The man put one of his gloves back on over the scar and made a note to ruminate on this evidence later. He looked down at the clothes laying on the sand.
The man tried to imagine who would wear these.
Whoever this person was came from somewhere much colder, that was certain. The materials were heavy, built for rain (he remembered rain!) and brisk chill. The cloak was a bit much—it was not a gaudy thing, per se, but its pattern belied any semblance of subtlety. The undershirt was stained with sweat, so he must have been walking through the heat for some time. Most curious of all were the boots. A few grains of sand were trapped inside against the sole, but the type of sand from his shoes had a different grit than that of the beach around him. This evidence was courser, rougher, a rich golden yellow compared to the soft white beneath him.
The man frowned. There were no supplies. No knife. No food, no rope, no personal items. Whoever this person was seemingly didn't bother to carry weapons.
Was he that idiotic, to travel so unsafely? He didn't think so, but the evidence was concerning. Perhaps his weapons were taken from him? Unlikely—there didn't seem to be anyone near.
The symbol on the cloak caught his attention.
It was . . . familiar.
Why was it familiar?
The moon was high in the sky now, and the man would need to sleep. He decided to mull over the meaning of the symbol later.
He stomped over to a washed-up log and lay down on the beach. Part of him worried about the lizard from earlier—perhaps it ate people too? Not just eggs? A flawed line of thinking—if it ate humans it most likely would have attacked earlier—but perhaps there were others of its kind with bigger appetites.
The man felt terribly exposed.
He threw his cloak over himself and screwed his eyes closed, wishing desperately he would sleep through the night without being detected by whatever else might live on this island.
The man drifted to sleep with a tingle on the back of his neck and tucked his legs close. He tossed and turned on the sand of the beach, completely asleep—and unbeknownst to him, utterly invisible.
#v(0.35em)
#line(length: 100%, stroke: rgb(90%, 90%, 90%))
#v(0.35em)
The man awoke with the sun the next morning and, still having no idea who he was, decided to focus on taking care of his physical needs.
He began by familiarizing himself with his new home.
#figure(image("001_Jace, Alone/03.jpg", width: 100%), caption: [Art by Titus Lunter], supplement: none, numbering: none)
#figure(image("001_Jace, Alone/04.jpg", width: 100%), caption: [Art by Titus Lunter], supplement: none, numbering: none)
#figure(image("001_Jace, Alone/05.jpg", width: 100%), caption: [Art by Titus Lunter], supplement: none, numbering: none)
Having learned the size of the island (a day's hike in circumference), he chose a spot shaded by a rocky outcropping and protected from the wind to make his home. He built a shelter where the trees met the beach. The labor of hoisting foraged sticks and tying posts with peeled bark caused the man to realize how little exercise he must have been getting before he lost his memory. His muscles were flimsy from disuse, and the man wondered again how his prior self had intended to survive here without weapons or tools. He grew stronger as he worked, though, and despite blisters and sunburns, he managed to construct a covered platform upon which to sleep.
Food required a bit more trial and error, but the man was excited to learn what his likes and dislikes were. He fashioned a simple knife from a sharp stone and set about taste-testing. He liked oysters. He liked whatever the orange fruit was. He liked the long green fruit and the small red berries, but not the violet root vegetables. Those made his tongue itchy, which he attributed to a newly discovered allergy. How fascinating!
What he really needed to learn was how to build a fire.
The sun was rapidly sinking, and a few clouds were rolling in on the horizon.
A second blister began to form on his right palm. He grunted with effort, rubbing a stick between his tired hands as quickly as possible, ignoring the pain and the pus, and the droplet of rain that had just fallen on his neck. He counted the beat of the waves behind him (six crashes per minute) and began to replicate the rhythm in his mind, so the rubbing of the stick pattered a beat along with the waves. His hands were hot with strain, and his brow knit with concentration.
A thin trickle of smoke rose from the point where his stick met the driftwood, and he laughed, trying as he could to keep the little fire alight.
The stick snapped in two.
And the tiny wisp of smoke vanished.
His eyes went wide in shock, and a whimper of disappointment that descended into a growl of frustration escaped his throat.
"#emph[Useless] island!"
The man sat back on the sand, elbows on his knees, and stared at the broken stick laying atop of the log. A sad pile of twigs and dry leaves lay to either side.
The man groaned and leaned back until he lay flat on the beach.
An albatross was gliding in lazy circles far above his head.
The man groaned a second time.
"Why do I know what an albatross is?" he asked aloud.
The albatross didn't respond.
The man sat up and looked down, narrowing his eyes at the pile of twigs.
Maybe he could #emph[will] fire into being.
He wiped the sand from his pants and felt the sting of a sunburn as he leaned forward, his gaze locked on the pile in front of him.
He concentrated and felt another trickle of rain fall on his bare back as the chill of the overcast sky set into his bones.
The man needed fire. He #emph[needed ] fire more than #emph[absolutely anything else in the world—]
The hair at the back of his neck stood up as a tingle went down his spine.
A little stream of smoke began to rise from the log.
He leaped to his feet and backed away. Smoke?! Smoke!
Part of him was alarmed—was this real?!—but the rest of him was too ecstatic to care. The man laughed in surprise and yelled, "I did it!"
The smoke began to gush upward. The man dropped to his knees and started feeding tiny twigs and leaves into the flame, laughing all the while. He could have cried; he was so happy.
The man scrambled to his feet and began dumping in more and more branches, leaves, and bits of driftwood. He didn't care if he used up all his fuel, he #emph[needed] fire.
The flame had bloomed into a cozy little campfire now. The man's face pulled wide into a grin. A little laugh escaped him, and he laced his fingers above his head. He stepped back to admire his work.
The fire was the most beautiful thing he had ever seen. He assumed he had seen more beautiful things, but as he could not remember them, they were irrelevant and incomparable to the current beauty in front of him. #emph[This ] was lovelier than any painting and more precious than any jewel.
The growl of the man's stomach interrupted the moment.
Right! Food! He needed to eat food!
He had found a fish washed up on the beach earlier. It was an ugly, ancient-looking thing, with flat, diamond-shaped scales and a vacant look on its dead face.
The man stabbed the fish through with a stick and held it over the flame.
He sat back, ready to rotate it when one side was done.
But the fish merely stared at him.
Its scales didn't burn. It didn't sizzle. It didn't char. The fish was awash in flame, but not once did it show any sign of being cooked.
The man was confused.
He put out a hand to feel the fire and realized it was not hot.
His confusion turned to dread, and he thrust his hand directly into the flames.
The fire was as cold as the dead fish.
The man pulled his hand to his chest and scrambled away from the fire in fear.
"What?! No! No no no no no!"
The flame flickered a brilliant blue—blue?!—then unceremoniously vanished.
But he had #emph[seen ] the smoke! He'd #emph[seen ] the fire consume the kindling below! And yet not once did he feel its heat before the fire's evidence vanished.
The man's dread tumbled into absolute panic.
He backed up against a palm tree and stared down at the fish on the stick in horror, quickly sifting through the evidence and landing at a reasonable conclusion.
He was trapped, without memory, without food, shelter, or skill . . . and now, to top it all off, he was losing his grip on reality.
The man solemnly concluded that he had gone insane.
#v(0.35em)
#line(length: 100%, stroke: rgb(90%, 90%, 90%))
#v(0.35em)
It had been quite some time since the incident with the fish, and the man had come to accept that things were much simpler now that he had lost his mind.
If it was true that his mind was disconnected from reality, then he needn't worry about the logistics of how he had arrived or who he had been before. His sanity was irrelevant if the only truth he could experience was his current reality.
How freeing it was to come to that realization!
And so, the man set about doing things that a person who believed they were trapped on an island would do.
He delighted in building new tools. A basket woven from stick, a simple snare, even a sharpened knife to open oysters with. The man set about to make a new tool every day, and took pride in every single one. It was almost #emph[fun ] having endless amounts of time with which to build new solutions to his problems.
As he explored and learned, he became used to the visions he would see along the way.
Some had more shape than others. Usually they were humanoid, with faces and voices of their own.
A woman with snow-white skin and elaborate white hair who would float behind him, taking note of his actions in a journal. A bailiff, stern faced with a blue cape and silver armor. A leonin missing an eye.
In his moments of loneliness, he would sometimes see a woman in violet on the edge of his field of vision. A tug of anxiety gripped his chest whenever she walked by.
The man knew these were hallucinations, knew they were not real.
#emph[They had no power over me. Right?]
He ignored the visions as they came and went, but sometimes they refused to be ignored.
"You've really done it this time, haven't you?"
This vision appeared whenever the man was struggling at a task.
His shoulders were broad, and his olive skin had a sheen of sweat underneath the shine of his armor. The hallucination was looking over the man's shoulder as he tried to carve a fishing hook.
"Listen, you aren't really suited to this task. Let me handle it." The vision's voice was gruff but friendly.
It came off as condescending.
The man was annoyed.
"I can do it myself."
The hallucination sighed. "You and I both know you're not suited to this. Let me handle it, you go philosophize on the other end of the beach."
"I said I can do it myself." The man let his irritation reach his voice.
"No, you can't. I call the shots and execute, you stand to the side. That's how this works."
The man responded by throwing his hook at the hallucination. It went straight through the figure's eye and landed behind him on the sand.
#v(0.35em)
#line(length: 100%, stroke: rgb(90%, 90%, 90%))
#v(0.35em)
The hallucinations appeared more frequently as his boredom grew.
"Policies and procedures, section 12, item 4."
He gasped in surprise. A woman with dark hair and a cane was staring at him from a few feet away down the beach. She wore a white dress with a sun emblem on its front. A dark cloak hung behind her and grazed the sand, and her expression made it clear that she was on a mission.
She impatiently tapped a finger on the handle of her cane.
"I said, 'Policies and procedures section 12, item 4. Official guild representatives may be granted passage from one guild-controlled place of residence or business to another by virtue of an official warrant'. Do you or do you not agree that that is a standing law?"
She followed him from snare to snare, peered over his shoulder as he reset the traps, and glared at him all the while as he carried the lizards he had caught back to camp to cook.
He buried the lizards with hot coals, palm leaves, and root vegetables to cook for the rest of the afternoon. In time, the hallucination vanished, and the man sighed in relief.
He sat for a while, listening to the shorebirds above, and decided to stave off boredom building a bonfire on the beach.
He spent his morning heaving log after log onto the flames, hoping the smoke would rise far enough for a ship to take notice. It hadn't yet, but perhaps it would today.
His optimism was waning.
He set down his braided-palm hat on the sand. The heat from both the fire and the noon sun was overwhelming. He walked away from the fire and waded into the sea.
The water was warm in the shallows, but a relief from the heat all the same. It stung his sunburn, and under the waves he could see small fish darting back and forth.
He could feel the pull of the tide against his legs.
Taste the salt on the edge of his lips.
Smell the smoke of the bonfire from the beach mingling with the scent of washed-up kelp.
It all felt . . . real.
Real in a way that his insanity shouldn't allow him to feel.
The man considered his perception of reality.
There was another explanation for all of this. For the strange disappearing and reappearing that his body had done earlier and for the fire that wasn't actually fire.
#emph[What if my hallucinations are expressions of magic?]
He knew magic existed. He knew there existed people who could manipulate fire or summon lightning or grow trees where none grew before, but he did not know their names. Did not know their faces.
He had forgotten everything else about himself . . . could he have forgotten such a crucial part of what made him #emph[him] ?
The man ran a wet hand through his hair. He went out deeper in the water, letting the waves lap at his bearded cheeks.
The thought felt . . . correct. "I can wield magic" was a thought that came to the man as simply and truly as "I am a man" or "I dislike crocodiles."
He closed his eyes and willed himself to find that #emph[thing] , that chill at the back of his neck and that ripple of power within. He searched inside his mind and willed himself to create.
The man opened his eyes, and saw a vision of himself standing on top of the water in front of him.
The image had a blank expression on its face, but was otherwise identical to the man himself, standing calmly—impossibly—on the surface of the water.
The man's jaw fell open in shock.
The illusion appeared solid as flesh, and its detail was astonishingly accurate. The man was amused he did not remember his name but remembered the exact details of his own body: muscles toned, stubble on its face, blistered sunburn on its bare shoulders. He even saw its scars—#emph[his] scars—the little bookmarks of a life well-lived.
The man reached out and tried to touch the illusion's leg. His fingers passed through it as they would through the air.
Incredible.
The man stood up, his waist at water level and his hands at his sides.
The man grinned from ear to ear.
He concentrated, felt that familiar chill on his neck, and the illusion vanished.
His grin erupted into a cry of joy.
The man ran to shore, kicking up sand as he went.
"I've been manifesting fragments of memory! I'm not hallucinating—I've been creating illusions! #emph[I am a mage!] "
He held out a hand and willed an illusory draft horse into being. The thing materialized through a soft haze of blue, and it ran a heavy canter around the man. He reached out to touch it and easily passed a hand through its dappled grey side. The illusion ran past, leaping through his signal fire and loping up and down the beach, a graceful streak of cloudy night against the harsh white of the sand.
The man laughed at the madness of it all. He laughed at his own ability, his foolishness, but most of all in that moment, he laughed that the other inhabitants of the beach thought his creation was #emph[real. ] Seagulls took flight when the horse approached, insects flew close to try and rest on its back, and though it left no mark in the sand, this creation felt more real than any fire, spear, or net ever had. His imagination was too great to contain, and his mind was as boundless as he wished. The man had no need for a name or a past, for in that moment he knew #emph[exactly] who he was.
The man dispelled the horse and created an elephant, dispelled the elephant and created a sea monster, dispelled the sea monster and turned the day into night, filling the beach with an endless array of delicate stars.
He laughed until he cried.
After a moment of happy tears surrounded by an endless galaxy of illusory stars, his heart became heavy.
He was standing in an endless night, a perfect void dotted with small bursts of light.
The man was incredibly alone.
He vanished the illusion of the stars and the night and was met with an equally empty beach.
#v(0.35em)
#line(length: 100%, stroke: rgb(90%, 90%, 90%))
#v(0.35em)
The next day, he realized he didn't know what another human voice sounded like.
#v(0.35em)
#line(length: 100%, stroke: rgb(90%, 90%, 90%))
#v(0.35em)
He did not leave his sleeping platform on the day after that.
#v(0.35em)
#line(length: 100%, stroke: rgb(90%, 90%, 90%))
#v(0.35em)
The man returned to the bamboo grove.
He came wearing the clothes he had arrived in, and lay down in the bare patch he had woken up in.
The man stared at the azure sky above.
He tried to will himself to leave, but nothing happened.
He closed his eyes and tried to remember what friends or a home looked like, but nothing came to mind.
"Please let me leave," he said to no one.
The wind rustled the bamboo above, and the man whimpered, holding his face in his hands.
He might not be insane. Perhaps he was dead. Perhaps this was some horrible afterlife. Perhaps he had never existed before and was doomed to whatever #emph[this ] was for forever.
Even if he couldn't leave, at the very least he wanted someone to talk to.
"You look #emph[terrible] ," purred a voice from above.
The man moved his hands. An illusion of a woman stood above him. She had raven hair, tired eyes, and a disdainful expression. Her arms were gloved in violet satin and crossed in front of her.
"The muscles are a nice change, but you look awful with facial hair." Her lips curled in a disdainful sneer.
The man shook his head, tears building in the corner of his eyes.
"I don't know who you are."
"Of course you don't, #emph[boy.] #emph["]
#emph[She looked him over. "] You didn't know who I was then, and you don't now. Hard to build trust when neither of us trusts each other."
The man decided to stop caring that this illusion wasn't real. He desperately needed someone to talk to.
"Who was I, before here?"
#emph["You weren't who you thought you were, that's for sure. ] No one else saw through you, but #emph[I did] #emph[. ] You were never a leader or a detective or a scholar; you were a frightened child playing pretend."
The man swallowed a lump in his throat.
"You can fool the rest of the world with your magic and illusions, but you could never fool me."
The man wanted to sob. Wanted to go back and sleep. Wanted to starve until all of this went away.
"I don't know who you are," he finally admitted with a broken voice.
The woman knelt and looked him in the eye with a cold, crocodilian smile.
"I'm the best thing that ever happened to you."
The man shot out a hand to shove her away, and the image of the woman flickered away in a haze of blue. She was gone.
His heart was racing. And his brow was knit in despair.
That despair began to tighten into rage.
He stood to his feet, balled his fists, and punched his hand into a stalk of bamboo. The shock of it bloodied his knuckles.
But he didn't care. He paced and tried to slow his racing heart.
"#emph[No more involuntary illusions!] " he said, and something in the back of his mind rung with magical affirmation. It would not happen again.
#emph[He ] had control over his mind. #emph[He ] was the wielder of his talents.
The man let his mind drift, and he wondered if the illusion he'd seen was the manifestation of something within himself, or a broken memory of someone close.
She may have been a lover. She may have been a friend.
He wondered if he even #emph[had ] friends.
How could someone who was close to a person like that be deserving of friends?
Then a thought occurred to the man.
"Who I was doesn't matter . . . because I get to learn who I am #emph[now] ."
Saying it out loud made it feel real.
"Whoever I was is irrelevant, for I will become whoever I #emph[want] to become."
He believed that with all his heart.
The man realized what he must do.
He was going to prove to himself that he deserved to live.
#v(0.35em)
#line(length: 100%, stroke: rgb(90%, 90%, 90%))
#v(0.35em)
The man got to work.
He toiled for five days straight.
#v(0.35em)
#line(length: 100%, stroke: rgb(90%, 90%, 90%))
#v(0.35em)
He felt both exhausted and accomplished.
The man sat eating foraged fruit in front of his fire, and a small but sturdy raft sat nearby beneath the cloudless, starry sky.
He leaned up against his supplies and ran through his mental checklist one more time: two weeks' worth of fresh water (and a solar still for use after that), his net, his spear, and what was left of his cloak to use as protection from the sun. Two baskets of fruit. His hat, his knife, extra material for the sails, extra bamboo and rope for repairs. The man knew he might be sailing to his death in the morning, but he was desperate to know what was on the other side of the sea. There had to be #emph[someone ] there.
He was excited. He was terrified. He was leaving the only place he'd ever known to find what lay on the other side of the water, and the thought filled him with a strange elation. He had so much left to discover.
The man smiled. He sat back down in front of his fire and cracked open an oyster with a sharpened rock. He held the half-shell up as a toast to the island around him.
"Cheers to you, Useless Island."
#v(0.35em)
#line(length: 100%, stroke: rgb(90%, 90%, 90%))
#v(0.35em)
His first day at sea went smoothly. Useless Island disappeared over the horizon, and infinite azure stretched out in front of him.
The man was confident. If he had survived this long on a deserted island, he could survive a trip at sea.
He slept well that first night.
His second night went well, too.
But the sea turned gray and choppy on the third day.
And on the fourth afternoon, the waves grew taller than his mast.
Thick droplets of rain rammed into his skin, and the sky churned above with the same ferocity as the ocean below.
Walls of water tossed his little raft back and forth, spraying cold water in his eyes and toppling his balance. The man gripped the sides of his raft and screwed his eyes shut, wishing he had been gifted with power over the seas rather than power over the mind.
Lightning arced overhead, followed immediately by the roar of thunder.
The man was terrified. He tied a length of rope to his waist and attached the other end to his raft.
The ship rose, lifted by the crest of a wave, and on the horizon the man could see a craggy, rugged, rocky island.
#emph[Perhaps there are people on this one?]
The man pulled the side of his sail to try and catch the wind, just in time for his craft to slide down the side of the wave, dipping into a valley of water as another wave loomed overhead.
The man looked up, saw the impending wave, and gasped just before it crashed into his ship.
#v(0.35em)
#line(length: 100%, stroke: rgb(90%, 90%, 90%))
#v(0.35em)
He awoke draped over the wood of his broken raft. It was night, now, and the sea was still.
The other island was in the distance. It was a rocky barren thing, with tops that glistened white.
#emph[Snow? ] He thought optimistically. He looked more closely. The man groaned. #emph[Birds.]
He assessed his current state. His raft was in pieces, but thankfully, the basket of his belongings was still strapped to the piece of raft he clung to.
The white excrement on the rocky island was glistening in the moonlight. It was almost beautiful. Almost.
Exhausted and defeated, the man kicked himself over toward his new home.
#v(0.35em)
#line(length: 100%, stroke: rgb(90%, 90%, 90%))
#v(0.35em)
He pulled himself out of the water and collapsed on a piece of rock above the tide level. Despite the never-ending chorus of seabirds and flying lizard-birds, the man slept a full day.
#v(0.35em)
#line(length: 100%, stroke: rgb(90%, 90%, 90%))
#v(0.35em)
The man wavered in between sleep and wakefulness. He didn't have the energy to get up and explore, but he could see quite plainly he had traded in a perfectly livable island for an absolutely terrible one.
Everything sounded and smelled like seabirds.
In his heart, he knew that he should have stayed on Useless Island and lived a happy life with his oysters and fishing net and unyielding imagination.
But there was a small part of him that #emph[knew ] in some way that he could simply . . . go.
The man decided to replicate the experience he'd had on his first day.
Perhaps #emph[now ] it would work.
The man lay back next to the rocks and closed his eyes. He needed to find whatever it was in himself that was giving him this feeling that he could do something impossible.
He took a deep breath, let the sound of the waves around him and the sting of the sun above vanish from his perception, and in his mind, he pictured a well.
Its sides were smooth gray slate, but as the man ran his hand along the rim, he could sense that it was once filled not with water, but with endless objects and places, scents, tastes, people, friends, lovers, a whole lifetime's worth of memories#emph[. ] And now those were gone.
He climbed over the side of the well and fell further into his mind. His descent was controlled and slow, a graceful sinking through himself. The depth of the well had not changed, he could tell, but only the top part of it was lined with evidence and memory. It was a lush and rainy jungle, floury sand and familiar birds. Just below that, the walls were lined with bamboo, the shimmer of sunlight on fish scales, and a perfect, illusory, rain-gray draft horse. These memories were proud, full of learning and accomplishment.
The man smiled. It wasn't much. But it was #emph[him] .
He continued to fall.
The familiar vanished, and he sensed he was moving toward a different sort of knowledge. The man made a note to one day study the differences in types of memory, for here the walls were textured, in one spot velvet, another leather, and in yet another, a patch of harsh-looking spines. As he passed his hand from one surface to another, he felt the vast variety of knowledge that had accumulated here from his other life—knowledge he never remembered learning but was thankful he had retained. Here was language, arithmetic, how to lace his boots, and how to brew a cup of coffee (oh, what horrible atrocities the man would commit for a cup of hot coffee). The man chuckled. There was so much information stitched into the walls, and yet, wonderfully, so much room for more.
The man fell further still, and the slate of the well gave way to thick clouds of fog.
Whatever used to be here was gone now.
But there was one part that remained.
It was there, suspended like a silver jewel, a shining light embedded in the well of his mind.
The man found the part that would allow his escape.
The part that made him #emph[him.]
He did not know what it was, but he had felt it once, and he knew it was his last chance.
The man lifted his head to the sky and ascended: past the textures of his knowledge, past the memory of his beloved Useless Island, out of the well, and back into his waking body.
He opened his eyes and tried to ignore the birds cawing and flapping on the rocks around him.
The man took a deep breath, and then he tapped into that shining part of himself that he had discovered in the depths of his mind.
The man felt his body #emph[lurch, ] and tried to ride out the panic as his limbs flickered in and out of view. Pieces of himself tried to leave, blinking in and out of view in a delicate haze of blue. Once again, he felt himself violently tugged backward, falling and thrashing, until his body hit the rocks of his new island. That familiar circle-and-triangle sigil appeared over his head, and the man let out a breath when his form condensed once again into flesh.
He had failed.
The man looked around. He was surrounded by nothing but empty waves, excrement-covered rocks and seabirds, and a blistering sun.
The conclusion he came to was simple. He would not survive much longer.
"I can think of a way out," he said through cracked lips and a dry mouth. "I will think of a way out of this."
And so the man lay down on the rocks, closed his eyes, and descended once more into his mind to search for an answer.
#v(0.35em)
#line(length: 100%, stroke: rgb(90%, 90%, 90%))
#v(0.35em)
He was awakened by yelling in the distance.
"Avast! Man onshore!"
"Should we send Malcolm over?"
"No. Prepare the dinghy. I want a good look at him first."
"Lowering the away vessel!"
An immense, wooden tall ship was near the rocky, bird-ridden outcropping. Its sails were latticed with what seemed like miles of intricate rope. Brilliantly colored sails assaulted his vision with a hue he had not encountered since he first awoke on Useless Island. A stone statue was unceremoniously strapped to the front of the ship, and written in graceful script on the side of the bow was the epigraph: #emph[The Belligerent] #emph[.]
He closed his eyes.
Exhaustion overtook him, and minutes later he heard the splash of oars meeting water.
A husky, feminine voice yelled out over the tumble of the waves.
"I'd tell you not to leave, but the point is a bit moot. It's like planeswalking into a window, isn't it?"
The man was too tired to look at the source of the voice. It was close, now. Whoever it was must have rowed over.
"My ship needs a new figurehead, Beleren! Tell me who you're working for and your death will be a painless one!"
#emph[Beleren? Is that my name? ] He wondered in a drowsy haze.
The splash of feet walking through water. The caw of gulls. A grunt, the unceremonious thud of an anchor. The woman must have jumped out of the dinghy to investigate on her own.
He heard her softly gasp from just above him.
#emph[Do I really look that bad?] The man wondered. He mentally conceded, #emph[I feel that bad. I must look that bad.]
The man's eyes fluttered open through a thick crust of salt and sleep.
He locked eyes with a regal woman he could only assume was the captain of the ship.
She was remarkable.
#figure(image("001_Jace, Alone/06.jpg", width: 100%), caption: [Art by <NAME>], supplement: none, numbering: none)
The woman was tall and lithe, with brilliant emerald skin and tendrilled hair dancing curiously in the wind. He knew, somehow, that she was a gorgon, but he felt no fear when he looked her in the eye.
Her golden eyes went wide when she looked down at the man on the rocks, and she stared at him with an expression of shock.
The man realized with equal parts excitement and dread that this woman knew exactly who he was.
"Jace, what the hell happened to you?"
|
|
https://github.com/IANYEYZ/epigraph | https://raw.githubusercontent.com/IANYEYZ/epigraph/main/epigraph.typ | typst | MIT License | #let stroke-pattern = (
top: 0pt,
right: 0pt,
left: 0pt,
bottom: 0.5pt
)
#let epigraph-position = (
align: alignment.right,
dx: 0pt,
dy: 15pt
)
#let epigraph-box(w, doc) = {[
#box(width: w)[
#doc
]
]}
#let epigraph-quote-box(doc) = {[
#box(stroke: stroke-pattern)[
#doc
#v(5pt)
]
]}
#let epigraph(source: "", source-style: emph, width: 30%, position: epigraph-position, doc) = {[
#align(position.align)[
#move(dx: position.dx, dy: position.dy)[
#epigraph-box(width)[
#epigraph-quote-box[#doc]
#v(-10pt)
#align(alignment.right)[-- #source-style(source)] \
]
]
]
]} |
https://github.com/zenor0/FZU-report-typst-template | https://raw.githubusercontent.com/zenor0/FZU-report-typst-template/main/README.md | markdown | MIT License | # FZU-report-typst-template
Typst 福州大学实验报告模板 | 自用非官方 | UNOFFICIAL
> [!WARNING]
> 本模板为自用的实验报告模板, 非官方模板. 仅供参考,不保证格式符合要求,使用时请自行检查!!!
本模板为自用模板, 在 [SEU-Typst-Template](https://github.com/csimide/SEU-Typst-Template) 基础上魔改而成的.
## 预览
![preview](./example.png)
## 使用
> [!NOTE]
> 使用前请确保你的系统上已经安装了 `typst`
首先请克隆本仓库
```bash
git clone
```
模板使用的字体库如下
```typst
#let 字体 = (
仿宋: ("Times New Roman", "Noto Sans Mono CJK SC", "FangSong", "STFangSong"),
宋体: ("Fandolsong", "Times New Roman"),
黑体: ("FandolHei", "Noto Sans CJK SC", "Times New Roman",),
标题黑体: ("SimHei"),
标题宋体: ("Times New Roman", "STZhongsong", "Fandolsong"),
楷体: ("FandolKai", "Times New Roman", ),
代码: ("Cascadia Code", "Fira Code", "Alibaba PuHuiTi 3.0"),
)
```
请确保你的系统上已经安装了这些字体库. 或者你可以根据自己的需要修改 `fzu-report/utils/fonts.typ` 文件中的字体设置.
### 本地使用
> [!NOTE]
> WIP, 这个方法不一定在所有系统上正常工作.
执行
```bash
make
```
若指令工作正常, 应该会将本模板加入到 typst 包管理器中.
此时你可以通过 `@local/fzu-report:0.1.0` 来访问本模板.
运行 `typst init @local/fzu-report:0.1.0` 即可初始化一个实验报告文档.
### 在线使用
> [!NOTE]
> WIP
## LICENSE
本项目基于 MIT 协议开源, 欢迎二次开发
项目中的图标来源于 [simpleicons](https://simpleicons.org/) 和 [iconpark](https://iconpark.oceanengine.com/) |
https://github.com/metamuffin/typst | https://raw.githubusercontent.com/metamuffin/typst/main/docs/src/general/changelog.md | markdown | Apache License 2.0 | ---
description: |
Learn what has changed in the latest Typst releases and move your documents
forward.
---
# Changelog
## Version 0.5.0 (June 9, 2023) { #v0.5.0 }
- Text and Layout
- Added [`raw`]($func/raw) syntax highlighting for many more languages
- Added support for Korean [numbering]($func/numbering)
- Added basic i18n for a few more languages (NL, SV, DA)
- Improved linebreaking for East Asian languages
- Expanded functionality of outline [`indent`]($func/outline.indent) property
- Fixed footnotes in columns
- Fixed page breaking bugs with [footnotes]($func/footnote)
- Fixed bug with handling of footnotes in lists, tables, and figures
- Fixed a bug with CJK punctuation adjustment
- Fixed a crash with rounded rectangles
- Fixed alignment of [`line`]($func/line) elements
- Math
- **Breaking change:** The syntax rules for mathematical
[attachments]($func/math.attach) were improved: `[$f^abs(3)$]` now parses as
`[$f^(abs(3))$]` instead of `[$(f^abs)(3)$]`. To disambiguate, add a space:
`[$f^zeta (3)$]`.
- Added [forced size]($category/math/sizes) commands for math
(e.g., [`display`]($func/math.display))
- Added [`supplement`]($func/math.equation.supplement) parameter to
[`equation`]($func/math.equation), used by [references]($func/ref)
- New [symbols]($category/symbols/sym): `bullet`, `xor`, `slash.big`,
`sigma.alt`, `tack.r.not`, `tack.r.short`, `tack.r.double.not`
- Fixed a bug with symbols in matrices
- Fixed a crash in the [`attach`]($func/math.attach) function
- Scripting
- Added new [`datetime`]($type/datetime) type and
[`datetime.today()`]($func/datetime.today) to retrieve the current date
- Added [`str.from-unicode`]($func/str.from-unicode) and
[`str.to-unicode`]($func/str.to-unicode) functions
- Added [`fields`]($type/content.fields) method on content
- Added `base` parameter to [`str`]($func/str) function
- Added [`calc.exp`]($func/calc.exp) and [`calc.ln`]($func/calc.ln)
- Improved accuracy of [`calc.pow`]($func/calc.pow) and
[`calc.log`]($func/calc.log) for specific bases
- Fixed [removal]($type/dictionary.remove) order for dictionary
- Fixed `.at(default: ..)` for [strings]($type/string.at) and
[content]($type/content.at)
- Fixed field access on styled elements
- Removed deprecated `calc.mod` function
- Command line interface
- Added PNG export via `typst compile source.typ output-{n}.png`. The output
path must contain `[{n}]` if the document has multiple pages.
- Added `--diagnostic-format=short` for Unix-style short diagnostics
- Doesn't emit color codes anymore if stderr isn't a TTY
- Now sets the correct exit when invoked with a non-existent file
- Now ignores UTF-8 BOM in Typst files
- Miscellaneous Improvements
- Improved errors for mismatched delimiters
- Improved error message for failed length comparisons
- Fixed a bug with images not showing up in Apple Preview
- Fixed multiple bugs with the PDF outline
- Fixed citations and other searchable elements in [`hide`]($func/hide)
- Fixed bugs with [reference supplements]($func/ref.supplement)
- Fixed Nix flake
<contributors from="v0.4.0" to="v0.5.0" />
## Version 0.4.0 (May 20, 2023) { #v0.4.0 }
- Footnotes
- Implemented support for footnotes
- The [`footnote`]($func/footnote) function inserts a footnote
- The [`footnote.entry`]($func/footnote.entry) function can be used to
customize the footnote listing
- The `{"chicago-notes"}` [citation style]($func/cite.style) is now available
- Documentation
- Added a [Guide for LaTeX users]($guides/guide-for-latex-users)
- Now shows default values for optional arguments
- Added richer outlines in "On this Page"
- Added initial support for search keywords: "Table of Contents" will now find
the [outline]($func/outline) function. Suggestions for more keywords are
welcome!
- Fixed issue with search result ranking
- Fixed many more small issues
- Math
- **Breaking change**: Alignment points (`&`) in equations now alternate
between left and right alignment
- Added support for writing roots with Unicode:
For example, `[$root(x+y)$]` can now also be written as `[$√(x+y)$]`
- Fixed uneven vertical [`attachment`]($func/math.attach) alignment
- Fixed spacing on decorated elements
(e.g., spacing around a [canceled]($func/math.cancel) operator)
- Fixed styling for stretchable symbols
- Added `tack.r.double`, `tack.l.double`, `dotless.i` and `dotless.j`
[symbols]($category/symbols/sym)
- Fixed show rules on symbols (e.g. `{show sym.tack: set text(blue)}`)
- Fixed missing rename from `ast.op` to `ast` that should have been in the
previous release
- Scripting
- Added function scopes: A function can now hold related definitions in its
own scope, similar to a module. The new [`assert.eq`]($func/assert.eq)
function, for instance, is part of the [`assert`]($func/assert) function's
scope. Note that function scopes are currently only available for built-in
functions.
- Added [`assert.eq`]($func/assert.eq) and [`assert.ne`]($func/assert.ne)
functions for simpler equality and inequality assertions with more helpful
error messages
- Exposed [list]($func/list.item), [enum]($func/enum.item), and
[term list]($func/terms.item) items in their respective functions' scope
- The `at` methods on [strings]($type/string.at), [arrays]($type/array.at),
[dictionaries]($type/dictionary.at), and [content]($type/content.at) now support
specifying a default value
- Added support for passing a function to [`replace`]($type/string.replace)
that is called with each match.
- Fixed [replacement]($type/string.replace) strings: They are now inserted
completely verbatim instead of supporting the previous (unintended) magic
dollar syntax for capture groups
- Fixed bug with trailing placeholders in destructuring patterns
- Fixed bug with underscore in parameter destructuring
- Fixed crash with nested patterns and when hovering over an invalid pattern
- Better error messages when casting to an [integer]($func/int) or
[float]($func/float) fails
- Text and Layout
- Implemented sophisticated CJK punctuation adjustment
- Disabled [overhang]($func/text.overhang) for CJK punctuation
- Added basic translations for Traditional Chinese
- Fixed [alignment]($func/raw.align) of text inside raw blocks (centering a
raw block, e.g. through a figure, will now keep the text itself
left-aligned)
- Added support for passing a array instead of a function to configure table
cell [alignment]($func/table.align) and [fill]($func/table.fill) per column
- Fixed automatic figure [`kind`]($func/figure.kind) detection
- Made alignment of [enum numbers]($func/enum.number-align) configurable,
defaulting to `end`
- Figures can now be made breakable with a show-set rule for blocks in figure
- Initial fix for smart quotes in RTL languages
- Export
- Fixed ligatures in PDF export: They are now copyable and searchable
- Exported PDFs now embed ICC profiles for images that have them
- Fixed export of strokes with zero thickness
- Web app
- Projects can now contain folders
- Added upload by drag-and-drop into the file panel
- Files from the file panel can now be dragged into the editor to insert them
into a Typst file
- You can now copy-paste images and other files from your computer directly
into the editor
- Added a button to resend confirmation email
- Added an option to invert preview colors in dark mode
- Added tips to the loading screen and the Help menu. Feel free to propose
more!
- Added syntax highlighting for YAML files
- Allowed middle mouse button click on many buttons to navigate into a new tab
- Allowed more project names
- Fixed overridden Vim mode keybindings
- Fixed many bugs regarding file upload and more
- Miscellaneous Improvements
- Improved performance of counters, state, and queries
- Improved incremental parsing for more efficient recompilations
- Added support for `.yaml` extension in addition to `.yml` for bibliographies
- The CLI now emits escape codes only if the output is a TTY
- For users of the `typst` crate: The `Document` is now `Sync` again and
the `World` doesn't have to be `'static` anymore
<contributors from="v0.3.0" to="v0.4.0" />
## Version 0.3.0 (April 26, 2023) { #v0.3.0 }
- **Breaking changes:**
- Renamed a few symbols: What was previous `dot.op` is now just `dot` and the
basic dot is `dot.basic`. The same applies to `ast` and `tilde`.
- Renamed `mod` to [`rem`]($func/calc.rem) to more accurately reflect
the behaviour. It will remain available as `mod` until the next update as a
grace period.
- A lone underscore is not a valid identifier anymore, it can now only be used
in patterns
- Removed `before` and `after` arguments from [`query`]($func/query). This is
now handled through flexible [selectors]($type/selector) combinator methods
- Added support for [attachments]($func/math.attach) (sub-, superscripts) that
precede the base symbol. The `top` and `bottom` arguments have been renamed
to `t` and `b`.
- New features
- Added support for more complex [strokes]($func/line.stroke)
(configurable caps, joins, and dash patterns)
- Added [`cancel`]($func/math.cancel) function for equations
- Added support for [destructuring]($scripting/#bindings) in argument lists
and assignments
- Added [`alt`]($func/image.alt) text argument to image function
- Added [`toml`]($func/toml) function for loading data from a TOML file
- Added [`zip`]($type/array.zip), [`sum`]($type/array.sum), and
[`product`]($type/array.product) methods for arrays
- Added `fact`, `perm`, `binom`, `gcd`, `lcm`, `atan2`, `quo`, `trunc`, and
`fract` [calculation]($category/calculate)
- Improvements
- Text in SVGs now displays properly
- Typst now generates a PDF heading outline
- [References]($func/ref) now provides the referenced element as a field in
show rules
- Refined linebreak algorithm for better Chinese justification
- Locations are now a valid kind of selector
- Added a few symbols for algebra
- Added Spanish smart quote support
- Added [`selector`]($func/selector) function to turn a selector-like value
into a selector on which combinator methods can be called
- Improved some error messages
- The outline and bibliography headings can now be styled with show-set rules
- Operations on numbers now produce an error instead of overflowing
- Bug fixes
- Fixed wrong linebreak before punctuation that follows inline equations,
citations, and other elements
- Fixed a bug with [argument sinks]($type/arguments)
- Fixed strokes with thickness zero
- Fixed hiding and show rules in math
- Fixed alignment in matrices
- Fixed some alignment bugs in equations
- Fixed grid cell alignment
- Fixed alignment of list marker and enum markers in presence of global
alignment settings
- Fixed [path]($func/path) closing
- Fixed compiler crash with figure references
- A single trailing line breaks is now ignored in math, just like in text
- Command line interface
- Font path and compilation root can now be set with the environment
variables `TYPST_FONT_PATHS` and `TYPST_ROOT`
- The output of `typst fonts` now includes the embedded fonts
- Development
- Added instrumentation for debugging and optimization
- Added `--update` flag and `UPDATE_EXPECT` environment variable to update
reference images for tests
- You can now run a specific subtest with `--subtest`
- Tests now run on multiple threads
<contributors from="v0.2.0" to="v0.3.0" />
## Version 0.2.0 (April 11, 2023) { #v0.2.0 }
- **Breaking changes:**
- Removed support for iterating over index and value in
[for loops]($scripting/#loops). This is now handled via unpacking and
enumerating. Same goes for the [`map()`]($type/array.map) method.
- [Dictionaries]($type/dictionary) now iterate in insertion order instead of
alphabetical order.
- New features
- Added [unpacking syntax]($scripting/#bindings) for let bindings, which
allows things like `{let (1, 2) = array}`
- Added [`enumerate()`]($type/array.enumerate) method
- Added [`path`]($func/path) function for drawing Bézier paths
- Added [`layout`]($func/layout) function to access the size of the
surrounding page or container
- Added `key` parameter to [`sorted()`]($type/array.sorted) method
- Command line interface
- Fixed `--open` flag blocking the program
- New Computer Modern font is now embedded into the binary
- Shell completions and man pages can now be generated by setting the
`GEN_ARTIFACTS` environment variable to a target directory and then building
Typst
- Miscellaneous improvements
- Fixed page numbering in outline
- Added basic i18n for a few more languages
(AR, NB, CS, NN, PL, SL, ES, UA, VI)
- Added a few numbering patterns (Ihora, Chinese)
- Added `sinc` [operator]($func/math.op)
- Fixed bug where math could not be hidden with [`hide`]($func/hide)
- Fixed sizing issues with box, block, and shapes
- Fixed some translations
- Fixed inversion of "R" in [`cal`]($func/math.cal) and
[`frak`]($func/math.frak) styles
- Fixed some styling issues in math
- Fixed supplements of references to headings
- Fixed syntax highlighting of identifiers in certain scenarios
- [Ratios]($type/ratio) can now be multiplied with more types and be converted
to [floats]($type/float) with the [`float`]($func/float) function
<contributors from="v0.1.0" to="v0.2.0" />
## Version 0.1.0 (April 04, 2023) { #v0.1.0 }
- **Breaking changes:**
- When using the CLI, you now have to use subcommands:
- `typst compile file.typ` or `typst c file.typ` to create a PDF
- `typst watch file.typ` or `typst w file.typ` to compile and watch
- `typst fonts` to list all fonts
- Manual counters now start at zero. Read the "How to step" section
[here]($func/counter) for more details
- The [bibliography styles]($func/bibliography.style)
`{"author-date"}` and `{"author-title"}` were renamed to
`{"chicago-author-date"}` and `{"chicago-author-title"}`
- Figure improvements
- Figures now automatically detect their content and adapt their
behaviour. Figures containing tables, for instance, are automatically
prefixed with "Table X" and have a separate counter
- The figure's supplement (e.g. "Figure" or "Table") can now be customized
- In addition, figures can now be completely customized because the show rule
gives access to the automatically resolved kind, supplement, and counter
- Bibliography improvements
- The [`bibliography`]($func/bibliography) now also accepts multiple
bibliography paths (as an array)
- Parsing of BibLaTeX files is now more permissive (accepts non-numeric
edition, pages, volumes, dates, and Jabref-style comments; fixed
abbreviation parsing)
- Labels and references can now include `:` and `.` except at the end
- Fixed APA bibliography ordering
- Drawing additions
- Added [`polygon`]($func/polygon) function for drawing polygons
- Added support for clipping in [boxes]($func/box.clip) and
[blocks]($func/block.clip)
- Command line interface
- Now returns with non-zero status code if there is an error
- Now watches the root directory instead of the current one
- Now puts the PDF file next to input file by default
- Now accepts more kinds of input files (e.g. `/dev/stdin`)
- Added `--open` flag to directly open the PDF
- Miscellaneous improvements
- Added [`yaml`]($func/yaml) function to load data from YAML files
- Added basic i18n for a few more languages (IT, RU, ZH, FR, PT)
- Added numbering support for Hebrew
- Added support for [integers]($type/integer) with base 2, 8, and 16
- Added symbols for double bracket and laplace operator
- The [`link`]($func/link) function now accepts [labels]($func/label)
- The link syntax now allows more characters
- Improved justification of Japanese and Chinese text
- Calculation functions behave more consistently w.r.t to non-real results
- Replaced deprecated angle brackets
- Reduced maximum function call depth from 256 to 64
- Fixed [`first-line-indent`]($func/par.first-line-indent) being not applied
when a paragraph starts with styled text
- Fixed extraneous spacing in unary operators in equations
- Fixed block spacing, e.g. in `{block(above: 1cm, below: 1cm, ..)}`
- Fixed styling of text operators in math
- Fixed invalid parsing of language tag in raw block with a single backtick
- Fixed bugs with displaying counters and state
- Fixed crash related to page counter
- Fixed crash when [`symbol`]($func/symbol) function was called without
arguments
- Fixed crash in bibliography generation
- Fixed access to label of certain content elements
- Fixed line number in error message for CSV parsing
- Fixed invalid autocompletion after certain markup elements
<contributors from="v23-03-28" to="v0.1.0" />
## March 28, 2023
- **Breaking changes:**
- Enumerations now require a space after their marker, that is, `[1.ok]` must
now be written as `[1. ok]`
- Changed default style for [term lists]($func/terms): Does not include a
colon anymore and has a bit more indent
- Command line interface
- Added `--font-path` argument for CLI
- Embedded default fonts in CLI binary
- Fixed build of CLI if `git` is not installed
- Miscellaneous improvements
- Added support for disabling [matrix]($func/math.mat) and
[vector]($func/math.vec) delimiters. Generally with
`[#set math.mat(delim: none)]` or one-off with
`[$mat(delim: #none, 1, 2; 3, 4)$]`.
- Added [`separator`]($func/terms.separator) argument to term lists
- Added [`round`]($func/math.round) function for equations
- Numberings now allow zeros. To reset a counter, you can write
`[#counter(..).update(0)]`
- Added documentation for `{page()}` and `{position()}` methods on
[`location`]($func/locate) type
- Added symbols for double, triple, and quadruple dot accent
- Added smart quotes for Norwegian Bokmål
- Added Nix flake
- Fixed bibliography ordering in IEEE style
- Fixed parsing of decimals in math: `[$1.2/3.4$]`
- Fixed parsing of unbalanced delimiters in fractions: `[$1/(2 (x)$]`
- Fixed unexpected parsing of numbers as enumerations, e.g. in `[1.2]`
- Fixed combination of page fill and header
- Fixed compiler crash if [`repeat`]($func/repeat) is used in page with
automatic width
- Fixed [matrices]($func/math.mat) with explicit delimiter
- Fixed [`indent`]($func/terms.indent) property of term lists
- Numerous documentation fixes
- Links in bibliographies are now affected by link styling
- Fixed hovering over comments in web app
<contributors from="v23-03-21" to="v23-03-28" />
## March 21, 2023
- Reference and bibliography management
- [Bibliographies]($func/bibliography) and [citations]($func/cite) (currently
supported styles are APA, Chicago Author Date, IEEE, and MLA)
- You can now [reference]($func/ref) sections, figures, formulas, and works
from the bibliography with `[@label]`
- You can make an element referenceable with a label:
- `[= Introduction <intro>]`
- `[$ A = pi r^2 $ <area>]`
- Introspection system for interactions between different parts of the document
- [`counter`]($func/counter) function
- Access and modify counters for pages, headings, figures, and equations
- Define and use your own custom counters
- Time travel: Find out what the counter value was or will be at some other
point in the document (e.g. when you're building a list of figures, you
can determine the value of the figure counter at any given figure).
- Counters count in layout order and not in code order
- [`state`]($func/state) function
- Manage arbitrary state across your document
- Time travel: Find out the value of your state at any position in the
document
- State is modified in layout order and not in code order
- [`query`]($func/query) function
- Find all occurrences of an element or a label, either in the whole document
or before/after some location
- Link to elements, find out their position on the pages and access their
fields
- Example use cases: Custom list of figures or page header with current
chapter title
- [`locate`]($func/locate) function
- Determines the location of itself in the final layout
- Can be accessed to get the `page` and `x`, `y` coordinates
- Can be used with counters and state to find out their values at that
location
- Can be used with queries to find elements before or after its location
- New [`measure`]($func/measure) function
- Measure the layouted size of elements
- To be used in combination with the new [`style`]($func/style) function that
lets you generate different content based on the style context something is
inserted into (because that affects the measured size of content)
- Exposed content representation
- Content is not opaque anymore
- Content can be compared for equality
- The tree of content elements can be traversed with code
- Can be observed in hover tooltips or with [`repr`]($func/repr)
- New [methods]($type/content) on content: `func`, `has`, `at`, and `location`
- All optional fields on elements are now settable
- More uniform field names (`heading.title` becomes `heading.body`,
`list.items` becomes `list.children`, and a few more changes)
- Further improvements
- Added [`figure`]($func/figure) function
- Added [`numbering`]($func/math.equation.numbering) parameter on equation function
- Added [`numbering`]($func/page.numbering) and
[`number-align`]($func/page.number-align) parameters on page function
- The page function's [`header`]($func/page.header) and
[`footer`]($func/page.footer) parameters do not take functions anymore. If
you want to customize them based on the page number, use the new
[`numbering`]($func/page.numbering) parameter or [`counter`]($func/counter)
function instead.
- Added [`footer-descent`]($func/page.footer-descent) and
[`header-ascent`]($func/page.header-ascent) parameters
- Better default alignment in header and footer
- Fixed Arabic vowel placement
- Fixed PDF font embedding issues
- Renamed `math.formula` to [`math.equation`]($func/math.equation)
- Font family must be a named argument now: `[#set text(font: "..")]`
- Added support for [hanging indent]($func/par.hanging-indent)
- Renamed paragraph `indent` to
[`first-line-indent`]($func/par.first-line-indent)
- More accurate [logarithm]($func/calc.log) when base is `2` or `10`
- Improved some error messages
- Fixed layout of [`terms`]($func/terms) list
- Web app improvements
- Added template gallery
- Added buttons to insert headings, equations, raw blocks, and references
- Jump to the source of something by clicking on it in the preview panel
(works for text, equations, images, and more)
- You can now upload your own fonts and use them in your project
- Hover debugging and autocompletion now takes multiple files into account and
works in show rules
- Hover tooltips now automatically collapse multiple consecutive equal values
- The preview now automatically scrolls to the right place when you type
- Links are now clickable in the preview area
- Toolbar, preview, and editor can now all be hidden
- Added autocompletion for raw block language tags
- Added autocompletion in SVG files
- New back button instead of four-dots button
- Lots of bug fixes
## February 25, 2023
- Font changes
- New default font: Linux Libertine
- New default font for raw blocks: DejaVu Sans Mono
- New default font for math: Book weight of New Computer Modern Math
- Lots of new math fonts available
- Removed Latin Modern fonts in favor of New Computer Modern family
- Removed unnecessary smallcaps fonts which are already accessible through
the corresponding main font and the [`smallcaps`]($func/smallcaps) function
- Improved default spacing for headings
- Added [`panic`]($func/panic) function
- Added [`clusters`]($type/string.clusters) and
[`codepoints`]($type/string.codepoints)
methods for strings
- Support for multiple authors in [`set document`]($func/document.author)
- Fixed crash when string is accessed at a position that is not a char boundary
- Fixed semicolon parsing in `[#var ;]`
- Fixed incremental parsing when inserting backslash at end of `[#"abc"]`
- Fixed names of a few font families
(including Noto Sans Symbols and New Computer Modern families)
- Fixed autocompletion for font families
- Improved incremental compilation for user-defined functions
## February 15, 2023
- [Box]($func/box) and [block]($func/block) have gained `fill`, `stroke`,
`radius`, and `inset` properties
- Blocks may now be explicitly sized, fixed-height blocks can still break
across pages
- Blocks can now be configured to be [`breakable`]($func/block.breakable) or not
- [Numbering style]($func/enum.numbering) can now be configured for nested enums
- [Markers]($func/list.marker) can now be configured for nested lists
- The [`eval`]($func/eval) function now expects code instead of markup and
returns an arbitrary value. Markup can still be evaluated by surrounding the
string with brackets.
- PDFs generated by Typst now contain XMP metadata
- Link boxes are now disabled in PDF output
- Tables don't produce small empty cells before a pagebreak anymore
- Fixed raw block highlighting bug
## February 12, 2023
- Shapes, images, and transformations (move/rotate/scale/repeat) are now
block-level. To integrate them into a paragraph, use a [`box`]($func/box) as
with other elements.
- A colon is now required in an "everything" show rule: Write `{show: it => ..}`
instead of `{show it => ..}`. This prevents intermediate states that ruin
your whole document.
- Non-math content like a shape or table in a math formula is now centered
vertically
- Support for widow and orphan prevention within containers
- Support for [RTL]($func/text.dir) in lists, grids, and tables
- Support for explicit `{auto}` sizing for boxes and shapes
- Support for fractional (i.e. `{1fr}`) widths for boxes
- Fixed bug where columns jump to next page
- Fixed bug where list items have no leading
- Fixed relative sizing in lists, squares and grid auto columns
- Fixed relative displacement in [`place`]($func/place) function
- Fixed that lines don't have a size
- Fixed bug where `{set document(..)}` complains about being after content
- Fixed parsing of `{not in}` operation
- Fixed hover tooltips in math
- Fixed bug where a heading show rule may not contain a pagebreak when an
outline is present
- Added [`baseline`]($func/box.baseline) property on [`box`]($func/box)
- Added [`tg`]($func/math.op) and [`ctg`]($func/math.op) operators in math
- Added delimiter setting for [`cases`]($func/math.cases) function
- Parentheses are now included when accepting a function autocompletion
## February 2, 2023
- Merged text and math symbols, renamed a few symbols
(including `infty` to `infinity` with the alias `oo`)
- Fixed missing italic mappings
- Math italics correction is now applied properly
- Parentheses now scale in `[$zeta(x/2)$]`
- Fixed placement of large root index
- Fixed spacing in `[$abs(-x)$]`
- Fixed inconsistency between text and identifiers in math
- Accents are now ignored when positioning superscripts
- Fixed vertical alignment in matrices
- Fixed `text` set rule in `raw` show rule
- Heading and list markers now parse consistently
- Allow arbitrary math directly in content
## January 30, 2023
[Go to the announcement blog post.](https://typst.app/blog/2023/january-update)
- New expression syntax in markup/math
- Blocks cannot be directly embedded in markup anymore
- Like other expressions, they now require a leading hashtag
- More expressions available with hashtag, including literals
(`[#"string"]`) as well as field access and method call
without space: `[#emoji.face]`
- New import syntax
- `[#import "module.typ"]` creates binding named `module`
- `[#import "module.typ": a, b]` or `[#import "module.typ": *]` to import items
- `[#import emoji: face, turtle]` to import from already bound module
- New symbol handling
- Removed symbol notation
- Symbols are now in modules: `{sym}`, `{emoji}`, and `{math}`
- Math module also reexports all of `{sym}`
- Modified through field access, still order-independent
- Unknown modifiers are not allowed anymore
- Support for custom symbol definitions with `symbol` function
- Symbols now listed in documentation
- New `{math}` module
- Contains all math-related functions
- Variables and function calls directly in math (without hashtag) access this
module instead of the global scope, but can also access local variables
- Can be explicitly used in code, e.g. `[#set math.vec(delim: "[")]`
- Delimiter matching in math
- Any opening delimiters matches any closing one
- When matched, they automatically scale
- To prevent scaling, escape them
- To forcibly match two delimiters, use `lr` function
- Line breaks may occur between matched delimiters
- Delimiters may also be unbalanced
- You can also use the `lr` function to scale the brackets
(or just one bracket) to a specific size manually
- Multi-line math with alignment
- The `\` character inserts a line break
- The `&` character defines an alignment point
- Alignment points also work for underbraces, vectors, cases, and matrices
- Multiple alignment points are supported
- More capable math function calls
- Function calls directly in math can now take code expressions with hashtag
- They can now also take named arguments
- Within math function calls, semicolons turn preceding arguments to arrays to
support matrices: `[$mat(1, 2; 3, 4)$]`
- Arbitrary content in math
- Text, images, and other arbitrary content can now be embedded in math
- Math now also supports font fallback to support e.g. CJK and emoji
- More math features
- New text operators: `op` function, `lim`, `max`, etc.
- New matrix function: `mat`
- New n-ary roots with `root` function: `[$root(3, x)$]`
- New under- and overbraces, -brackets, and -lines
- New `abs` and `norm` functions
- New shorthands: `[|`, `|]`, and `||`
- New `attach` function, overridable attachments with `script` and `limit`
- Manual spacing in math, with `h`, `thin`, `med`, `thick` and `quad`
- Symbols and other content may now be used like a function, e.g. `[$zeta(x)$]`
- Added Fira Math font, removed Noto Sans Math font
- Support for alternative math fonts through
`[#show math.formula: set text("Fira Math")]`
- More library improvements
- New `calc` module, `abs`, `min`, `max`, `even`, `odd` and `mod` moved there
- New `message` argument on `{assert}` function
- The `pairs` method on dictionaries now returns an array of length-2 arrays
instead of taking a closure
- The method call `{dict.at("key")}` now always fails if `"key"` doesn't exist
Previously, it was allowed in assignments. Alternatives are `{dict.key = x}`
and `{dict.insert("key", x)}`.
- Smarter editor functionality
- Autocompletion for local variables
- Autocompletion for methods available on a value
- Autocompletion for symbols and modules
- Autocompletion for imports
- Hover over an identifier to see its value(s)
- Further editor improvements
- New Font menu with previews
- Single projects may now be shared with share links
- New dashboard experience if projects are shared with you
- Keyboard Shortcuts are now listed in the menus and there are more of them
- New Offline indicator
- Tooltips for all buttons
- Improved account protection
- Moved Status indicator into the error list button
- Further fixes
- Multiple bug fixes for incremental parser
- Fixed closure parameter capturing
- Fixed tons of math bugs
- Bugfixes for performance, file management, editing reliability
- Added redirection to the page originally navigated to after signin
|
https://github.com/RakuJa/Space_Communication_Notes | https://raw.githubusercontent.com/RakuJa/Space_Communication_Notes/main/main.typ | typst | MIT License |
#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: "Space communication systems",
subtitle: "",
subject: "Notes",
guide: (
name: "<NAME>",
designation: "Professor of Space Communication Systems",
department: "Information Engineering"
),
authors: (
(
name: "<NAME>",
department: "Department of Information Engineering",
rollno: "647820"
),
(
name: "X",
department: "Department of Aereospace Engineering",
rollno: "x",
),
),
department: "Department of Aereospace Engineering",
institute: "Università degli studi di Pisa",
degree: "Master of Science",
year: "2023-2024",
logo: "images/logo-unipi.png",
)
= Introduction
== Rationale
Since this is a subject typically addressed by post-graduate masters, with a lot of notions taken from complex subjects, there is no official text book to study. These notes aim at structuring the lectures in the forms of notes. There was little to no effort in making these notes "book like", they are a collection of annotations and knowledge.
== Notations
In this course, we'll #strong("always") use the metric system, avoiding the imperial system. This is done to avoid conversion errors and to use a more logical and "scientific" system.
=== A lesson to be learned
The Mars Climate Orbiter, a robotic space probe launched by NASA to Mars on the 11th of December 1998, while it was beginning the planned orbital insertion manouver, communication was permanently lost. The spacecraft passed behind Mars 49 seconds earlier than expected, and communication was never reestablished, causing mission loss.
This mission loss was caused entirely by mixing imperial and international unit of measures. The lesson: *always use the international system, avoid imperial units*
#figure(
image("images/introduction/SI_and_prefixes.png", width: 100%),
caption: [The International System of units (SI) and its prefixes]
)<SI_and_prefixes>
#pagebreak()
== Definitions
A #text("communication system", green) is a collection of elements that allows an exchange of signals carrying information between two stations: a #text("Trasmitter", blue) (often abbreaviated to #text("TX", blue)) and a #text("Receiver (Rx)", red).
#line()
#text("Transducers", green) is the generic term for sensors & actuators.
To simplify, we have:
input device #sym.arrow.r sensors #sym.arrow.r source of electrical signal
output device #sym.arrow.r actuators #sym.arrow.r source of physical signal
#line()
We assume that the physical quantities are converted into electrical signals by means of special devices, named #text("Transducers", red).
A #text("signal", green) is a function of the time that conveys information about a phenomenon by means of a physical quantity. A signal is a time-varying voltage, periodic with period T#sub[0].
if $ v(t) = v(t+t#sub[0]) ∀t$ we define foundamental frequency as $ f#sub[0] = frac(1, T#sub[0]) $
Power Dissipated (P)
$ P = V*I = V^2/R = I^2*R$
We would also like to calculate to Root Mean Square of the current, to determine the amount of power/strength of the signal:
$ P = V^2#sub[RMS]/R #sym.arrow.r V#sub[RMS] = sqrt(P*R)$
$ P#sub[dBW] = 10* log (P#sub[w])/(1#sub[w])$
Energy of a generic signal over an interval of duration #sym.tau:
$ E#sub[s] [J] = integral^(#sym.tau/2)_(-#sym.tau/2) p(t) d t= P#sub[s] * #sym.tau $
Energy of a periodic signal over one period of duration T#sub[0]:
$ E#sub[s] [J] = integral^((T#sub[0])/2)_(-(T#sub[0])/2) p(t) d t= P#sub[s] * T#sub[0] $
== Signals & Fourier analysis
Fourier analysis helps us represent a given signal as a sum of signals. In the case of random signals it produces a function denoted as #text("Power Spectral Density (PSD)", red)
#line()
Bandwith of a signal refers to the portion of the frequency domain where the spectrum is significantly different from zero after a linear transformation, a signal changes its PSD
$x(t)[v] #sym.arrow.r G(f) #sym.arrow.r y(t)[v] $
$S#sub[x] (f) W/(H#sub[Z]) #sym.arrow.r #sym.arrow.r #sym.arrow.r S#sub[Y] (f) [W/(H#sub[Z])] = G(f) * S#sub[x] (f) W/(H#sub[Z])$
#line()
=== Noise
Random noise is usually rapresented with a gaussian distribution. White noise on the other hand draws its name from "white" light: white light is approximately an equal mixture of all visible frequencies of light. It's an ideal model, because it has "infinite" integral #sym.arrow.r infinite power.
#figure(
image("images/introduction/White_Noise_PSD.png", width: 50%),
caption: [PSD of White Gaussian Noise (ideal)]
)<White_Noise_PSD>
In practice, white noise does not exist. No system is capable of generating a uniform spectrum for all frequencies extended from zero to infinity, so we refer to an upper-limited frequency range.
#figure(
image("images/introduction/White_Noise_PSD_real.png", width: 60%),
caption: [PSD of White Gaussian Noise (real)]
)<White_Noise_PSD>
=== Filter
We have three main type of filters:
- Low-Pass filter: it will filter frequencies above a certain threshold from the input signal
- High-Pass filter: it will filter frequencies belove a certain threshold from the input signal
- Band-Pass filter: it will filter out frequencies above and belove a given range. It is divided in Wide and Narrow, according to the Q-factor.
=== Power
Power gain & power losses are linear equation, so you can just sum or subtract if they are in the same logarithmic scale. Coaxial cables tend to act as a low pass filter after some distances.
= Regulations
== International bodies
- ITU: International Telecommunication Union, is the UN specialized agency for information and communication technologies based in Geneva.
- ITU-R: radiocommunication sector
- ITU-T: telecommunication standardization sector
- ITU-D: telecommunication development sector
The work is mainly driven by the private sector, all major companies are members of the ITU and they partecipate on equal footing with governaments.
- ITU-RR: The ITU Radio Regulation are binding international treaties approved by ITU member states which govern the global use of radio frequency spectrum (applies also to satellites) and satellite orbits.
- ITU-WTC: (World Radiocommunication conference) is a conference held every 3/4 years by ITU to review radio regulations.
== Rest of the globe
- Europe:
- ETSI: (European Telecommunications Standards Institute) leading standardization organization for Information and Communication Technology (ICT). Initially intended for Europe, now operates on a global scale;
- CENELEC: (Committee for Electrotechnical Standardisation) standardization in the electrotechnical engineering fields;
- EBU: (European Brodcasting Union).
- Italy:
- Ministero delle imprese.
- USA:
- FCC (Federal Communications Commission).
- Other:
- IEEE (Institute of Electrical and Electronics Engineers);
- IEEE/SA (IEEE/Standars Association);
- 3GPP (3rd Generation Partnership Project) Responsable for 2G, 3G, 4G, 5G;
- DVB/DUBS2 (Digital Video Broadcasting).
- Space:
- UNOOSA (United Nations Office for Outer Space Affairs) Promotes international cooperation in the peaceful use and exploration of space, and in the utilisation of space science and technology for sustainable economic and social development;
- ECSS (European Cooperation for Space Standardization) ;
- SFCG (Space Frequency Coordination Group) Deals with frequency management issues relevant to the activity of the various space agencies. It was established in order to provide a less formal and more flexible environment, as compared to the official organs of the ITU;
- CCDS (Consultative Committee for Space Data Systems) multi-national forum for the development of communications & data systems standards for spaceflight;
- IDSIS (International Deep Space Interoperability Standards) is a partnership among all the agencies involved in ISS operations: NASA, Roscosmos, JAXA, ESA, CSA.
= Earth Atmosphere
#figure(
image("images/introduction/atmosphere_comp.PNG", width: 120%),
caption: [Earth atmosphere]
)<Earth_atmosphere>
A rain droplet is shaped like a bean and not like a sphere, as such it interferes (attenuates) more with horizontaly polarized waves.
O#sub[2] is almost constant meaning that we can predict it. It interferes with noticable spikes at 60 & 120 Ghz.
H#sub[2]O interferes with spikes at 22 & 180 Ghz, but its also highly variable. Water at certain frequencies is eager to capture electron to complete its structure, attenuating the signal.
Refractive index is relative low after 20km and it measures the slow down of electromagnetic waves.
Snell's law also says that light (E.M rad) bends and changes direction when traveling through different mediums. This happens when traveling through each layer of the atmosphere bending randomly\* the signal (\*according to micro variation of temperature, humidity, etc..).
#figure(
image("images/introduction/snell_law.PNG", width: 55%),
caption: [Snell's law and Earth atmosphere]
)<snell_law>
#pagebreak()
== Ionosphere
It is located in the range of 80 to 400 km. The ISS sits just outside of it.
The radiation from external sources hits and charges (positively or negatively) particles with high variability. Some external factors: inclination on the axis (season), presence of sun (day/night), latitude, sun spots, solar flares, etc.. .
Ionosphere layers are D, E, F. E was the first layer discovered, called like this because it reflected back electricity sent at it. F is divided in F1, F2 during the day and D is present only during the day. Low frequencies are reflected (< 20 Mhz), high frequencies pass.
For space communications we'll always use at least 50 Mhz. We can also use the ionosphere to bounce signal around the globe.
#figure(
image("images/introduction/ionosphere.PNG", width: 120%),
caption: [Earth ionosphere]
)<Earth_ionosphere>
= Frequency bands
We use mainly from microwaves onward (microwaves + millimiter waves)
#figure(
image("images/introduction/bands.PNG", width: 120%),
caption: [Frequency bands]
)<Frequency_bands>
We use Ku and Ka band because they are just outiside the range of interferences with water and oxygen found in the Earth atmosphere. There is also a Q/V frequency band (40-75 Ghz) that is highly experimental, we have hard attenuation above 60 Ghz inside the atmosphere, but we could use those frequencies outside of it.
The various bands presented, are inside divided in:
- Uplink frequency range;
- Downlink frequency range;
- Deep space uplink frequency range;
- Deep space downlink frequency range.
== Pros and cons of the most used bands
C band has wide footprint, minor effect from rain (the larger the wavelength the less problems with rain), low cost. But it also requires big antennas.
Ku-band has smaller antennas but have small footprint and are more affected by rain.
Ka-band has, comparing with Ku-band, smaller antennas, smaller footprint and are more affected by rain. It also introduces high costs.
Remember: Antenna size gets smaller as the frequency gets higher but at the same time, to properly focus the beam we'll have a relatively (to the wavelength) big antenna dish.
= Antennas
At least 10° inclination to avoid ground noises & obstacles.
An antenna can be a transmitting antenna or receiver or both. It can also be called transducer.
== Isotropic & Directional antennas.
Isotropic radiator is a theoretical point which radiates with the same intensity in all directions (Not ideal, it wastes a lot of power). A#sub[e] = $λ^2 / (4pi) $. With λ = wavelength.
*2D* (not 3D) isotropic radiators are used for radio TV broadcasting.
*3D* are used for theoretical comparison to determine the figure of merit of the antenna OR for space comms (backup/emergency antenna).
Directional antennas are used to avoid wasting power and concentrate the radiated power. Obviously shifting a signal from radial to directional increases the strength in the desired direction and reduces drastically in all the others.
#figure(
image("images/introduction/isotropic.PNG", width: 100%),
caption: [Isotropic and directional antennas]
)<isotropic_and_directional_antennas>
== Antenna Area.
Beamwidth is the width of the beam , it determines how precise the accuracy must be between Tx and Rx. Making it bigger we lower the required accuracy but we lose gain.
The antenna effective area is the measure of how effective an antenna is at collecting the power of electromagnetic radiation. The antenna area is smaller than the physical area $ A#sub[e] = η A#sub[p] $ with η being the efficiency factor and η < 1.
If a signal enters the dish and hits the edge, it may scatter and create interference.
Many practical antennas have circular aperture #sym.arrow.r $ A#sub[p] = (pi⌀^2)/4; A#sub[e]=η((pi⌀^2)/4); G#sub[max] = η((pi⌀)/λ)^2$
== Dipoles
Dipoles are used for low-gain antennas.
#figure(
image("images/introduction/dipole.PNG", width: 80%),
caption: [Dipole antennas]
)<dipole_antennas>
The quarter-wave dipole, with the mirror is the same as half-wave dipole but we compacted and saved space. We can use crossed dipoles to approximated isotropic radiator and we can place various dipole lineearly to increase reach and have narrower beam. We can also combine colinear arrays with reflectors to increase gain.
#figure(
image("images/introduction/dipole_beam.PNG", width: 80%),
caption: [Linearly placed dipoles beam (colinear arrays)]
)<linearly_placed_dipole_beam>
== Waveguide
Waveguides are hollow metallic structures for transmitting electromagnetics energy from source to load in a bounded medium (like a pipe)
#figure(
image("images/introduction/types_of_waveguide.PNG", width: 80%),
caption: [Various types of waveguides]
)<types_of_waveguide>
== Types of antennas
=== Parabolic antenna
The basic of parabolic reflectors is that the shape of the antenna focuses the signal. The electromagnetic reciprocity theorem guarantees the same properties when transmitting and receiving.
#figure(
image("images/introduction/parabolic_reflector.PNG", width: 50%),
caption: [Parabolic reflector in theory]
)<parabolic_reflector>
#figure(
image("images/introduction/parabolic_antenna.PNG", width: 60%),
caption: [Parabolic reflector in practice]
)<parabolic_antenna>
=== Offset antenna
We can also use offset parabolic reflectors. They reduce accumulation of dirt and interferences from feed. It's best suited for small antenna area, otherwise mechanical stability, manufacturing issues and power consumption are better in a parabolic antenna of the same area.
#figure(
image("images/introduction/offset_reflector.PNG", width: 100%),
caption: [Offset reflector]
)<offset_reflector>
#figure(
image("images/introduction/offset_reflector_aim.PNG", width: 100%),
caption: [Offset reflector aim]
)<offset_reflector_aim>
Feed horns can be active (does something to the signal) or passive. When passive, they introduce feeder losses and should be used only when there are no other valid alternatives.
#pagebreak()
=== Cassegrain antenna
Cassegrain antenna, instead of having the feed in the focus, have a reflector and behind (at the vertex) it the feed. It reduces noise and feeder radiation to the side of the dish. Noise is reduced because it contains two reflector (less signal loss).
#figure(
image("images/introduction/cassegrain_vs_parabolic.PNG", width: 100%),
caption: [Feeds: Cassegrain vs front]
)<cassegrain_vs_front>
The larger the frequency, the greater the gain & narrower beam.
#figure(
image("images/introduction/antenna_types_comparison.PNG", width: 100%),
caption: [Antenna types, comparison and summary]
)<antenna_types_comparison>
=== Patch antenna & Beamforming
Patch antenna are flat, can be squares, circles or exagons and are composed of a dealetric substrate. Antenna array is a set of multiple antennas connected and working as one. They can combine to have narrower beam or filter undesired signals when receiving. To cover areas with difficult shapes we can feed multiple feeds with the same signals forming multiple shaped beams (so, an array) or we can instead use non-parabolic shaped reflector (once manufactered you cannot change it) *or* we can also use reflect array (array of reflecting cells, experimental).
#figure(
image("images/introduction/beamforming.PNG", width: 100%),
caption: [Beamforming]
)<beamforming>
=== Polarization
Circular polarization allows us to disregard polarization alignment at the cost of complexity, bulk of equipment and manufactoring cost.
Linear polarization is simpler and results in lower cost antennas but needs polarization adjustment, changes depending on coordinates and is distorted by the ionosphere.
Low gain antenna are usually on the opposite side of a high gain, because they need to be used dusing emergencies or specific operations. They can be built to send circular polarized signals.
#figure(
image("images/introduction/antenna_summary.PNG", width: 85%),
caption: [Antenna summary]
)<antenna_summary>
= Space & Boundaries
== Satellites
Satellite boundaries by altitude:
- LEO (Low Earth Orbit): 160 - 2000km, contains small satellites with low power requirements. It has short round trip (time for the signal to be sent and received back) and it costs less to put in orbit. Is has small coverage and companies like Starlink need to put a costellation of satellite to cover a wide area;
- MEO (Medium Earth Orbit): 2000 - < 35.800km, not optimal for commercial use. Used for GPS & Science research;
- GEO (Geostationary Earth Orbit): 35.800km, Satellite in this orbit are seen as immobile from Earth. Used for broadcasting, meteo, and as a repeater for point to point links. 2 degree spacing is required between satellites. Orbits are not perfect and signal strength may vary;
- Graveyard: GEO + 300km, Satellite in GEO are sent here when they need to be put out of service.
Mention of honor to highly inclined orbits, they are hard to use on Earth because it has different speed w.r.t current distance from the planet. It can be used in missions to other planets.
== Space
We refer to "space communication systems" when ((Tx || Rx) || (Tx && Rx)) are in a spacecraft or outside Earth atmosphere.
Lagrangian point: points in which the forces of two bodies cancels out. For two given bodies there are 5 points. Relatively (to the two bodies) stationary.
Space boundaries:
- Geospace: is the region of outer space in the vicinity of the Earth. starts at 80km (or 100km) up to 40.000km
- Cislunar space: 80km (or 100km) kerman line up to earth-moon lagrangian point L2 at 440.000km;
- Deep space: there are various definitions but we care aboout the ITU definition because it defines the frequencies to use at certain distances (different frequencies for deep space and for near earth). > 2.000.000km is deep space.
- Near earth: Geospace (80km or 100km) up to 2.000.000km.
#figure(
image("images/introduction/deep_space_near_earth_bands.PNG", width: 100%),
caption: [Frequency bands for deep space & near Earth]
)<deep_space_near_earth_bands>
#figure(
image("images/introduction/space_boundaries.PNG", width: 130%),
caption: [Visualization of space boundaries]
)<space_boundaries>
= Noise
Noise refers to all unwanted contributions to the signal. Other signals interefences are also noise.
== Artificial noise
- For a resistor we can use gaussian noise to model the noise, in particular white noise with constant power spectral density. Black noise is a valid alternative because we are interested only in a specific portion of the spectrum.
$ N#sub[o] = K*T$, power delivered by a noise source is $P#sub[N] = k*T*B$
- Any amplifier worsens SNR but it is necessary, otherwise weak signals would be either impossible to process or overwhelmed by the internal noise of the components. The first amplifier when receiving *MUST* be low noise, because the amplifier noise is the major contribution to noise (after amplifying the signal, the noise sources introduced after it are not relevant). It's called *LOW-NOISE AMPLIFIER*.
T#sub[eq] = Equivalent Noise Temperature: The temperature that "represents the amplifier noise". More formally: it is the temperature of a resistance that, placed as input of an ideal noiseless amplifier, would provide the same output as the real amplifier.
Noise figure of the amplifier: $F(T#sub[A]) = 1+ (N#sub[o], "int")/(K*T#sub[A])$.
Noise figure at room temperature (290K): $F(T#sub[o]) = 1+(T#sub[eq])/(T#sub[o]).$
T#sub[eq] can be approximated to: $T#sub[eq] = (F-1) * T#sub[o] = 10^(x/10) -1 * 290k.$
== Natural noise
- Ground noise: Earth itself, it depends heavily on dish inclination (at 90 deg. it will be 0);
- Sky noise:
- Sun: strong variable source of noise. Twice a year it interferes with GEO satellites;
- Planets: negligible unless pointed directly at them;
- Moon: negligible at offset angles > 2 degrees. Above 1 Ghz the noise is almost frequency indipendent;
- Milky Way Galactic Noise (MWGN): At maximum when pointing at Saggittarius (center of the galaxy), 10.000k at 100Mhz, 1k at 1Ghz. As such it can be ignored at Ku-band or above *BUT must be considered below*;
- Cosmic Microwave Background Radiation (CMBR): Always present \~= 2.7k.
- Atmosphere: We have differences between clear sky and rain, but we can approximate to $260k < T#sub[m] < 280k => ~275k. $ With clear sky we consider MWGN & CMBR. With rain we consider *only* losses caused by rain. After 10 Ghz noise from atmosphere gasses is dominant, with oxygen noise peaks at 22Ghz and 60Ghz. The cosmic noises like microwave background radiation is prevalent outside 1-15Ghz. If we increase elevation angle we reduce sky noise ex max = 0°, min = 90°;
- Ground noise: with elevation > 10° => 45-50k, for negative elevation 290k.
$ "SNR"#super[Clear] = (P#sub[s]#super[Clear])/(k(T#sub[CMBR] + T#sub[MWGN])B) $
$ "SNR"#super[Rain] = (P#sub[s]#super[Clear])/(L#sub[Rain]*k*T#sub[m]*B) $
Rainfall noise is relevant > 4 Ghz and reaches 100k near 15Ghz.
Below 1Ghz cosmic noise.
When looking at cascading systems, the noise contribution of the first device is the most important, as such it should have very high gain. We could use cryogenic cooling to reduce noise.
Figure of merit: $G/T$. With G= Gain at receiver frequency and T = Noise temperature.
Uplink noise: if there is rain it dominates the noise, otherwise we can approximate Earth noise at 290-300k. If the antenna is not pointed only at Earth but space as well we introduce CMBR + MWGN and reduce the Earth temperature influcence.
#figure(
image("images/introduction/noise_summary.PNG", width: 100%),
caption: [Noise sources summary]
)<noise_sources_summary>
#figure(
image("images/introduction/noise_graph.PNG", width: 100%),
caption: [Noise graph]
)<noise_graph>
= Modulation
== Analog to digital
We use quantization to sample an analog signal.
Nyquist theorem tells us that the sampling rate must be at least *TWICE* the baseband B$ => R#sub[s] >= 2B $
Digital processing is easier, cheaper, compressable, encryptable, can be stored easily, but requires more bandwidth and adds complexity & quantization noise.
We can compress a lot, trading off quality vs data rate. For example \~= 20Khz is the limit of human hearing, knowing this we don't need anything higher if we are transmitting only voice.
- Voice: \~= 10Kbps
- mp3: \~= 32-320Kbps
- CD: \~= 44.1Kbps
- video: 2-40 Mbps
- 480p: \~= 2-3 Mbps
- HD-FullHD: \~= 4-6 Mbps
- 4k: \~= 19 Mbps
== Modulation
Before sending a signal we need to go from base band to RF band. Modulation does this operation. It shifts from low frequencies to high. Reasons for modulating: an antenna may only operate in high frequencies.
Analog modulation: easy to demodulate, requires more power, used for AM radio.
Technologies for high power amplifiers include:
- TWTAS (Traveling-wave tube amplifiers ) based on waveguide;
- SSPA (Solid state power amplifier) based on semiconductors.
#figure(
image("images/introduction/exciter_transmitter.PNG", width: 70%),
caption: [Structure of transmitter system with modulation]
)<exciter_transmitter>
#pagebreak()
A good design for a complete system is the following image
#figure(
image("images/introduction/good_system_design.PNG", width: 130%),
caption: [Good system design]
)<good_system_design>
There are a lot of problems with analog modulation, for example we have to operate the HPA at saturation introducing the impossibility to use amplitude modulation & just phase and frequency. Frequency modulation introduces side lobes that must be filtered.
== Digital modulation
There are various techniques to implement digital modulation:
- FSK (Frequencyu Shift Keying): Is very simple, uses a lot of bandwidth;
- BPSK (Binary Phase Shift Keying): It has only two possible values;
- QPSK (Quadrature Phase Shift Keying): It maps to a costellation of 4 values, it reduces a lot spectrum occupancy;
- 8PSK.
With BPSK we have main lobe +- R#sub[b] w.r.t carrier 2R#sub[b].
With QPSK we have main lobe +- R#sub[s] w.r.t carrier 2R#sub[s] = R#sub[b].
Same amount of information but half the band.
$"BPSK" => R#sub[s] = R#sub[b]$;
$"QPSK" => R#sub[s] = (R#sub[b])/2$;
$"8PSK" => R#sub[s] = (R#sub[b])/3$;
$"MPSK" => R#sub[s] = (R#sub[b])/(log#sub[2]M)$.
$E#sub[b] = P#sub[r] * T#sub[b] = (P#sub[r])/(R#sub[b])$. With E#sub[b] = energy per bit & P#sub[r] = average RF power of the received signal.
$E#sub[s] = E#sub[b] * log#sub[2] M$
$"BER" = "n. of err bit"/"tot. n. of bit"$. OR $(E#sub[b])/(N#sub[o])$ for fair comparisong between modulation schemes.
#pagebreak()
With bigger costellations it grows power demand as well. When sending a signal we have roll of factor (the time for the signal to rise and fall), we filter it and simplify B=R#sub[s]
So we can say that bit rate is closely related to bandwidth but they are not the same thing, depending on the modulation (and R#sub[s]) B changes usually when choosing costellation we assign signal so that errors result in fewest bit flip as possible.
== Multiple access
Multiple access allows multiple users to share the communication channels. We only saw two techniques but there are a lot (signal theory notes)
-FDMA (Frequency Division Multiple Access): divides the channel frequency and gives to each user a piece. Requires guard spaces between each piece. It's inflexible and used for TV broadcasting.
#figure(
image("images/introduction/FDMA.PNG", width: 70%),
caption: [FDMA]
)<fdma>
-TDMA (Time Division Multiple Access): Divides the usage in time, each user get the whole channel for a period. Requires precise synchronization. Used for digital TV.
#figure(
image("images/introduction/TDMA.PNG", width: 70%),
caption: [TDMA]
)<tdma>
= Codes
These codes are possible exploiting the properties of a digital system. Information is not degraded like in analog. It's either OK or NOT.
When we transmit bits we may have a lot of noise that, when sampling the signal, results in a bit flip.
Error detection is the process of detecting errors, Error Correcting is the process of fixing errors. When using these techniques we add information to the transmission and as such we have more bits to send.
== Error detection codes
Transmission with only error detection are ARQ (automatic repeat request) and will check for errors and ask to resend the package if errors are found. The simplest form of EDC is parity check: we add a parity bit that is 1 if the number of 1/0 (to decide in the protocol which one) are odds. 0 otherwise. Parity check detects only odd number of bit flips, if the bit flips are even then it will fail and be unable to detect errors. 7 bit + 1 parity = 8 bit = 1 byte.
The CRC is a better EDC, contains more redundant info to be able to suffer more noise. With _N_ as the total length of the packet and _k_ as the original packet at transmitter, we have $n=N-k$ check bits
== Error correcting codes
These types of codes use FEC (forward error correcting), this means that they have all the information to automatically correct errors without requesting anything back. This is a must have in space communication systems in which the time to send each package is a burden and would overwhelm buffers (While waiting for a ARQ response, all the received packages need to be stored).
Hamming distance: difference (distance) in bit from original packet to received (corrupted) packet.
FEC increases symbol rate by a factor of $1/r$.
There are different types of FEC, block codes operates _m_ chunks (blocks) of bits, convoluted codes instead operate bit by bit. The simplest example of Block codes is majority decoding: it will repeat _N_ times the bit and choose by majority, very inefficient bandwidth wise. Resistant to $(N/2)-1$ errors ex $N=3 => 1 "error"$.
Turbo codes are the best. They are close to the Shannon limit, that describes the boundary for bandwidth efficiency.
= Deep Space Network
An international network of antennas to support spacecraft missions, radio and radar astronomy, and selected Earth orbiting missions.
The network consists of 3 deep space communication facilities placed 120° apart. Goldstone (Mojave, USA); Madrid (Spain); Canterra (Australia).
#figure(
image("images/introduction/DNS_Antenna_coverage.PNG", width: 70%),
caption: [DNS Antenna Coverage]
)<dns_antenna_coverage>
LEO is inside the "blind spots". From GEO onward we have 100% coverage and some areas in which two antennas at the same time can fetch a signal.
These 3 places are chosen for their low rain probabilities, for political reasons (international alliances), and for geografical complementariety.
In the network that we talked about, each site is made with:
- 1 70m antenna Cassegrain configuration;
- 1 34m High Efficiency Antenna (HEF) Cassegrain configuration;
- 3 34m Beam waveguide Antenna (BWG) configuration.
We need cryogenic in the receiver & we also need to reduce feed-system losses.
In DNS we need at least 20° angles otherwise we have η below accepted standards.
In the BWG configuration, we have the received signal carried through the waveguide behind the antenna to be processed. This means that all the processing components don't need to be engineered to turn with the antenna.
ESA also has a DNS network with sites in Australia, Spain, South America. Russian, China, India have them as well.
= Power/link budget
We can use solar panels up until Jupiter (Juno/Juice), from Jupiter onward we need nuclear reactors.
EIRP = Effective Isotropic Radiated Power = Tx power into antenna \* Transmittor antenna gain. We calculate:
$ P#sub[HIGH POWER AMPLIFIER dB] = 10 * log#sub[10] ("watt value") + 30 $
$ P#sub[t] = P#sub[HPAdbW] - L#sub[FEED] $
$ "EIRP" = P#sub[tdbW] + G#sub[t dBi] $
In free space propagation the received power decays by 20dB per decade (every 10x the distance).
The link budget is an equation that allows the evaluation of the SNR at the output of the receiver (prior to analog to digital conversion and demodulation).
$ "SNR" = (P#sub[s])/(P#sub[n]) = C/N = "EIRP" - K + (G#sub[r])/(T#sub[tot]) - L#sub[sys] - L#sub[FS] - L#sub[atm] - R#sub[b] $
$ (C/N)#super[CLEAR] = (E#sub[b])/(N#sub[0]) * r * log#sub[2] M $
Coupling losses: occurs everytime we use connectors. losses already included in EIRP.
Sensitivity = the weakes signal power level that the receiver is able to detect and decode
In the uplink (satellite) there is no need for very low noise receiver, in the downlink it's beneficial.
|
https://github.com/Ttajika/class | https://raw.githubusercontent.com/Ttajika/class/main/microecon/functions.typ | typst | #import "@preview/showybox:2.0.1": showybox
#import "@preview/suiji:0.3.0": *
#let default-quiz-style(name:"問題", question:[], answer:[], commentary:[], point:[], tag:[], id:[], hide-id:false, ) = {
show figure: it => {
showybox(frame: (border-color: blue.darken(10%),
body-color: white, title-color: blue.lighten(90%),),
sep: (
dash: "dashed"
),
breakable: true,
title-style: (
color: blue.darken(60%),
weight: "regular",
align: left
),
title: [#text(size:1.2em)[#strong[#name #tag (#point\p).]]],
[#it.body]
)
}
[#figure(kind:"question",supplement: name)[#question]
#label(id)]
}
#let default-answer-style(name:"解答例", question:[],answer:[], commentary:[], tag:[],id:[], hide-id:false, ) = {
show figure: it => {
showybox(frame: (border-color: red.darken(10%),
body-color: white, title-color: red.lighten(90%),),
breakable: true,
sep: (
dash: "dashed"
),
title-style: (
color: red.darken(60%),
weight: "regular",
align: left
),
title: [#text(size:1.2em)[#strong[#name #tag.]]],
[#it.body],
[解説:#commentary]
)
}
[#figure(kind:"answer",supplement: name)[#answer]
#label(id+"A")]
}
#let test-question-style(name:"問題", question:[], answer:[], commentary:[], point:[], tag:[], id:[], hide-id:false, ) = {
show figure: it => {
[#text(size:1.1em)[#strong[#ref(label(id)).]] #it.body \ ]
}
[#figure(kind:"question",supplement: name)[#question]
#label(id)]
//解答分のスペースを取る.
hide[#text(size:3em)[#answer]\ ]
}
#let test-question-style-no-space(name:"問題", question:[], answer:[], commentary:[], point:[], tag:[], id:[], hide-id:false, ) = {
show figure: it => {
[#text(size:1.1em)[#strong[#name #tag. ]] #it.body \ ]
}
[#figure(kind:"question",supplement: name)[#question]
#label(id)]
//解答分のスペースを取る.
}
#let test-answer-style(name:"問題", question:[],answer:[], commentary:[], tag:[],id:[], hide-id:false, ) ={
show figure: it => {
[#text(size:1.1em)[#strong[#name #tag. ]] #h(1em) #it.body ]
}
[#figure(kind:"question",supplement: name)[#question \ ]
#label(id)]
//解答分のスペースを取る.
[ #line(stroke: (thickness: .5pt, dash: "dotted"),length:100%)
#strong[略解:] #answer
#line(stroke: (thickness: 1pt, dash: "dashed"),length:100%)
]
}
#let Quiz_create(..quiz) ={
return quiz.pos()
}
#let quiz(id,question:[],answer:[], commentary:[],show-question: true, show-answer: true, category: (), point: 0) = {
return (id: id,question: question,answer: answer, commentary: commentary, show-question:show-question, show-answer:show-answer, category:category,point: point)
}
#let quiz-numbstyle(id, n,numbering-style) = {
if numbering-style == "id" {return id}
if numbering-style == "number" {return n}
}
#let Subgroups(quizbank, list, categ, mode) = {
if mode == "" {return quizbank}
if mode == "sub" {
let subquizs = ()
for quiz in quizbank {
if quiz.id in list {
subquizs.push(quiz)
}
}
return subquizs
}
if mode == "cat" {
let subquizs = ()
for quiz in quizbank {
if quiz.category in categ {
subquizs.push(quiz)
}
}
return subquizs
}
}
#let tests_gen(quizbank, subgroups: (), categories:(), style: "both", numbering-style: "id",mode:"", show-total-score:false, question-style: default-quiz-style, answer-style: default-answer-style) = {
let active_quizbank = Subgroups(quizbank, subgroups, categories, mode)
let n = 0
if style == "Q" {
for quiz in active_quizbank {
n = n + 1
let numb = quiz-numbstyle(quiz.id, n,numbering-style)
question-style(name:"問題",question: quiz.question, answer: quiz.answer, commentary: quiz.commentary,point: quiz.point, id: quiz.id, tag:numb)
}
}
if style == "A" {
for quiz in active_quizbank {
n = n + 1
let numb = quiz-numbstyle(quiz.id, n,numbering-style)
if quiz.show-answer == true{
answer-style(question: quiz.question, answer: quiz.answer, commentary: quiz.commentary, id: quiz.id, tag:numb)
}
}
}
if style == "both" {
for quiz in active_quizbank {
n = n + 1
let numb = quiz-numbstyle(quiz.id, n,numbering-style)
question-style(name:"問題",question: quiz.question, answer: quiz.answer, commentary: quiz.commentary,point: quiz.point, id: quiz.id, tag:numb)
if quiz.show-answer == true{
answer-style(question: quiz.question, answer: quiz.answer, commentary: quiz.commentary, id: quiz.id, tag:numb)
}
}
}
if style == "Q-A" {
for quiz in active_quizbank {
n = n + 1
let numb = quiz-numbstyle(quiz.id, n,numbering-style)
question-style(name:"問題",question: quiz.question, answer: quiz.answer, commentary: quiz.commentary,point: quiz.point, id: quiz.id, tag:numb) }
let n = 0
for quiz in active_quizbank {
n = n + 1
let numb = quiz-numbstyle(quiz.id, n,numbering-style)
if quiz.show-answer == true{
answer-style(question: quiz.question, answer: quiz.answer, commentary: quiz.commentary, id: quiz.id, tag:numb)
}
}
}
}
#let seed = datetime.today().year() * datetime.today().month() * datetime.today().day()
#let random_test(quizbank, size: 1, subgroups: (), categories:(), style: "both", numbering-style: "id", show-total-score:false, question-style: default-quiz-style, mode: "", answer-style: default-answer-style, seed:seed) = {
let active_quizbank = Subgroups(quizbank, subgroups, categories, mode)
let id_list = ()
for quiz in active_quizbank {
id_list.push(quiz.id)
}
let rng = gen-rng-f(seed)
let chosen_groups = ()
{(rng, chosen_groups) = choice-f(rng, id_list, size: size, replacement:false)
}
tests_gen(quizbank, subgroups: chosen_groups, categories:(), style: style, numbering-style: numbering-style,mode:"sub", show-total-score: show-total-score, question-style: question-style, answer-style: answer-style)
}
#let numberer(pre:"", post:"", chars) ={
let cs = chars.clusters()
let csl = cs.len()
(n) => {
let s = if 0 < n and n <= csl {cs.at(n - 1)}
pre + s + post
}
}
#let katanumb = numberer(pre:"",post:"","アイウエオカキクケコサシスセソタチツテトナニヌネノハヒフヘホマミムメモヤユヨラリルレロワヲン")
#let kuranenv(body) = {
let kuran_count = counter("kuran_counter")
kuran_count.update(0)
body
}
#let kuran(n:none) ={
if n == none {
let kuran_count = counter("kuran_counter")
kuran_count.step()
box(inset:(x:9pt,y:3pt), stroke:1pt,baseline: 20%)[#context[#numbering(katanumb,kuran_count.get().at(0))
]
]
}
else {
box(inset:(x:9pt,y:3pt), stroke:1pt,baseline: 20%)[#numbering(katanumb,n)]
}
}
|
|
https://github.com/Kasci/LiturgicalBooks | https://raw.githubusercontent.com/Kasci/LiturgicalBooks/master/CSL_old/oktoich/Hlas2/6_Sobota.typ | typst | #let V = (
"HV": (
("", "Jehdá ot dréva", "Plóť predajúšče ránam i horčájšyja múki terpjášče, i núžnuju smérť múčenicy vsechváľniji, i mučítelej posramíste, i čésti ídoľskija voístinnu potrebíli jesté, Christá propovídajušče jedínaho Bóha i Vladýku: jemúže so ánheľskimi líki, vincenóscy slávniji, predstoité."),
("", "", "Plóť predajúšče ránam i horčájšyja múki terpjášče, i núžnuju smérť múčenicy vsechváľniji, i mučítelej posramíste, i čésti ídoľskija voístinnu potrebíli jesté, Christá propovídajušče jedínaho Bóha i Vladýku: jemúže so ánheľskimi líki, vincenóscy slávniji, predstoité."),
("", "", "Slóva jávľšahosja na zemlí, propovídnicy javístesja božéstvenniji, i blahočéstiju vsích naučíste, i pravoslávnoje božéstvennych slovés izlóžše, ímiže jéres daléče othnáste ot cérkve Christóvy. Ťímže vo obíteli prísno živúščyja, jáko svjaščennoďíjstvennicy Tróicy, vsích vvedíte blažénniji."),
("", "", "Íže zemnýja slásti ne vozľubívše strastotérpcy, nebésnym blahím spodóbišasja, i ánhelom sohráždane býša: Hóspodi, molítvami ích pomíluj, i spasí nás."),
("", "", "Svjatým múčenikom moľáščymsja o nás, i Christá pojúščym, vsjáka prélesť prestá, i čelovíčeskij ród víroju spasájetsja."),
("", "", "Lícy múčeničestiji protívišasja mučítelem, hlahóľušče: mý vójinstvujem carjú sílam: ášče i ohňú i múkam predadité nás, ne otmetájemsja Tróičeskija síly."),
("Bohoródičen", "", "Préjde síň zakónnaja, blahodáti prišédši: jákože bo kupiná ne sharáše opaľájema, táko Ďíva rodilá jesí, i Ďíva prebylá jesí. Vmísto stolpá óhnennaho, právednoje vozsijá sólnce: vmísto Mojséa, Christós, spasénije dúš nášich."),
),
"S": (
("", "", "Vélija sláva, júže sťažáste svjatíji víroju: ne tókmo bo v stradánijich vrahá pobidíli jesté, no i po smérti dúchi prohónite, nedúžnyja isciľájete, dúš i ťilés vráčeve: molítesja ko Hóspodu, pomílovatisja dušám nášym."),
("Mértven", "", "Jáko cvít uvjadájet, i jáko síň mímo hrjadét, i razrušájetsja vsják čelovík: páki že hlasjáščej trubí, mértviji jáko v trúsi vsí vostánut ko tvojemú sríteniju, Christé Bóže. Tohdá Vladýko, íchže prestávil jesí ot nás, vo svjatých tvojích učiní króvich dúchi ráb tvojích."),
("Mértven", "", "Uvý mňí, kolík pódvih ímať dušá razlučájuščisja ot ťilesé! Uvý mňí, tohdá kolíko slezít, i ňísť íže pomílujet jú! Ko ánhelom óči vozvoďášči, bezďíľno mólitsja: k čelovíkom rúci prostirájušči, i ne ímať pomohájuščaho. Ťímže, vozľúblennaja mojá brátije, razumívše krátkuju nášu žízň, prestávlennym pokója ot Christá prósim, i dušám nášym véliju mílosť."),
("Bohoródičen", "", "Spasí ot bíd rabý tvojá Bohoródice Ďívo, jáko vsí po Bózi k tebí pribihájem, jáko k nerušímij sťiňí i predstáteľstvu."),
),
)
#let P = (
"1": (
("", "", "Hrjadíte ľúdije, pojím písň Christú Bóhu, razďíľšemu móre, i nastávľšemu ľúdi, jáže izvedé iz rabóty jehípetskija: jáko proslávisja."),
("", "", "Žízni istóčnik jesí, Ďívo Máti čístaja, načáľnika i Hóspoda róždši, žízň vsjáčeskich, orošájušči víroju slavoslóvjaščyja ťá."),
("", "", "Ťá utverždénije i predstáteľnicu oboháščšesja ímamy, íže Bohoródicu prečístaja ispovídajuščiji ťá, ot trevolnénija žitijá vseneporóčnaja Ďívo spasájemsja."),
("", "", "Jáže istóčnik bezsmértija róždši, ujázvlenaho mjá strasťmí otrokovíce iscilí i ohňá víčnaho ischití, jedína Bohoblahodátnaja."),
("", "", "Jáže vírnym pribížišče prisnodívo, deržávnaja pómošč pritekájuščym tí, ot vsjákija núždy i vréda soprotívnaho nás spasí."),
),
"3": (
("", "", "Utverdí nás v tebí Hóspodi, drévom umerščvéj hrích, i strách tvój vsadí v serdcá nás pojúščich ťá."),
("", "", "Zlatúju jáko voístinnu kadíľnicu, i stámnu mánny, i božéstvennuju hóru, i palátu prekrásnu Bóžiju, ťá Ďívo imenújem."),
("", "", "Cérkov, i svjaščénnoje žilíšče Slóva súšči Bohoródice, prehrišénij očiščénije búdi mňí prísno, presvjatája Ďívo."),
("", "", "Ni jazýk zémlen, ni úm bezplótnych, vozmóžet roždestvó tvojé skazáti: páče jestestvá bo i smýsla, Bohoródice, ziždíteľa rodilá jesí."),
("", "", "Utverždénije búdi i pribížišče i pokróv, Ďívo Bohorodíteľnice, víroju k tebí pribihájuščym, i Bóžiju ťá Máter ispovídajuščym."),
),
"4": (
("", "", "Uslýšach Hóspodi, slávnoje tvojé smotrénije, i proslávich čelovikoľúbče, nepostižímuju tvojú sílu."),
("", "", "Ťá Bohoródice sťažáchom Christiáne pómošč véliju, ot ľútych bíd nás ischití."),
("", "", "Neiskusobráčnaja Vladýčice, jáže Bóha vo utróbi začénši, napástej i pečálej vsích nás izbávi."),
("", "", "Nepobidímuju sťínu ťá, i deržávnuju nadéždu Bohoródice, vírniji sťažáchom v napástech čístaja."),
("", "", "Molítvu tvojú Vladýčice, jáko tvérd stepéň sťažávše, razlíčnych skorbéj izbavľájemsja."),
),
"5": (
("", "", "Svíta podáteľu, i vikóv tvórče Hóspodi, vo svíťi tvojích poveľínij nastávi nás: rázvi bo tebé inóho Bóha ne znájem."),
("", "", "Voploščénna iz tebé, Bohorodíteľnice, vírniji poznáchom, bez símene Sýna roždénna, Bóha ístinna, i čelovíka jestestvóm: ťímže ťá slávim."),
("", "", "Pod króv tvój i zastuplénije, prečístaja, vírniji vsehdá pribihájušče víroju, izbavľájemsja tobóju Bohoródice, vsjákaho ťážkaho našéstvija."),
("", "", "Izbávi nás ot napástej, i búri pomyšlénij, prečístaja, vsjákaho hňíva, vsjákaho hrichá, hláda že i hubíteľstva, i víčnaho, Ďívo, mučénija."),
("", "", "Zastúpnica náša i spasénije i nadéžda Vladýčice, christiján súšči, spasí ľubóviju ťá prísno vírno vospivájuščich, Ďívo vsepítaja."),
),
"6": (
("", "", "V bézdňi hrichóvňij vaľájasja, neizsľídnuju milosérdija tvojehó prizyváju bézdnu: ot tlí, Bóže, mjá vozvedí."),
("", "", "Íže vóleju vsjá soďivájaj, v ložesná neiskusobráčnyja vóleju vselívsja, tléju boľáščyja netľínijem obohatív, jáko milosérd."),
("", "", "Výšša výšnich síl, i svjaťíjša jesí vseneporóčnaja, páče jestestvá vmíščši nevmistímoje Slóvo v ložesná tvojá."),
("", "", "Na putí žitijá zabluždénnaho mjá, i bezpútijem částo pádajušča vo hrisích, Vladýčice, k pokajánija stezjám nastávi."),
("", "", "Ne prézri čístaja moľbý náša, na ťá polóžšich nadéždu ráb tvojích: pribížišče bo Vladýčice, i dušám očiščénije jesí."),
),
"S": (
("", "", "Slóvo bez símene začalá jesí, Sýna že jedínaho Christá rodilá jesí: tý bo rodí nóvo otročá ziždíteľa tvojehó. Ťím ťá Bohoródice, veličájem."),
),
"7": (
("", "", "Óbrazu zlatómu na póli deíri služímu, trijé tvoí ótrocy nebrehóša bezbóžnaho veľínija: posreďí že ohňá vvérženi, orošájemi pojáchu: blahoslovén jesí Bóže otéc nášich."),
("", "", "Otcú sojestéstvenna razúmnaho Sýna, síloju Dúcha presvjatáho voplotíla jesí Bohoblahodátnaja Vladýčice. Sehó úbo neprestánno molí, uščédriti pojúščyja: blahoslovénnaja, jáže Bóha plótiju róždšaja."),
("", "", "Ďívo čístaja, neiskusobráčnaja, svjatája blahoslovénnaja, pádajuščich ispravlénije, sohrišájuščich izbavlénije: spasí mja blúdnaho, spasí, Sýnu tvojemú zovúšča: blahoslovénnaja, jáže Bóha plótiju róždšaja."),
("", "", "Pristánišče tvérdo, predstáteľnica strášna, i sťiná neoboríma, v núždach bídstvujuščym, i oburevájemym v pečáli, i jáže k Sýnu tvojemú molítvami, Bohoródice súšči, ot mnohoobráznych iskušénij spasí rabý tvojá."),
("", "", "Jáže jedíno upovánije, i pómošč vírnych Bohorodíteľnice, potščísja pomoščí rabóm tvojím, pohružájemym skorbmí, otvsjúdu nedoumíjemym, i v boľíznech súščym, i pribihájuščym k tebí ľubóviju duší."),
),
"8": (
("", "", "V péšč óhnennuju ko otrokóm jevréjskim snizšédšaho, i plámeň v rósu prelóžšaho Bóha, pójte ďilá jáko Hóspoda, i prevoznosíte vo vsjá víki."),
("", "", "Živýj súščij istóčnik, jáko vódu žízni róždši, dúšu mojú istájavšuju hrichá plámenem, Ďívo Bohoródice, orosí, da ťá slávľu vo vsjá víki."),
("", "", "Umerščvlénnych, i k pérsti smértňij i tľínňij svedénnych, vozstávila jesí jedína, načáľnika žízni róždši Christá Bóha nášeho, Vladýčice Ďívo čístaja i blahoslovénnaja."),
("", "", "Izbávi mjá Vladýčice čístaja, víčnaho ohňá i osuždénija, i izmí mja ot čelovík zlotvorjáščich, i íščuščich zapjáti mňí: jáko da ublažáju ťá prísno, júže vsjá tvár božéstvenňi ublažájet."),
("", "", "V podóbiji plóti prebožéstvennyj iz tebé víďin býsť, čístaja Ďívo: jehóže neprestánno molí, pomílovati nás v zlóbi živúščich, i trepéščuščich víčnujuščaho mučénija."),
),
"9": (
("", "", "Ot Bóha Bóha Slóva, neizrečénnoju múdrostiju, prišédšaho obnovíti Adáma, jádiju v tľínije pádšaho ľúťi, ot svjatýja Ďívy neizrečénno voplotívšahosja nás rádi, vírniji jedinomúdrenno písňmi veličájem."),
("", "", "Čelovikoľúbija božéstvennaho spodóbi mjá otrokovíce, jáže jedína čelovikoľúbca Bóha plóť ot tebé vzaimovávša, i neizhlahólanno róždšaja, izbávi mjá búduščaho plámene, i múki vsjákija, ľubóviju ťá slávjaščaho."),
("", "", "Jáko krípkuju zastúpnicu, jáko nadéždu i sťínu i osnovánije, i pokróv tvérd, i nepobidímo utverždénije, i nebúrno pristánišče, i jedinoderžávnoje pribížišče sťažávše ťá vsí spasájemsja prepítaja."),
("", "", "Ďitorodíteľnice Ďívo, duší mojejá óblaki otžení: i podáj čísto uzríti Vladýčice, spasíteľnuju dobrótu, vozsijávšuju neizhlahólanno iz tvojejá presvjatýja utróby, vo svít jazýkov prepítaja."),
("", "", "Svít róždšaja božéstvennyj, mnóhimi strasťmí naviďínija pomračénnoje sérdce mojé, i pómysl očuždájuščich, prosvití otrokovíce, kápľu mí podajúšči prísno sléz, skvérny hrichá Ďívo, očiščájuščuju mí."),
),
)
#let U = (
"S1": (
("", "", "Tebé oďivájuščaho nébo óblaki imúšče svjatíji oďijánije v míri, múki ot bezzakónnik preterpíša, i prélesť ídoľskuju uprazdníša. Ťích molítvami i nás svobodí Spáse ot nevídimaho vrahá, i spasí nás."),
("", "", "Apóstoli, múčenicy i prorócy, svjatítelije, prepodóbniji i právedniji, dóbri pódvih soveršívšiji, i víru sobľúdšiji, derznovénije imúšče ko Spásu, o nás tohó jáko bláha molíte, spastísja, mólimsja, dušám nášym."),
("", "Milosérdija súšči", "Íže mértvymi i živými jáko Bóh obladájaj vsími, vlástiju životodávče, prijimí molénije ráb tvojích: pokaží tvojé milosérdije čelovikoľúbče, i podážď ostavlénije dušám, jáže prestávil jesí nadéždeju v ťá, blahoutróbija rádi jáko bláh."),
("Bohoródičen", "", "Vsjá páče smýsla, vsjá preslávnaja tvojá Bohoródice, táinstva, čistoťí zapečátannoj i ďívstvu chranímu, Máti poználasja jesí nelóžna, Bóha róždši ístinnaho: tohó molí spastísja dušám nášym."),
),
"S2": (
("", "", "Íže prosvitívyj svjatýja tvojá páče zláta, i proslávivyj prepodóbnyja tvojá jáko bláh, ot níchže umolén byvája, Christé Bóže, žízň nášu umirí, jáko čelovikoľúbec, i molítvu isprávi jáko kadílo, jedíne vo svjatých počivájaj."),
("", "", "Strástotérpcy Hospódni, blážénna zemľá napívšajasja krovéj vášich, i svjáti chrámy prijémšiji ťilesá váša: na sudíšči bo vrahá obličíste, i Christá so derznovénijem propovídaste. Tohó jáko bláha molíte spastí , mólimsja, dúšy náša."),
("", "", "Pomjaní Hóspodi, jáko bláh, dúšy ráb tvojích, i jelíka v žitií sohrišíša, prostí, niktóže bo bezhríšen, tókmo tý mohíj i prestávlennym dáti pokój."),
("Bohoródičen", "", "Bohoródice Ďívo Maríje, róždšaja Christá izbáviteľa i Spása, molísja tohó blahostýni, so apóstoly i múčeniki, i proróki, s prepodóbnymi že i svjaščennomúčeniki, očiščénije hrichóv darováti nám, i véliju mílosť."),
),
"K": (
"P1": (
"1": (
("", "", "Moiséjskuju písň vospriímši, vozopíj dušé: pomóščnik i pokrovíteľ býsť mňí vo spasénije, séj mój Bóh, i proslávľu jehó."),
("", "", "Izhnánija ľútaja, i uranénija zíľnaja, terpilívno podjáste stradáľcy, vsjákuju prélesť ot konéc síloju božéstvennoju othnáste."),
("", "", "Bóžiji služítelije, i svjatítelije, svítom mýslennym oblistájušče jávi, k svítu blahočéstija nastáviša vsích blahočestívych ispolnénija."),
("", "", "Hórdyj úm smirívše prepodóbniji, k dóbrij zemlí preidóste: voznésšesja že božéstvennymi óbrazy, i vsím smirénnym pomohájete prísno."),
("Pokóin", "", "Svitľíjšaho svíta, i víčnaho vesélija, javí pričástniki jáko Bóh, jáže prestávil jesí ot privrémennych, rabý tvojá vírnyja, preblahíj Bóže náš."),
("Bohoródičen", "", "Poščénijem krípko podvíhšesja, i terpilívno nizložíša vrahá čestnýja žený, tebí Bohorodíteľnice predstoját rádujuščesja."),
),
"2": (
("", "", "Neprochodímoje volňáščejesja móre, Bóžijim svojím veľínijem izsušívšemu, i pišešéstvovati skvozí jé Izráiľteskija ľúdi nastávľšemu, Hóspodevi pojím, slávno bo proslávisja."),
("", "", "Smértiju tvojéju popráv smérť, božéstvennyja žízni istočíl jesí prisnosúščije: jéže podážď bláže dušám usópšich, múčenik tvojích moľbámi, ostavlénije prehrišénij dáruja."),
("", "", "Íže bohátuju mílosť prísno istočája, blahočéstno prísno prijémľuščym ťá, v domú tvojém Christé, v dívňij tvojéj skíniji, místo oslablénija podážď Vladýko rabóm tvojím, jáko blahoutróben."),
("", "", "Kripčájšij na smérť býl jesí Christé: ťímže tú svjazáv, nás izbávil jesí, i nýňi izbávi ot sejá tľínija usópšyja, jáko bláh, i tvojehó sijánija pričástije dáruj."),
("", "", "Utvérždši koléblemyj úm mój, Máti Bóžija, ukripí božéstvennymi poveľíňmi, róždšahosja iz tvojehó osvjáščénnaho čréva, i uprazdnívšaho Vladýčice ádovo mráčnoje cárstvo."),
),
),
"P3": (
"1": (
("", "", "Neplódstvovavšij mój úm, plodonósen Bóže pokaží mí, ďílateľu dóbrych, nasadíteľu blahích, blahoutróbijem tvojím."),
("", "", "Razžéhšesja ohném ľubvé Christóvy, o strastotérpcy, múk razžžénija uhasíste, orošénijem vseďíteľa Dúcha."),
("", "", "Svjaťíjšiji Christóvy svjatítelije, i čestníji prepodóbnych sobóri, o vsích nás čelovikoľúbca Bóha umolíte."),
("", "", "Svjaščénňijšij lík božéstvennych prorók vozvelíčisja, i žén mnóžestvo postradávšich krípko, slávu ulučíša."),
("", "", "Umertvívsja Christé na kresťí, darovál jesí uméršym bezsmértije: jehóže ulučíti spodóbi, k tebí otšédšyja víroju."),
("", "", "So vsími proróki, i ženámi svjaščénnymi, nýňi priľížno Bóha molí Ďívo róždšahosja iz tebé, uščédriti nás."),
),
"2": (
("", "", "Na kámeni mjá víry utverdív, razširíl jesí ustá mojá na vrahí mojá, vozveselí bo sja dúch mój, vnehdá píti: ňísť svját, jákože Bóh náš, i ňísť práveden, páče tebé Hóspodi."),
("", "", "Tvojejá krasotý sijánijem ozarítisja vo víri usópšym bláhovolí, s múčeniki tvojími, íže bohátyj v mílosti: tý bo jesí Bóh náš, i ňísť práveden páče tebé Hóspodi."),
("", "", "Na mísťi prochlaždénija, v ňídrich avraámovych, izbránnaho tvojehó, spodóbi vodvorjátisja rabóm tvojím, jáko ščédr, tebí vopijúščym: tý bo jesí Bóh náš, i ňísť práveden páče tebé Hóspodi."),
("", "", "V čertózich nebésnych vodvorjátisja, s múdrymi ďívami sovšédšimi Vladýko, prijimí rabý tvojá sviščenóscy, íchže prestávil jesí tvojéju vóleju ot vrémennych, jedíne čelovikoľúbče."),
("", "", "Umerščvléna mjá i k zemlí vozvraščéna vozdvíhnula jesí, róždši žiznodávca, i vozvelá jesí mja iz áda preispódňijšaho, Bohoródicu ťá víroju slávjaščaho, i počitájuščaho prečístaja, tebé vsepítuju."),
),
),
"P4": (
"1": (
("", "", "Jéže ot Ďívy tvojé roždestvó prorók predzrjá vozpropovídaše vopijá: slúch tvój uslýšach, i ubojáchsja, jáko ot júha, i iz horý svjatýja, priosinénnyja , prišél jesí Christé."),
("", "", "Íže Christóvym strastém Bohoslávniji strastotérpcy upodóbľšesja dóbri, rasprostirájemi rádovachusja mnóhimi múkami, na víčnaja vozdajánija vzirájušče: íchže polučívše ublažájutsja prísno."),
("", "", "Zakóny sobľudájušče Dúcha, pervosvjaščénnicy premúdrenno upasóste ľúdi, jáko kórmčiji preizrjádniji na božéstvenňi pristánišči, i preložívšesja ot žitéjskich mólv, k tišiňí preidóste životá."),
("", "", "Na zemlí prišéľcy javístesja, preložívše otcý žízň vášu na nebesá, jákože píšet, blahočestnomúdrenňi, i plotskíja strásti obuzdávše boľízňmi vozderžánija, síloju Christóvoju."),
("", "", "Íchže prevél jesí Vladýko, ot vrémennaho žitijá mnohočíslennoje mnóžestvo, v pravoslávňij poslužívšyja tebí Slóve víri, vsích spasájemych mnóžestvom sočetáv, víčnaho spodóbi životá."),
("", "", "Mértvosti božéstvennyja želájušče, žízň bezkonéčnuju chodátajstvujušče voístinnu, tobóju prečístaja Vladýčice Bohorodíteľnice, čestnýja žený spodóbišasja tojá, moľášče Sýna tvojehó i Bóha o nás."),
("Bohoródičen", "", "Hóru prisínnuju zrít ťá dobroďítelmi, prorók Avvakúm Bohoródice, iz nejáže javísja Bóh neizrečénno, dobroďíteliju pokrýv nebesá, i ród čelovíčeskij iz istľínija spasýj."),
),
"2": (
("", "", "Pojú ťa, slúchom bo Hóspodi uslýšach i užasóchsja, do mené bo ídeši, mené iščjá zablúždšaho. Ťím mnóhoje tvojé snizchoždénije, jéže na mjá, proslavľáju mnohomílostive."),
("", "", "Upovánijem i ľubóviju požívšyja, i umóm pravoslávnym, jáže páče umá slávy tvojejá spodóbi rabý tvojá Christé, mnóhim tvojím čelovikoľúbijem, i izbránnych múčenik moľbámi."),
("", "", "Jáko imýj sládosti prisnotekúščij potók, prísno napojáješi izbránnyja Hóspodi: s nímiže i nýňi prestávlennyja Christé k tebí, neizrečénnym tvojím milosérdijem pitáješi pri vodách ostavlénija."),
("", "", "Tý živými Hospóďstvuješi Vladýko, i mértvymi vlaďíješi. Tý v zemlí pérsť súščuju síloju tvojéju voskresíši. Ťímže k tebí prešédšyja vo dvórich tvojích Spáse vselí."),
("", "", "Iscilíla jesí Jévino sokrušénije, i drévneje okajánstvo: ziždíteľa bo rodilá jesí, mohúščaho ispráviti nás prehrišéňmi povérženych, Bohorodíteľnice jedína Máti Ďívo."),
),
),
"P5": (
"1": (
("", "", "Mhlú duší mojejá Spáse mój razhnáv, svítom zápovidej tvojích ozarí mja, jáko jedín cár míra."),
("", "", "Tebé vozľubívše ščédre, voznenavíďiša vsjá mirskája, dóbliji strastotérpcy, primisívšesja múkam, otveržénijem plóti."),
("", "", "Svjatítelije, prorócy, prepodóbniji Bohonóscy, duchóvnymi lučámi prosviščájete mír, ťmú razorjájušče strastéj."),
("", "", "Prepodóbniji otcý, prorócy i pervosvjaščénnicy, i prisnoslávnyja žený, o nás tebí Vladýci vsích móľatsja priľížno."),
("", "", "Mólim ťá Slóve, íchže ot nás prijál jesí, líku izbránnych tvojích sopričtáv, pričástniki pokaží lúčšaho životá."),
("", "", "Prečístaja Ďívo Máti, pochvaló múčenikov, i prepodóbnych i právednych, ot vsjákaho izmí nás mučíteľstva lukávaho."),
),
"2": (
("", "", "Svíta podáteľu, i vikóv tvórče Hóspodi, vo svíťi tvojích poveľínij nastávi nás: rázvi bo tebé inóho Bóha ne znájem."),
("", "", "Umerščvlénych nás, i položénych vo tlí, vozvél jesí ot mráčnych ádovych sokróvišč, i voschítil jesí bláže, i sočetáv svjatých ánhel vóinstvom."),
("", "", "Za jéže spastí nás jáko prišél jesí Christé prijimí nýňi íže blahočéstno k tebí prestávlennyja, jáko jedín bláh, na lóňich Avraáma, i s Lázarem ťích vselí."),
("", "", "Razrišíl jesí Vladýko, ľítnuju mojú i dólhuju bráň, tebí préžde chodátaju, i molítvenniku primirénija bývšu: i nýňi tvojá rabý uščédriv upokój."),
("", "", "Pod króvom tvojím Máti Bóžija, íže naďíjuščijisja na ťá spasájutsja: žiznodávca bo rodilá jesí nám, životvorjáščaho vsjá vóleju."),
),
),
"P6": (
"1": (
("", "", "Vo hlubiňí hrichóvňij soderžím jésm Spáse, i v pučíňi žitéjsťij oburevájem: no jákože Jónu ot zvírja, i mené ot strastéj vozvedí, i spasí mja."),
("", "", "Krípostiju sérdca stradáľcy protívu vrahú opolčívšesja, tohó nizložíša, i prijáša pobídy vincý ot Bóha: i nýňi priľížno móľatsja o vsích zemnoródnych."),
("", "", "Bóžija svjatíteli počtím vírno, i prepodóbnyja jehó ublažím, spasájemi moľbámi ích, ot vsjákaho hňíva i skórbi, i vrážija navíta."),
("", "", "Postradá žén Božéstvennyj lík, i v posťí Bóhu uhodí, i polučí cárstvo nebésnoje: ťích molítvami uščédri Bóže tvój mír."),
("", "", "Íže sozdávyj žiznodávče Christé čelovíka ot zemlí, íchže o nás prestávil jesí upokój, ostavlénije podajá ím zlých, jáko milosérd i čelovikoľúbec."),
("", "", "Svjatája Bohoródice, osvjatí náša pomyšlénija, i úm ukripí, i spasí nás ot stríl lukávaho neujázvlennych, slávjaščich, vsepítaja, tvojá velíčija."),
),
"2": (
("", "", "V bézdňi hrichóvňij vaľájasja, neizsľídnuju milosérdija tvojehó prizyváju bézdnu: ot tlí, Bóže, mjá vozvedí."),
("", "", "Neizrečénnyja, i Božéstvennyja svítlosti, iďíže múčeničestiji lícy, spodóbi, jáže ot zemlí prestávil jesí, vseďíteľnoju tvojéju vóleju čelovikoľúbče."),
("", "", "Ozarítisja dobrótoju slávy tvojejá spodóbi, ostávľšyja žitijé, i k svítu tvojemú neizrečénnomu Vladýko prešédšyja upokój."),
("", "", "Izbavľájušči usérdno javísja prizyvájuščyja ťá, prečístaja Vladýčice, jáže Bóha róždšaja životóm i smértiju obladájušča."),
),
),
"P7": (
"1": (
("", "", "Cheruvímy podražájušče ótrocy v peščí, likovstvováchu vopijúšče: blahoslovén jesí Bóže, jáko ístinoju i sudóm navél jesí sijá vsjá hrích rádi nášich: prepítyj, i preproslávlennyj vo vsjá víki."),
("", "", "Terpínijem nizložíša svjatíji vrahá, terpjášče vsjáko iskušénije ľútych mučénij, jáko voístinnu Bóha vozľubíša postradávšaho za hrichí náša. Ťích molítvami spasí vsích nás Slóve, ot napástej i bíd, tebé slávjaščich."),
("", "", "Svitozráčniji svjatítelije, i prepodóbniji i prorócy i svjaščennomúčenik dostoslávnoje mnóžestvo, i žén svjatých svjaščénnoje soslóvije, vo stradániji i v posťí vozsijávšeje múžeski: prísno o nás molénija tvoríte k Bóhu, jáko da pomílujet nás."),
("", "", "Múčenik mnóžestvo mólit ťá Christé blahodáteľu, ot vsích pečálej, i skorbéj, i ľútych napástej, i vsích prehrišénij, i ot vréda spasí mja Slóve, pohíbšaho."),
("", "", "Otňúduže boľízň otbižé, i vozdychánije i pečáľ, iďíže svít sijájet tvojehó licá Christé: i iďíže svjatých sobóry nýňi likújut. Učiní vsích prestávľšichsja dúšy k tebí čelovikoľúbče, prehrišénija ích vsjá prezrív, jáko jedín mílostiv."),
("", "", "S múčeniki prečístaja, i s prepodóbnymi otcý i proróki vsími, so svjatými ženámi vo svjatých jedínaho počivájuščaho umolí, vsích osvjatíti nás, svjatými hlásy ťá slavoslóvjaščich čístaja, vo vsjá víki."),
),
"2": (
("", "", "Bohoprotívnoje veľínije bezzakónnujuščaho mučíteľa, vysók plámeň voznesló jésť: Christós že prostré Bohočestívym otrokóm rósu dúchóvnuju, sýj blahoslovén i preproslávlen."),
("", "", "Íže vezďí sýj, nizšél jesí Hóspodi, jéže spastí íže drévle preľščájemyj čelovíč ród. Ťímže ťá múčenicy móľat: sích jáže prestávil jesí ot zemlí, v zemlí krótkich Spáse upokój."),
("", "", "Mértvosti umerščvlénije ottrjásl jesí v mértvych svobóď býv, sám jedín Christé: i nýňi umerščvlénija hrichóvnaho Vladýko izbávi rabý tvojá, javľája ích nasľídniki cárstvija tvojehó."),
("", "", "Mnóhim tvojím i neizrečénnym milosérdijem, i neizmírnoju bézdnoju čelovikoľúbija tvojehó Christé, prehrišénij úbo ostavlénije prestávlennym dážď, i blahodátiju tvojéju očiščény sích javí."),
("", "", "Svitíľnik bylá jesí božéstvennyja slávy, sijánije nosjášči Ďívo dúchom, i plótiju nám jávľšahosja, i ádovu mhlú svítlostiju Božestvá svojehó potrébľša, Bohorádovannaja."),
),
),
"P8": (
"1": (
("", "", "V kupiňí Moiséju Ďívy čúdo, na sinájsťij horé proobrazívšaho inohdá, pójte, blahoslovíte, i prevoznosíte vo vsjá víki."),
("", "", "Tečénije króve vášeja, strastotérpcy Hospódni, osvjatí vsjú tvár, i izsuší jávi izlijánije prélesti, i vírnych dúšy napoí bohátno."),
("", "", "Javísja lík póstničeskij, svjátítelej že sobór i žén svjatých, i prorók slávnych, jedinočésten ánhelom, ánheľski na zemlí Dúchom požívše."),
("", "", "Izbávite vsích nás strastonóscy Hospódni, pervosvjaščénnicy, i prorócy, i prepodóbnych mnóžestvo, i žén svjatých, ot stríl vrážijich, vás voschvaľájuščich."),
("", "", "Íchže ot nás Spáse prijál jesí, v ňídrich Avraámovych učiní, i so vsími izbránnymi upokój, podajá hrichóv ích vsím razrišénije, jáko vseščédr."),
("", "", "Bohorodíteľnice čístaja, so vsími svjatými proróki, i múčeniki, i prepodóbnymi, i svjatými ženámi, i svjaščennomúčeniki, uščédriti nás Spása molí."),
),
"2": (
("", "", "Péšč inohdá óhnennaja vo Vavilóňi ďíjstva razďiľáše, Bóžijim veľínijem chaldéi opaľájuščaja, vírnyja že orošájuščaja, pojúščyja: blahoslovíte vsjá ďilá Hospódňa Hóspoda."),
("", "", "Pokazál jesí nám vrahóv smérť, schoždénijem tvojím jáko bezsmérten: božéstvennoju že síloju tvojéju, vchódy javíl jesí životá bezsmértne, jehóže múčenicy tvojí nýňi dostójno polučíša."),
("", "", "Dobróty úmnyja tvojejá nasladítisja prestávlennym spodóbi, stúd hrichá zloobráznaho očiščája, jáko čelovikoľúbec: jedín bo tý Vladýko, javílsja jesí hrichá otčuždén."),
("", "", "Isprávil jesí nás Christé, pádšyja v pérsť smértnuju, smértiju tvojéju živót dáruja, i píšču bezkonéčnuju, i rádosť prisnosúščnuju, jejáže nýňi prestávlennyja spodóbi, jáko mílostiv."),
("", "", "Vélija i strášna jésť tájna Bohomáti tvojehó roždestvá: Bóha bo rodilá jesí, jehóže smérť ne preterpí, i hrób ne rastlí. Ťímže ťá prečístaja, vsí jazýcy slávim."),
),
),
"P9": (
"1": (
("", "", "Prejestéstvenno plótiju začénšuju vo črévi, ot Otcá bezľítno predvozsijávšeje Slóvo, v písnech nemólčnych veličájem vírniji."),
("", "", "Krípcy na strásti, síľni na vrahí jávľšesja strastotérpcy: vzjáste pobídu postradávše zakónno, i vinčástesja ot Bóha."),
("", "", "Jáko Bóžiji svjaščennoďílatelije, i pástyrja dóbraho podóbnicy bývše, upasóste tohó óvcy prepodóbňi, pervosvjaščénnicy Bohoslávniji."),
("", "", "S prepodóbnymi, póstniki, i proróki svjaščénnymi, počtím žén postradávšich mnóžestvo i postóm nizložívšich vrahá."),
("", "", "Preslávnoje mnóžestvo svjatých tvojích Christé, neprestánno móľat ťá: íchže prestávil jesí vo víri Hóspodi, pričástniki javí víčnaho životá."),
("", "", "Ščedroľubívaho Bóha róždšaja plótiju, so svjatými vsími molí tohó prísno, ot bíd nás spastí , Máti Ďívo čístaja."),
),
"2": (
("", "", "Jáže préžde sólnca svitíľnika Bóha vozsijávšaho, plótski k nám prišédšaho, iz bokú Ďivíču neizrečénno voplotívšaja, blahoslovénnaja vsečístaja, ťá Bohoródice veličájem."),
("", "", "Imíjaj vlásť živými i mértvymi životá načáľniče, ot zemlí k tebí prešédšym, nasľídije nebésnoje podážď Vladýko, i svítlosť svjatých, i preslávnych strastotérpec tvojích."),
("", "", "Slóvo sýj, jéže drévle býti mí podajá živonačáľňijšeje, i jéže dóbri býti páki dáruja, v ňídrich želánnych Avraáma práotca, prestávľšyjasja rabý tvojá, jáko mílostiv vselí."),
("", "", "Vés jesí Spáse mój sládosť svitovídňijšaja, vés jesí želánije nenasyščájemoje: potóki tvojejá píšči, i vodóju ostavlénija usópšyja napój, neprestánno tebé slávjaščyja."),
("", "", "Ťá Bohoródice, dostójno vírniji nýňi ublažájem, Bohodochnovénnym slovesém tvojím posľídujušče: tý bo jedína zemným Bóha rodilá jesí, smérti razóršaho sílu, Máti Ďívo."),
),
),
),
"CH": (
("", "", "Po Chrisťí postradávše dáže do smérti, o strástotérpcy múčenicy, dúšy úbo ímate na nebesích v rucí Bóžijej, i po míru vsemú počitájemi súť móšči váša. Svjatítelije poklaňájutsja, i ľúdije vsí, rádujuščesja, sohlásno vopijém: són čésten pred Hóspodem smérť prepodóbnych jehó."),
("", "", "Vsják hrád i straná čtút móšči váša, o strástonóscy múčenicy: vý bo zakónno postradávše, vincý nebésnyja prijáste, i sehó rádi svjatítelem jesté pochvalá i cérkvam blahoľípije."),
("", "", "<NAME> vzémše svjatíji múčenicy, orúžije nepobidímoje, vsjú diávoľu sílu uprazdníša, i prijáša vincý nebésnyja, sťiná nám býša, o nás prísno moľáščesja."),
("Mértven", "", "Uvý mňí, kolík pódvih ímať dušá razlučájuščisja ot ťilesé! uvý mňí, tohdá kolíko slezít, i ňísť íže pomílujet jú! ko ánhelom óči vozvoďášči, bezďíľno mólitsja: k čelovíkom rúci prostirájušči, i ne ímať pomohájuščaho. Ťímže vozľúblennaja mojá brátije, razumívše krátkuju nášu žízň, prestávlenym pokója ot Christá prósim, i dušám nášym vélija mílosti."),
("Bohoródičen", "", "Prijidíte, Máter svíta písňmi nemólčnymi vsí proslávim, tá bo rodí spasénije náše: i rádujsja prinesém, jáko jedínoj róždšej vsích načáľňijšaho, íže préžde vík Bóha. rádujsja, jáže Jévu róždšuju páki nazdávšaja, rádujsja prečístaja Ďívo neiskusobráčnaja."),
),
"ST": (
("", "", "Stremlénije smértnoje i tľú tvojéju živonósnoju smértiju nizložíl jesí Vladýko: vsím že istočíl jesí živót víčnyj, i zemným uméršym vostánije darová. Ťímže mólimsja tebí Spáse: íže víroju k tebí prestávľšyjasja upokój, i netľínňij tvojéj slávi sích spodóbi čelovikoľúbče."),
("", "", "Da čelovíki óbščniki Božéstvennaho tvojehó cárstvija soďílaješi Christé, raspjátije preterpíl jesí, i smérť vóľnuju priját. Sehó rádi mólimsja: tvojím milosérdijem pričástniki javí cárstvija tvojehó, víroju k tebé prestávľšyjasja, i sládkija dobróty tvojejá sích spodóbi čelovikoľúbče."),
("", "", "Spastí tvojé sozdánije voschoťív, smotrénija že voístinnu strášnoje táinstvo, rádujasja soveršíl jesí jáko preblahíj: i cinóju iskupíl jesí vés mír čestnóju tvojéju króviju. Ťímže mólimsja: íže víroju k tebí prestávľšyjasja, so vsími svjatými izbavlénija spodóbi."),
("", "", "Hróznomu, trépetnomu, i strášnomu prestólu tvojemú Christé predstojášče, jáže ot víka uméršiji ožidájut právednaho izrečénija tvojehó, i božéstvennoje prijémľut pravosúdije. Tohdá úbo upokój Spáse rabý tvojá, víroju k tebé prestávľšyjasja, iďíže svjatých lícy, i rádosť jésť neizhlahólannaja."),
("Bohoródičen", "", "Jehdá plotskáho soúza chóščet dušá mojá ot žitijá razlučítisja, tohdá mí predstáni Vladýčice, i bezplótnych vrahóv sovíty razorí, i sích čéľusti sokruší, íščuščich požréti mjá neščádno: jáko da nevozbránno projdú na vozdúsi stojáščyja kňázi ťmý, Bohonevístnaja."),
)
)
#let L = (
"B": (
("", "", "Hlás tí prinósim razbójnič, i mólimsja: pomjaní nás Hóspodi vo cárstviji tvojém."),
("", "", "Christóvym strástém upodóbľšesja múčenicy, strásti čelovíčeskija razlíčnyja prísno isciľájete."),
("", "", "So proróki, apóstoly, so prepodóbnymi učíteli, soďíteľu vsích dóbri uhodíša."),
("", "", "So vsími svjatými tvojími, jáko čelovikoľúbec Hóspodi, vsjá íže víroju prestávľšyjasja, učiní rabý tvojá, mólimsja."),
("", "", "O Tróice presúščnaja, čtúščich ťá uščédri, ot prélesti vrážija i sítej, vsích izbavľájušči prísno."),
("", "", "Moľbý ráb tvojích ne prézri vseneporóčnaja, spasájušči nás ot vsjákich bíd i skorbéj."),
)
) |
|
https://github.com/sthenic/technogram | https://raw.githubusercontent.com/sthenic/technogram/main/src/tree.typ | typst | MIT License | #let tree-stroke = state("tree-stroke", 1pt + black)
#let tree-depth = state("tree-depth", 20pt)
/* Insert a tree. The nodes are ideally defined using the "tight" list syntax. */
#let tree(breakable: true, body) = context {
let line-height = measure("M").height
let indent = 0pt /* TODO: Dynamically set this somehow? */
let row-gutter = par.leading * 150%
let column-gutter = tree-depth.get() * 30%
let stroke = tree-stroke.get()
/* The symbol (├─) marking any entry but the last on a level. */
let branch = ([], grid.cell(align: top, stroke: (left: stroke))[
#rect(width: 100% - column-gutter, height: line-height / 2, stroke: (bottom: stroke))[]
])
/* The symbol (└─) marking the final entry on a level. */
let cap = ([], grid.cell(align: top)[
#rect(width: 100% - column-gutter, height: line-height / 2, stroke: (left: stroke, bottom: stroke))[]
])
/* A grid cell with a stroke on the left to wrap a lower level of the tree. */
let pipe = ([], grid.cell(stroke: (left: stroke))[])
/* Padding rows. The padding for the first item on a new level does not include a line. */
let pad-first = ([], grid.cell(colspan: 2)[#v(row-gutter)])
let pad-other = ([], grid.cell(stroke: (left: stroke), colspan: 2)[#v(row-gutter)])
let _tree(content, is-first, is-last) = {
/* Construct the grid cells of this level. We have to exempt content types
which have `children` but which we should still consider as a whole. This
is the `grid` type for now. */
/* TODO: Is there a better way of doing this rather than exempting
everything by hand? */
let body = content.body
let cells = if body.has("children") and body.func() != grid {
let result = ()
/* Rip out all content that's not descending into another list. We
completely ignore paragraph breaks to support the "loose" list markdown
syntax too (list items separated w/ blank lines). */
let filtered = body.children.filter(x => x.func() != parbreak)
let content-on-this-level = [#while filtered.len() > 0 and filtered.at(0).func() != list.item {
filtered.remove(0)
}]
result.push(if is-first { pad-first } else { pad-other })
result.push(if is-last { cap } else { branch })
result.push(content-on-this-level)
if filtered.len() != 0 {
filtered = filtered.filter(x => x != [ ])
let last = filtered.pop()
for (i, it) in filtered.enumerate() {
result.push(if is-last { ([], []) } else { pipe })
result.push(_tree(it, i == 0, false))
}
result.push(if is-last { ([], []) } else { pipe })
result.push(_tree(last, filtered.len() == 0, true))
}
result.flatten()
} else {
let result = ()
result.push(if is-first { pad-first } else { pad-other })
result.push(if is-last { cap } else { branch })
result.push(body)
result.flatten()
}
/* Spread the cells into a grid with three columns. The first one is the
indent level, the second holds the tree outline and the third holds the
contents. */
grid(
columns: (indent, tree-depth.get(), 1fr),
align: top,
..cells
)
}
/* Rip out all top-level content that's not part of the list. This will be our root node. */
let filtered = body.children.filter(x => x.func() != parbreak)
let content-on-this-level = [#while filtered.len() > 0 and filtered.at(0).func() != list.item {
filtered.remove(0)
}]
/* We wrap everything in a block to allow the user to choose whether the tree
is breakable or not. */
block(breakable: breakable, {
set block(spacing: 0pt)
block[#content-on-this-level]
let filtered = filtered.filter(x => x != [ ])
let last = filtered.pop()
for (i, it) in filtered.enumerate() {
_tree(it, i == 0, false)
}
_tree(last, filtered.len() == 0, true)
})
}
/* Convenience function for a grid with cells equal in size that number as many
as there are positional arguments. All of these grid properties can be
overridden by supplying named arguments. The idea is to provide "sane
defaults" to a grid object that may be used as a tree item, e.g. to create an
annotation to the right of the leaf text. */
#let tree-span(..any) = {
grid(
columns: (1fr,) * any.pos().len(),
gutter: 1em,
..any
)
}
|
https://github.com/simon-epfl/notes-ba3-simon | https://raw.githubusercontent.com/simon-epfl/notes-ba3-simon/main/analyseiii/resume.typ | typst | == Line integrals
On veut intégrer $f(x, y) = z$ (en bleu) selon le cercle, que l'on paramétrise comme $arrow(r)(t) = g(t)arrow(i) + h(t)arrow(j)$.
#image("./posts/res_lineintegrals_bef.png", width: 50%)
On peut d'abord réécrire notre fonction comme $f(t) = f(g(t), h(t))$. Pourquoi ? Parce que les seuls points qui nous intéressent sont ceux selon $g(h), h(t)$ !
#image("./posts/res_lineintegrals_mid.png", width: 50%)
Notre fonction aurait pu être comme ça, mais on veut juste être sur les points du cercle.
#image("./posts/res_lineintegrals.png", width: 60%)
Ici on veut l'aire donc $ A_k = f(x_k, y_k)Delta s_k $
$ A_k = f(x_k, y_k)sqrt((Delta x_k)^2 + (Delta y_k)^2) $
$ arrow.double.r d A = f(g(t), h(t))sqrt(g'(t)^2 + h'(t)^2 )d t $
#image("./posts/gaussgreen.png")
#image("./posts/rotations.png")
#image("./posts/liresume.png")
#pagebreak()
== Trouver un potentiel
- compute $integral_0^x F(t) d t$
- compute $integral_x^y F(t) d t$
- sum them
== Calculer une intégrale avec le Green's theorem
- bien choisir un sens pour la bordure (par ex)
#image("./posts/int_sens.png", width: 40%)
- $ integral_(delta Omega) F dot d arrow(s) = integral integral_omega "div"(F) d omega $
|
|
https://github.com/TypstApp-team/typst | https://raw.githubusercontent.com/TypstApp-team/typst/master/tests/typ/math/block-alignment.typ | typst | Apache License 2.0 | // Test alignment of block equations.
---
// Test unnumbered
#let eq(alignment) = {
show math.equation: set align(alignment)
$ a + b = c $
}
#eq(center)
#eq(left)
#eq(right)
#set text(dir: rtl)
#eq(start)
#eq(end)
---
// Test numbered
#let eq(alignment) = {
show math.equation: set align(alignment)
$ a + b = c $
}
#set math.equation(numbering: "(1)")
#eq(center)
#eq(left)
#eq(right)
#set text(dir: rtl)
#eq(start)
#eq(end)
|
https://github.com/gdahia/typst-ams-fullpage-template | https://raw.githubusercontent.com/gdahia/typst-ams-fullpage-template/main/README.md | markdown | # Typst fullpage AMS template
This repository contains a customization of [Typst's standard AMS template](https://github.com/typst/templates/blob/2b629bdc1eb0edb91375b5b873725290d3bba0d7/ams/template.typ) so that it looks like TeX's `amsart` using the `fullpage` package.
We created this to match the common $\LaTeX$ format we use in our clique of colleagues, so it also features other changes.
## Example
```typst
#import "amsart.typ": *
#show: ams-article.with(
title: "On discrete Fourier analysis
and applications",
authors: (
(
name: "<NAME>",
organization: [IMPA],
location: [Rio de Janeiro, RJ, Brasil],
email: "<EMAIL>"
),
),
abstract: [In this short note we introduce a few tools in discrete Fourier analysis and prove Meshulam and Roth's theorem.
These notes are based on a minicourse given by <NAME> at IMPA, summer 2024.],
bibliography-file: "refs.bib",
)
#show: ams-stmt-rules
#show: ams-general-rules
= Lecture 1: Fourier analysis and arithmetic progressions
<introduction>
The goal of this lecture is to introduce the definitions and ideas required to prove
#citeauthor[@Me95]'s theorem @Me95, the analogue of the theorem by #citet[@Ro53] for finite fields $FF_q^n$.
The *Physical space basis* is the set of functions $delta_z: G -> CC$ defined by
$ delta_z (x) = cases(1 "if" x in A, , 0 "otherwise".) $
#definition[
A character of $G$ is a group homomorphism $chi: G -> CC^*$. In other words, a character is a function $chi$ such that $chi(x+y) = chi(x) chi(y)$ for all $x,y in G$.
]
The set of characters also defines a group, called the *dual group* of $G$ and denoted by $hat(G)$.
A special character is the identity function $chi_0(x) = 1$ for all $x in G$.
Now, our next goal is to prove the following theorem.
#theorem[
The set of characters of $G$ forms an orthonormal basis of $L_2(G)$.
]<characters-basis>
The first step is to show that the characters are indeed orthonormal is to prove the following lemma.
#lemma[
Let $chi eq.not chi_0$ be a character of $G$. Then,
$ EE_(x in G) chi(x) = 0. $
]<characters-orthonormal>
#proof[
Let $chi$ be a character of $G$ different from $chi_0$. As $chi eq.not chi_0$, there exists $y in G$ such that $chi(y) eq.not 1$.
Then, we have
$ EE_(x in G) chi(x) = EE_(x in G) chi(x+y) = chi(y) dot EE_(x in G) chi(x). $
Since $chi(y) eq.not 1$, we conclude that $EE_(x in G) chi(x) = 0$.
]
```
This compiles to
![image](https://github.com/gdahia/typst-ams-fullpage-template/assets/13017652/8138f4d4-1c75-45a7-8c35-fb02e4235947)
You can find a more detailed example in `example.typ`.
## Known limitations
There is a slight problem with equations, where the subsequent paragraph is not indented.
To amend this, you can add a `$zws$ #v(-15pt)` after it.
Moreover, operators and greek letters are by default italicized inside theorems, lemmas and propositions.
To fix that (in this example, the $\log$ operator), you should add
```typst
#let log = $upright(log)$
```
to force it to look like $\LaTeX$.
|
|
https://github.com/RaphGL/ElectronicsFromBasics | https://raw.githubusercontent.com/RaphGL/ElectronicsFromBasics/main/DC/chap3/2_physiological_effects_of_electricity.typ | typst | Other | #import "../../core/core.typ"
=== Physiological effects of electricity
Most of us have experienced some form of electric "shock," where electricity causes our body to experience pain or trauma.
If we are fortunate, the extent of that experience is limited to tingles or jolts of pain from static electricity buildup discharging through our bodies.
When we are working around electric circuits capable of delivering high power to loads, electric shock becomes a much more serious issue, and pain is the least significant result of shock.
As electric current is conducted through a material, any opposition to that flow of electrons (resistance) results in a dissipation of energy, usually in the form of heat.
This is the most basic and easy-to-understand effect of electricity on living tissue: current makes it heat up.
If the amount of heat generated is sufficient, the tissue may be burnt.
The effect is physiologically the same as damage caused by an open flame or other high-temperature source of heat, except that electricity has the ability to burn tissue well beneath the skin of a victim, even burning internal organs.
Another effect of electric current on the body, perhaps the most significant in terms of hazard, regards the nervous system.
By "nervous system" I mean the network of special cells in the body called "nerve cells" or "neurons" which process and conduct the multitude of signals responsible for regulation of many body functions.
The brain, spinal cord, and sensory/motor organs in the body function together to allow it to sense, move, respond, think, and remember.
Nerve cells communicate to each other by acting as "transducers:" creating electrical signals (very small voltages and currents) in response to the input of certain chemical compounds called neurotransmitters, and releasing neurotransmitters when stimulated by electrical signals.
If electric current of sufficient magnitude is conducted through a living creature (human or otherwise), its effect will be to override the tiny electrical impulses normally generated by the neurons, overloading the nervous system and preventing both reflex and volitional signals from being able to actuate muscles.
Muscles triggered by an external (shock) current will involuntarily contract, and there's nothing the victim can do about it.
This problem is especially dangerous if the victim contacts an energized conductor with his or her hands.
The forearm muscles responsible for bending fingers tend to be better developed than those muscles responsible for extending fingers, and so if both sets of muscles try to contract because of an electric current conducted through the person's arm, the "bending" muscles will win, clenching the fingers into a fist.
If the conductor delivering current to the victim faces the palm of his or her hand, this clenching action will force the hand to grasp the wire firmly, thus worsening the situation by securing excellent contact with the wire.
The victim will be completely unable to let go of the wire.
Medically, this condition of involuntary muscle contraction is called tetanus.
Electricians familiar with this effect of electric shock often refer to an immobilized victim of electric shock as being "froze on the circuit.
" Shock-induced tetanus can only be interrupted by stopping the current through the victim.
Even when the current is stopped, the victim may not regain voluntary control over their muscles for a while, as the neurotransmitter chemistry has been thrown into disarray.
This principle has been applied in "stun gun" devices such as Tasers, which on the principle of momentarily shocking a victim with a high-voltage pulse delivered between two electrodes.
A well-placed shock has the effect of temporarily (a few minutes) immobilizing the victim.
Electric current is able to affect more than just skeletal muscles in a shock victim, however.
The diaphragm muscle controlling the lungs, and the heart -- which is a muscle in itself -- can also be "frozen" in a state of tetanus by electric current.
Even currents too low to induce tetanus are often able to scramble nerve cell signals enough that the heart cannot beat properly, sending the heart into a condition known as fibrillation.
A fibrillating heart flutters rather than beats, and is ineffective at pumping blood to vital organs in the body.
In any case, death from asphyxiation and/or cardiac arrest will surely result from a strong enough electric current through the body.
Ironically, medical personnel use a strong jolt of electric current applied across the chest of a victim to "jump start" a fibrillating heart into a normal beating pattern.
That last detail leads us into another hazard of electric shock, this one peculiar to public power systems.
Though our initial study of electric circuits will focus almost exclusively on DC (Direct Current, or electricity that moves in a continuous direction in a circuit), modern power systems utilize alternating current, or AC.
The technical reasons for this preference of AC over DC in power systems are irrelevant to this discussion, but the special hazards of each kind of electrical power are very important to the topic of safety.
How AC affects the body depends largely on frequency.
Low-frequency (50- to 60-Hz) AC is used in US (60 Hz) and European (50 Hz) households; it can be more dangerous than high-frequency AC and is 3 to 5 times more dangerous than DC of the same voltage and amperage.
Low-frequency AC produces extended muscle contraction (tetany), which may freeze the hand to the current's source, prolonging exposure.
DC is most likely to cause a single convulsive contraction, which often forces the victim away from the current's source.
AC's alternating nature has a greater tendency to throw the heart's pacemaker neurons into a condition of fibrillation, whereas DC tends to just make the heart stand still.
Once the shock current is halted, a "frozen" heart has a better chance of regaining a normal beat pattern than a fibrillating heart.
This is why "defibrillating" equipment used by emergency medics works: the jolt of current supplied by the defibrillator unit is DC, which halts fibrillation and gives the heart a chance to recover.
In either case, electric currents high enough to cause involuntary muscle action are dangerous and are to be avoided at all costs.
In the next section, we'll take a look at how such currents typically enter and exit the body, and examine precautions against such occurrences.
#core.review[
- Electric current is capable of producing deep and severe burns in the body due to power dissipation across the body's electrical resistance.
- Tetanus is the condition where muscles involuntarily contract due to the passage of external electric current through the body. When involuntary contraction of muscles controlling the fingers causes a victim to be unable to let go of an energized conductor, the victim is said to be "froze on the circuit."
- Diaphragm (lung) and heart muscles are similarly affected by electric current. Even currents too small to induce tetanus can be strong enough to interfere with the heart's pacemaker neurons, causing the heart to flutter instead of strongly beat.
- Direct current (DC) is more likely to cause muscle tetanus than alternating current (AC), making DC more likely to "freeze" a victim in a shock scenario. However, AC is more likely to cause a victim's heart to fibrillate, which is a more dangerous condition for the victim after the shocking current has been halted.
]
|
https://github.com/mitsuyukiLab/grad_thesis_typst | https://raw.githubusercontent.com/mitsuyukiLab/grad_thesis_typst/main/contents/abstract.typ | typst | #import "../lib/grad_thesis_lib.typ": abstract
#abstract[
// ここに書く
#lorem(300) // ダミーテキストを表示させている
] |
|
https://github.com/jgm/typst-hs | https://raw.githubusercontent.com/jgm/typst-hs/main/test/typ/layout/spacing-03.typ | typst | Other | // Missing spacing.
// Error: 11-13 missing argument: amount
Totally #h() ignored
|
https://github.com/jneug/typst-nassi | https://raw.githubusercontent.com/jneug/typst-nassi/main/assets/example-1.typ | typst | MIT License | #set page(width: 13cm, height:auto, margin: 5mm)
#import "../src/nassi.typ"
#show: nassi.shneiderman()
```nassi
function ggt(a, b)
while a > 0 and b > 0
if a > b
a <- a - b
else
b <- b - a
end if
end while
if b == 0
return a
else
return b
end if
end function
```
|
https://github.com/benjft/CV | https://raw.githubusercontent.com/benjft/CV/master/experience.typ | typst | == Experience
=== Software Developer, June 2023 -- Present
*Gold-Vision CRM*, Northampton, Hybrid
- Full stack developer, specialising in MSSQL Server, .Net, and React.
- Contributed to development of the core CRM product.
- Helped produce and optimize the Marketing product, improving response
times by up to 90%.
- Design and implemented features, such as a middleware layer to automatically
track and report feature usage and uptake to help inform business decisions.
- Scoped, quoted, and built bespoke integrations according to customer needs.
- Modified an existing OData API to make it more flexible, allowing custom
models/endpoints to be defined in SQL allowing customers to achieve better
reporting.
- Involved in internal peer review process, commenting on and suggesting
improvements to pull requests with a strong focus on code quality and security.
- Responsible for mentoring our junior team member by overseeing their personal
development time, helping them plan stories, and suggesting resources they
could look at to improve.
- Lead agile ceremonies including stand-ups, reviews, and retrospectives.
- Manage the team Kanban in Jira, ensuring all tasks being worked on are up to
date, and organising estimating and refinement of new tasks from the backlog.
- As part of the DevOps team, developed internal tooling and new CI/CD processes.
- Improved existing CI pipelines, reducing build and test times by over 50% with no loss
of functionality.
- Assisted lead developer in migrating the marketing product to Azure.
- Delivered presentations to customers demonstrating custom features they had
requested.
- Investigated, proposed, and implemented solutions for a post-Azure migration
feature issue, including container customization and third-party services.
=== Junior Software Developer, August 2022 -- June 2023
*Gold-Vision CRM*, Northampton, Hybrid
- Worked on bugs in the core product to learn how things were structured and
worked on core features that had been planned with the help of a mentor.
- Made use of personal development opportunities to improve my skills throughout
our tech stack using online courses. |
|
https://github.com/7sDream/fonts-and-layout-zhCN | https://raw.githubusercontent.com/7sDream/fonts-and-layout-zhCN/master/template/lang.typ | typst | Other | #import "/template/consts.typ": font
// 阿拉伯文,多国使用
#let arabic = text.with(
font: ("Noto Naskh Arabic",),
// do not effect line height calculation
top-edge: "baseline",
lang: "ara", region: none, script: "arab"
)
// 阿拉伯文,Amiri 字体
#let arabic-amiri = text.with(
font: ("Amiri",),
lang: "ara", region: none, script: "arab",
)
// 法语,拉丁字母即可,无需特殊字体
#let french = text.with(
font: (..font.western-normal,),
lang: "fra", region: "FR", script: "latn",
)
// 俄语,西里尔字母,无需特殊字体
#let russian = text.with(
font: (..font.western-normal,),
lang: "rus", region: "RU", script: "cyrl"
)
// 希腊语,希腊字母,无需特殊字体
#let greek = text.with(
font: (..font.western-normal,),
lang: "ell", region: "GR", script: "grek",
)
// 泰语,使用泰文字母
#let thai = text.with(
font: ("Noto Sans Thai Looped",),
lang: "tha", region: "TH", script: "thai",
)
// 曼丁哥语,使用恩科字母(西非书面文字)
#let mandingo = text.with(
font: ("Noto Sans Nko",),
lang: "mnk", region: "SN", script: "nkoo",
)
// 德语,拉丁字母,无需特殊字体
#let german = text.with(
font: (..font.western-normal,),
lang: "deu", region: "DD", script: "latn",
)
// 藏文,多国藏区皆有使用
#let tibetan = text.with(
font: ("Noto Serif Tibetan",),
lang: "bod", region: none, script: "tibt",
)
// 高棉文,在高棉语(亦称柬埔寨语)中使用
#let khmer = text.with(
font: ("Noto Sans Khmer",),
lang: "khm", region: "KH", script: "khmr",
)
// 天城文,以印地语为例
#let devanagari = text.with(
font: ("Noto Sans Devanagari",),
lang: "hin", region: "IN", script: "deva",
)
// 天城文,使用`dev2`造型算法的 Hind 字体
#let hind = text.with(
font: ("Hind",),
lang: "hin", region: "IN", script: "dev2",
features: ("pres",),
)
// 马拉雅拉姆文,也用于书写印地语
#let malayalam = text.with(
font: ("Manjari",),
weight: "thin",
lang: "mal", region: "IN", script: "mlym",
)
// 塔克里文,印度16-19世纪文字,现已基本不使用
#let takri = text.with(
font: ("Noto Sans Takri",),
lang: "cdh", region: "IN", script: "takr",
)
// 泰卢固文,南印度附近使用
#let telugu = text.with(
font: ("Noto Sans Telugu",),
lang: "tel", region: "IN", script: "telu",
)
// 巴厘文,巴厘岛上民族书写巴厘语使用
#let balinese = text.with(
font: ("Noto Sans Balinese",),
lang: "ban", region: "ID", script: "bali",
)
// 夏拉达文,主要用于书写克什米尔语
#let sharada = text.with(
font: ("Noto Sans Sharada",),
lang: "kas", region: "IN", script: "shrd",
)
// 傣昙文,主要用于书写傣仂语,北泰语等
#let taitham = text.with(
font: ("Noto Sans Tai Tham",),
lang: "khb", region: "TH", script: "lana",
)
// 希伯来字母,以色列希伯来语
#let hebrew = text.with(
font: ("SBL Hebrew",),
lang: "heb", region: "IL", script: "hebr"
)
// 孟加拉文,书写孟加拉语
#let bengali = text.with(
font: ("Noto Sans Bengali",),
lang: "ben", region: "BD", script: "bng2",
)
// 亚美尼亚字母,亚美尼亚语,亚美尼亚共和国
#let armenian = text.with(
font: ("Noto Serif Armenian",),
lang: "hye", region: "AM", script: "armn",
)
// 传统蒙文字母
#let mongolian = text.with(
font: ("Noto Sans Mongolian",),
lang: "mon", region: "MN", script: "mong",
)
|
https://github.com/daniel-eder/typst-template-jku | https://raw.githubusercontent.com/daniel-eder/typst-template-jku/main/src/template/pages/acknowledgements.typ | typst | // SPDX-FileCopyrightText: 2023 <NAME>
//
// SPDX-License-Identifier: Apache-2.0
#import "../styles/pre_content_heading.typ": pre_content_heading
#let acknowledgements(
acknowledgements,
) = {
set page(numbering: "i", number-align: center)
pre_content_heading([Acknowledgements])
acknowledgements
} |
|
https://github.com/Robotechnic/alchemist | https://raw.githubusercontent.com/Robotechnic/alchemist/master/README.md | markdown | MIT License | # alchemist
Alchemist is a typst package to draw skeletal formulae. It is based on the [chemfig](https://ctan.org/pkg/chemfig) package. The main goal of alchemist is not to reproduce one-to-one chemfig. Instead, it aims to provide an interface to achieve the same results in Typst.
<!--EXAMPLE(links)-->
````typ
#skeletize({
molecule(name: "A", "A")
single()
molecule("B")
branch({
single(angle: 1)
molecule(
"W",
links: (
"A": double(stroke: red),
),
)
single()
molecule(name: "X", "X")
})
branch({
single(angle: -1)
molecule("Y")
single()
molecule(
name: "Z",
"Z",
links: (
"X": single(stroke: black + 3pt),
),
)
})
single()
molecule(
"C",
links: (
"X": cram-filled-left(fill: blue),
"Z": single(),
),
)
})
````
![links](https://raw.githubusercontent.com/Robotechnic/alchemist/master/images/links1.png)
Alchemist uses cetz to draw the molecules. This means that you can draw cetz shapes in the same canvas as the molecules. Like this:
<!--EXAMPLE(cetz)-->
````typ
#skeletize({
import cetz.draw: *
double(absolute: 30deg, name: "l1")
single(absolute: -30deg, name: "l2")
molecule("X", name: "X")
hobby(
"l1.50%",
("l1.start", 0.5, 90deg, "l1.end"),
"l1.start",
stroke: (paint: red, dash: "dashed"),
mark: (end: ">"),
)
hobby(
(to: "X.north", rel: (0, 1pt)),
("l2.end", 0.4, -90deg, "l2.start"),
"l2.50%",
mark: (end: ">"),
)
})
````
![cetz](https://raw.githubusercontent.com/Robotechnic/alchemist/master/images/cetz1.png)
## Usage
To start using alchemist, just use the following code:
```typ
#import "@preview/alchemist:0.1.1": *
#skeletize({
// Your molecule here
})
```
For more information, check the [manual](https://raw.githubusercontent.com/Robotechnic/alchemist/master/doc/manual.pdf).
## Changelog
### 0.1.1
- Exposed the `draw-skeleton` function. This allows to draw in a cetz canvas directly.
- Fixed multiples bugs that causes overdraws of links.
### 0.1.0
- Initial release
|
https://github.com/Quaternijkon/Typst_FLOW | https://raw.githubusercontent.com/Quaternijkon/Typst_FLOW/main/theme.typ | typst | // This theme is inspired by https://github.com/zbowang/BeamerTheme
// The typst version was written by https://github.com/OrangeX4
// #import "../src/exports.typ": *
#import "src/exports.typ": *
#import "lib.typ": *
#let SFD=("SF Pro Display")
#let SFT=("SF Pro Text")
#let _typst-builtin-repeat = repeat
#set text(
font:Xe,
)
//页眉
#let dewdrop-header(self) = {
// if self.store.navigation == "sidebar" {
// place(
// right + top,
// {
// v(4em)
// show: block.with(width: self.store.sidebar.width, inset: (x: 1em))
// set align(left)
// set par(justify: false)
// set text(size: .9em)
// components.custom-progressive-outline(
// self: self,
// level: auto,
// alpha: self.store.alpha,
// text-fill: (self.colors.primary, self.colors.neutral-darkest),
// text-size: (1em, .9em),
// vspace: (-.2em,),
// indent: (0em, self.store.sidebar.at("indent", default: .5em)),
// fill: (self.store.sidebar.at("fill", default: _typst-builtin-repeat[.]),),
// filled: (self.store.sidebar.at("filled", default: false),),
// paged: (self.store.sidebar.at("paged", default: false),),
// short-heading: self.store.sidebar.at("short-heading", default: true),
// )
// },
// )
// } else if self.store.navigation == "mini-slides" {
// components.mini-slides(
// self: self,
// fill: self.colors.primary,
// alpha: self.store.alpha,
// display-section: self.store.mini-slides.at("display-section", default: false),
// display-subsection: self.store.mini-slides.at("display-subsection", default: true),
// short-heading: self.store.mini-slides.at("short-heading", default: true),
// )
// }
components.mini-slides(
self: self,
fill: self.colors.primary,
alpha: self.store.alpha,
display-section: self.store.mini-slides.at("display-section", default: false),
display-subsection: self.store.mini-slides.at("display-subsection", default: true),
short-heading: self.store.mini-slides.at("short-heading", default: true),
)
}
//页脚
#let dewdrop-footer(self) = {
set align(bottom)
set text(size: 0.8em)
show: pad.with(.5em)
components.left-and-right(
grid(
rows: (1fr,1fr),
gutter: 3pt,
text(fill: self.colors.primary, utils.call-or-display(self, self.store.footer), size: .8em),
text(fill: self.colors.primary.lighten(40%), utils.call-or-display(self, self.store.footer-alt), size: .7em),
),
text(fill: self.colors.primary, utils.call-or-display(self, self.store.footer-right), size: 1em),
)
}
/// Default slide function for the presentation.
///
/// - `config` is the configuration of the slide. You can use `config-xxx` to set the configuration of the slide. For more several configurations, you can use `utils.merge-dicts` to merge them.
///
/// - `repeat` is the number of subslides. Default is `auto`,which means touying will automatically calculate the number of subslides.
///
/// The `repeat` argument is necessary when you use `#slide(repeat: 3, self => [ .. ])` style code to create a slide. The callback-style `uncover` and `only` cannot be detected by touying automatically.
///
/// - `setting` is the setting of the slide. You can use it to add some set/show rules for the slide.
///
/// - `composer` is the composer of the slide. You can use it to set the layout of the slide.
///
/// For example, `#slide(composer: (1fr, 2fr, 1fr))[A][B][C]` to split the slide into three parts. The first and the last parts will take 1/4 of the slide, and the second part will take 1/2 of the slide.
///
/// If you pass a non-function value like `(1fr, 2fr, 1fr)`, it will be assumed to be the first argument of the `components.side-by-side` function.
///
/// The `components.side-by-side` function is a simple wrapper of the `grid` function. It means you can use the `grid.cell(colspan: 2, ..)` to make the cell take 2 columns.
///
/// For example, `#slide(composer: 2)[A][B][#grid.cell(colspan: 2)[Footer]] will make the `Footer` cell take 2 columns.
///
/// If you want to customize the composer, you can pass a function to the `composer` argument. The function should receive the contents of the slide and return the content of the slide, like `#slide(composer: grid.with(columns: 2))[A][B]`.
///
/// - `..bodies` is the contents of the slide. You can call the `slide` function with syntax like `#slide[A][B][C]` to create a slide.
/// 好的,去掉注释后的内容如下:
// - `config` 是幻灯片的配置。你可以使用 `config-xxx` 来设置幻灯片的配置。要进行更多的配置,你可以使用 `utils.merge-dicts` 将多个配置合并。
// - `repeat` 是子幻灯片的数量。默认值为 `auto`,这意味着 touying 将自动计算子幻灯片的数量。
// 当你使用 `#slide(repeat: 3, self => [ .. ])` 样式代码创建幻灯片时,`repeat` 参数是必需的。回调样式的 `uncover` 和 `only` 不能被 touying 自动检测到。
// - `setting` 是幻灯片的设置。你可以使用它为幻灯片添加一些设置/显示规则。
// - `composer` 是幻灯片的布局。你可以用它来设置幻灯片的布局。
// 例如,`#slide(composer: (1fr, 2fr, 1fr))[A][B][C]` 将幻灯片分为三部分。第一部分和最后一部分各占幻灯片的 1/4,第二部分占幻灯片的 1/2。
// 如果传递一个非函数值(如 `(1fr, 2fr, 1fr)`),它将被视为 `components.side-by-side` 函数的第一个参数。
// `components.side-by-side` 函数是 `grid` 函数的简单封装。这意味着你可以使用 `grid.cell(colspan: 2, ..)` 让单元格占据两列。
// 例如,`#slide(composer: 2)[A][B][#grid.cell(colspan: 2)[Footer]]` 会让 `Footer` 单元格占据两列。
// 如果你想自定义布局,可以将一个函数传递给 `composer` 参数。该函数应该接收幻灯片的内容并返回幻灯片的内容,如 `#slide(composer: grid.with(columns: 2))[A][B]`。
// - `..bodies` 是幻灯片的内容。你可以使用 `#slide[A][B][C]` 这样的语法调用 `slide` 函数来创建一个幻灯片。
#let slide(
config: (:),
repeat: auto,
setting: body => body,
composer: auto,
..bodies,
) = touying-slide-wrapper(self => {
let self = utils.merge-dicts(
self,
config-page(
fill: self.colors.neutral-lightest,
header: dewdrop-header,
footer: dewdrop-footer,
),
config-common(subslide-preamble: self.store.subslide-preamble),
)
let new-setting(body) = {
set text(fill: self.colors.neutral-darkest)
setting(body)
}
touying-slide(self: self, config: config, repeat: repeat, setting: setting, composer: composer, ..bodies)
})
/// Title slide for the presentation. You should update the information in the `config-info` function. You can also pass the information directly to the `title-slide` function.
///
/// Example:
///
/// ```typst
/// #show: dewdrop-theme.with(
/// config-info(
/// title: [Title],
/// logo: emoji.city,
/// ),
/// )
///
/// #title-slide(subtitle: [Subtitle], extra: [Extra information])
/// ```
///
/// - `extra` is the extra information you want to display on the title slide.
#let title-slide(
extra: none,
..args,
) = touying-slide-wrapper(self => {
let info = self.info + args.named()
let body = {
set text(fill: self.colors.neutral-darkest)
set align(center + horizon)
block(
width: 100%,
inset: 3em,
{
block(
fill: self.colors.neutral-light,
inset: 1em,
width: 100%,
radius: 0.2em,
text(size: 1.3em, fill: self.colors.primary, text(weight: "medium", info.title)) + (
if info.subtitle != none {
linebreak()
text(size: 0.9em, fill: self.colors.primary, info.subtitle)
}
),
)
set text(size: .8em)
if info.author != none {
block(spacing: 1em, info.author)
}
v(1em)
if info.date != none {
block(spacing: 1em, utils.display-info-date(self))
}
set text(size: .8em)
if info.institution != none {
block(spacing: 1em, info.institution)
}
if extra != none {
block(spacing: 1em, extra)
}
},
)
}
self = utils.merge-dicts(
self,
config-common(freeze-slide-counter: true),
config-page(fill: self.colors.neutral-lightest, margin: 0em),
)
touying-slide(self: self, body)
})
/// Outline slide for the presentation.
#let outline-slide(title: utils.i18n-outline-title, ..args) = touying-slide-wrapper(self => {
self = utils.merge-dicts(
self,
config-page(
fill: self.colors.neutral-lightest,
footer: dewdrop-footer,
),
)
touying-slide(
self: self,
components.adaptive-columns(
start: text(
1.2em,
fill: self.colors.primary,
weight: "bold",
utils.call-or-display(self, title),
),
text(
fill: self.colors.neutral-darkest,
outline(title: none, indent: 1em, depth: self.slide-level, ..args),
),
),
)
})
/// New section slide for the presentation. You can update it by updating the `new-section-slide-fn` argument for `config-common` function.
///
/// Example: `config-common(new-section-slide-fn: new-section-slide.with(numbered: false))`
///
/// - `title` is the title of the slide. Default is `utils.i18n-outline-title`.
///
/// - `body` is the contents of the slide.
#let new-section-slide(title: utils.i18n-outline-title, ..args, body) = touying-slide-wrapper(self => {
self = utils.merge-dicts(
self,
config-page(
fill: self.colors.neutral-lightest,
footer: none,
header: none,
margin: (top: 1.5em, bottom: 1.5em),
),
)
touying-slide(
self: self,
components.adaptive-columns(
start: align(right)[#text(
2em,
fill: self.colors.primary,
weight: "bold",
utils.call-or-display(self, title),
// font: Ar,
)],
// text("123"),
text(
fill: self.colors.neutral-darkest,
// font: Xe,
// font:"Times New Roman",
components.progressive-outline(alpha: self.store.alpha, title: none, indent: 1em, depth: self.slide-level, ..args),
),
),
)
})
/// Focus on some content.
///
/// Example: `#focus-slide[Wake up!]`
#let focus-slide(body) = touying-slide-wrapper(self => {
self = utils.merge-dicts(
self,
config-common(freeze-slide-counter: true),
config-page(fill: self.colors.primary, margin: 2em),
)
set text(fill: self.colors.neutral-lightest, size: 1.5em)
touying-slide(self: self, align(horizon + center, body))
})
/// Touying dewdrop theme.
///
/// Example:
///
/// ```typst
/// #show: dewdrop-theme.with(aspect-ratio: "16-9", config-colors(primary: blue))`
/// ```
///
/// - `aspect-ratio` is the aspect ratio of the slides. Default is `16-9`.
///
/// - `navigation` is the navigation of the slides. You can choose from `"sidebar"`, `"mini-slides"`, and `none`. Default is `"sidebar"`.
///
/// - `sidebar` is the configuration of the sidebar. You can set the width, filled, numbered, indent, and short-heading of the sidebar. Default is `(width: 10em, filled: false, numbered: false, indent: .5em, short-heading: true)`.
/// - `width` is the width of the sidebar.
/// - `filled` is whether the outline in the sidebar is filled.
/// - `numbered` is whether the outline in the sidebar is numbered.
/// - `indent` is the indent of the outline in the sidebar.
/// - `short-heading` is whether the outline in the sidebar is short.
///
/// - `mini-slides` is the configuration of the mini-slides. You can set the height, x, display-section, display-subsection, and short-heading of the mini-slides. Default is `(height: 4em, x: 2em, display-section: false, display-subsection: true, short-heading: true)`.
/// - `height` is the height of the mini-slides.
/// - `x` is the x of the mini-slides.
/// - `display-section` is whether the slides of section is displayed in the mini-slides.
/// - `display-subsection` is whether we add linebreak between subsections.
/// - `short-heading` is whether the mini-slides is short. Default is `true`.
///
/// - `footer` is the footer of the slides. Default is `none`.
///
/// - `footer-right` is the right part of the footer. Default is `context utils.slide-counter.display() + " / " + utils.last-slide-number`.
///
/// - `primary` is the primary color of the slides. Default is `rgb("#0c4842")`.
///
/// - `alpha` is the alpha of transparency. Default is `60%`.
///
/// - `outline-title` is the title of the outline. Default is `utils.i18n-outline-title`.
///
/// - `subslide-preamble` is the preamble of the subslide. Default is `self => block(text(1.2em, weight: "bold", fill: self.colors.primary, utils.display-current-heading(depth: self.slide-level)))`.
///
/// ----------------------------------------
///
/// The default colors:
///
/// ```typ
/// config-colors(
/// neutral-darkest: rgb("#000000"),
/// neutral-dark: rgb("#202020"),
/// neutral-light: rgb("#f3f3f3"),
/// neutral-lightest: rgb("#ffffff"),
/// primary: rgb("#0c4842"),
/// )
/// ```
#let dewdrop-theme(
aspect-ratio: "16-9",
navigation: "sidebar",
sidebar: (width: 10em, filled: false, numbered: false, indent: .5em, short-heading: true),
mini-slides: (height: 3em, x: 2em, display-section: false, display-subsection: true, short-heading: true),
footer: none,
footer-alt: none,
footer-right: context utils.slide-counter.display() + " / " + utils.last-slide-number,
primary: rgb("#004098"),
secondary: rgb("#543795"),
alpha: 25%,
subslide-preamble: self => block(
text(1.2em, weight: "bold", fill: self.colors.primary, utils.display-current-heading(depth: self.slide-level)),
),
..args,
body,
) = {
set text(size: 20pt)
set par(justify: true)
show: touying-slides.with(
config-page(
paper: "presentation-" + aspect-ratio,
header-ascent: 0em,
footer-descent: 0em,
margin: if navigation == "sidebar" {
(top: 2em, bottom: 1em, x: sidebar.width)
} else if navigation == "mini-slides" {
(top: mini-slides.height, bottom: 2em, x: mini-slides.x)
} else {
(top: 2em, bottom: 2em, x: mini-slides.x)
},
),
config-common(
slide-fn: slide,
new-section-slide-fn: new-section-slide,
),
config-methods(
init: (self: none, body) => {
show strong: self.methods.alert.with(self: self)
show heading: set text(self.colors.primary)
body
},
alert: utils.alert-with-primary-color,
),
config-colors(
neutral-darkest: rgb("#000000"),
neutral-dark: rgb("#202020"),
neutral-light: rgb("#f3f3f3"),
neutral-lightest: rgb("#ffffff"),
primary: primary,
),
// save the variables for later use
config-store(
navigation: navigation,
sidebar: sidebar,
mini-slides: mini-slides,
footer: footer,
footer-alt:footer-alt,
footer-right: footer-right,
alpha: alpha,
subslide-preamble: subslide-preamble,
),
..args,
)
body
} |
|
https://github.com/markcda/unitech-typst | https://raw.githubusercontent.com/markcda/unitech-typst/master/01-university-work-example.typ | typst | MIT License | #import "00-university-template.typ": *
#show: student_work.with(
title: "Пример",
header: "unitech-2023-header.png",
department_name: "Кафедра информационной безопасности",
institute_name: "Институт инфокоммуникационных систем и технологий",
work_type: "контрольная работа",
discipline_name: "Теория графов",
theme: "Вариант 1. Алгоритм обхода графов в глубину",
author: (name: "<NAME>", sex: "male", degree: "студент", group: "ИБО-ТС-22", nwa: "<NAME>."),
adviser: (name: "<NAME>", sex: "male", degree: "доцент кафедры информационной безопасности", nwa: "Сухотерин А.В."),
city: "Королёв",
year: "2023",
table_of_contents: true,
links: (
(type: "doc", title: "Доктрина информационной безопасности Российской Федерации (от 5 декабря 2016 г.)"),
(type: "book", author: "<NAME>", title: "Севейна", publisher: "Литрес.Самиздат", year: "2019"),
(type: "web", title: "Writing In Typst Tutorial", link: "https://typst.app/docs/tutorial/writing-in-typst", access_date: "22.09.2023"),
),
)
= Начнём!
В Typst есть поддержка крутых фишек. Например, в нём легко создавать списки:
+ The climate
- Temperature
- Precipitation
+ The topography
+ The geology
А также добавлять изображения... но, разумеется, комментарии не будут выполнены.
// и, соответственно, комментарии
// #image("filename.jpg", width: 70%)
Если начистоту, то #link("https://typst.app/docs/tutorial/writing-in-typst/")[здесь (тыкните мышкой!)] всё есть.
= Продолжаем?
Всегда может быть.
|
https://github.com/typst/packages | https://raw.githubusercontent.com/typst/packages/main/packages/preview/unichar/0.1.0/ucd/block-2B740.typ | typst | Apache License 2.0 | #let data = (
"0": ("<CJK Ideograph Extension D, First>", "Lo", 0),
"dd": ("<CJK Ideograph Extension D, Last>", "Lo", 0),
)
|
https://github.com/mangkoran/utm-thesis-typst | https://raw.githubusercontent.com/mangkoran/utm-thesis-typst/main/06_title.typ | typst | MIT License | #import "utils.typ": empty
#let content(
title: empty[title],
author: empty[author],
degree: empty[degree],
school: empty[school],
faculty: empty[faculty],
) = [
#set align(center)
#upper[#title]
#v(1fr)
#upper[#author]
#v(1fr)
A thesis submitted in fulfillment of the requirements
for the award of the degree of #degree
#v(1fr)
#school \
#faculty \
Universiti Teknologi Malaysia
#v(1fr)
#upper(datetime.today().display("[month repr:long] [year]"))
#pagebreak(weak: true)
]
#content()
|
https://github.com/pawarherschel/typst | https://raw.githubusercontent.com/pawarherschel/typst/main/modules/certificates.typ | typst | Apache License 2.0 | #import "../template/template.typ": *
#import "../helpers/helpers.typ": *
#let SOT = yaml("../SOT.yaml")
#let certificates = ()
#if SOT.keys().contains("certificates") {
certificates = SOT.certificates
}
#if certificates.len() != 0 {
cvSection("Certificates")
for certificate in certificates {
let date = certificate.date
let title = certificate.title
let issuer = certificate.issuer
let url = certificate.url
let location = certificate.location
cvHonor(
date: date,
title: title,
issuer: issuer,
url: url,
location: location,
)
}
}
|
https://github.com/jredondoyuste/TypstReport | https://raw.githubusercontent.com/jredondoyuste/TypstReport/main/README.md | markdown | The Unlicense | # TypstReport
Simple template for a report or official 1 page document in Typst.
Changing the fonts, colors, sizes and logos should be reasonably straightforward by playing with report.typ.
See main.typ and example.pdf for a simple usage.
|
https://github.com/VisualFP/docs | https://raw.githubusercontent.com/VisualFP/docs/main/SA/design_concept/content/poc/options_compiler_ghc.typ | typst | #import "../../../acronyms.typ": *
= GHC <ghc>
The most obvious choice for a Haskell compiler platform is #ac("GHC")
#footnote("https://www.haskell.org/ghc/"). In combination with build tooling,
such as Cabal #footnote("https://www.haskell.org/cabal/") and the language
server HLS #footnote("https://github.com/haskell/haskell-language-server"),
it provides a great development experience.
Unfortunately, the usage of #ac("GHC") as a library is not as
straightforward as using it as a compiler:
- Given the large amount of supported features, the #ac("API") is more
complex than necessary for the use-case of representing a visual editor
code snippet in an #ac("AST").
- The #ac("API") documentation is limited. Even though there is a great starting
point for the internals of #ac("GHC") available at #ac("GHC") commentary
@ghc-commentary, and some bloggers such as <NAME> took the time to write
about the #ac("GHC") #ac("API") @ghc-pipeline-blogpost, much of the available
documentation seems to be out-of-date, incomplete, or missing.
|
|
https://github.com/typst/packages | https://raw.githubusercontent.com/typst/packages/main/packages/preview/chronos/0.1.0/gallery/example3.typ | typst | Apache License 2.0 | #import "/src/lib.typ" as chronos
#set page(width: auto, height: auto)
#let TYPST = image("typst.png", width: 1.5cm, height: 1.5cm, fit: "contain")
#let FERRIS = image("ferris.png", width: 1.5cm, height: 1.5cm, fit: "contain")
#let ME = image("me.jpg", width: 1.5cm, height: 1.5cm, fit: "contain")
#chronos.diagram({
import chronos: *
_par("Foo", display-name: "Participant", shape: "participant")
_par("Foo1", display-name: "Actor", shape: "actor")
_par("Foo2", display-name: "Boundary", shape: "boundary")
_par("Foo3", display-name: "Control", shape: "control")
_par("Foo4", display-name: "Entity", shape: "entity")
_par("Foo5", display-name: "Database", shape: "database")
_par("Foo6", display-name: "Collections", shape: "collections")
_par("Foo7", display-name: "Queue", shape: "queue")
_par("Foo8", display-name: "Typst", shape: "custom", custom-image: TYPST)
_par("Foo9", display-name: "Ferris", shape: "custom", custom-image: FERRIS)
_par("Foo10", display-name: "Baryhobal", shape: "custom", custom-image: ME)
_seq("Foo", "Foo1", comment: "To actor")
_seq("Foo", "Foo2", comment: "To boundary")
_seq("Foo", "Foo3", comment: "To control")
_seq("Foo", "Foo4", comment: "To entity")
_seq("Foo", "Foo5", comment: "To database")
_seq("Foo", "Foo6", comment: "To collections")
_seq("Foo", "Foo7", comment: "To queue")
_seq("Foo", "Foo8", comment: "To Typst")
_seq("Foo", "Foo9", comment: "To ferris")
_seq("Foo", "Foo10", comment: "To Baryhobal")
})
#pagebreak()
#chronos.diagram({
import chronos: *
_par("me", display-name: "Me", shape: "custom", custom-image: ME)
_par("typst", display-name: "Typst", shape: "custom", custom-image: TYPST)
_par("rust", display-name: "Rust", shape: "custom", custom-image: FERRIS)
_seq("me", "typst", comment: "opens document", enable-dst: true)
_seq("me", "typst", comment: "types document")
_seq("typst", "rust", comment: "compiles content", enable-dst: true)
_seq("rust", "typst", comment: "renders document", disable-src: true)
_seq("typst", "me", comment: "displays document")
_evt("typst", "disable")
})
#pagebreak()
#stack(dir: ltr, spacing: 1em,
chronos.diagram({
import chronos: *
_par("a", display-name: "Alice")
_par("b", display-name: "Bob")
_seq("a", "b", end-tip: ">", comment: `->`)
_seq("a", "b", end-tip: ">>", comment: `->>`)
_seq("a", "b", end-tip: "\\", comment: `-\`)
_seq("a", "b", end-tip: "\\\\", comment: `-\\`)
_seq("a", "b", end-tip: "/", comment: `-/`)
_seq("a", "b", end-tip: "//", comment: `-//`)
_seq("a", "b", end-tip: "x", comment: `->x`)
_seq("a", "b", start-tip: "x", comment: `x->`)
_seq("a", "b", start-tip: "o", comment: `o->`)
_seq("a", "b", end-tip: ("o", ">"), comment: `->o`)
_seq("a", "b", start-tip: "o", end-tip: ("o", ">"), comment: `o->o`)
_seq("a", "b", start-tip: ">", end-tip: ">", comment: `<->`)
_seq("a", "b", start-tip: ("o", ">"), end-tip: ("o", ">"), comment: `o<->o`)
_seq("a", "b", start-tip: "x", end-tip: "x", comment: `x<->x`)
_seq("a", "b", end-tip: ("o", ">>"), comment: `->>o`)
_seq("a", "b", end-tip: ("o", "\\"), comment: `-\o`)
_seq("a", "b", end-tip: ("o", "\\\\"), comment: `-\\o`)
_seq("a", "b", end-tip: ("o", "/"), comment: `-/o`)
_seq("a", "b", end-tip: ("o", "//"), comment: `-//o`)
_seq("a", "b", start-tip: "x", end-tip: ("o", ">"), comment: `x->o`)
}),
chronos.diagram({
import chronos: *
_par("a", display-name: "Alice")
_par("b", display-name: "Bob")
_seq("b", "a", end-tip: ">", comment: `->`)
_seq("b", "a", end-tip: ">>", comment: `->>`)
_seq("b", "a", end-tip: "\\", comment: `-\`)
_seq("b", "a", end-tip: "\\\\", comment: `-\\`)
_seq("b", "a", end-tip: "/", comment: `-/`)
_seq("b", "a", end-tip: "//", comment: `-//`)
_seq("b", "a", end-tip: "x", comment: `->x`)
_seq("b", "a", start-tip: "x", comment: `x->`)
_seq("b", "a", start-tip: "o", comment: `o->`)
_seq("b", "a", end-tip: ("o", ">"), comment: `->o`)
_seq("b", "a", start-tip: "o", end-tip: ("o", ">"), comment: `o->o`)
_seq("b", "a", start-tip: ">", end-tip: ">", comment: `<->`)
_seq("b", "a", start-tip: ("o", ">"), end-tip: ("o", ">"), comment: `o<->o`)
_seq("b", "a", start-tip: "x", end-tip: "x", comment: `x<->x`)
_seq("b", "a", end-tip: ("o", ">>"), comment: `->>o`)
_seq("b", "a", end-tip: ("o", "\\"), comment: `-\o`)
_seq("b", "a", end-tip: ("o", "\\\\"), comment: `-\\o`)
_seq("b", "a", end-tip: ("o", "/"), comment: `-/o`)
_seq("b", "a", end-tip: ("o", "//"), comment: `-//o`)
_seq("b", "a", start-tip: "x", end-tip: ("o", ">"), comment: `x->o`)
}),
chronos.diagram({
import chronos: *
_par("a", display-name: "Alice")
_par("b", display-name: "Bob")
_seq("a", "a", end-tip: ">", comment: `->`)
_seq("a", "a", end-tip: ">>", comment: `->>`)
_seq("a", "a", end-tip: "\\", comment: `-\`)
_seq("a", "a", end-tip: "\\\\", comment: `-\\`)
_seq("a", "a", end-tip: "/", comment: `-/`)
_seq("a", "a", end-tip: "//", comment: `-//`)
_seq("a", "a", end-tip: "x", comment: `->x`)
_seq("a", "a", start-tip: "x", comment: `x->`)
_seq("a", "a", start-tip: "o", comment: `o->`)
_seq("a", "a", end-tip: ("o", ">"), comment: `->o`)
_seq("a", "a", start-tip: "o", end-tip: ("o", ">"), comment: `o->o`)
_seq("a", "a", start-tip: ">", end-tip: ">", comment: `<->`)
_seq("a", "a", start-tip: ("o", ">"), end-tip: ("o", ">"), comment: `o<->o`)
_seq("a", "a", start-tip: "x", end-tip: "x", comment: `x<->x`)
_seq("a", "a", end-tip: ("o", ">>"), comment: `->>o`)
_seq("a", "a", end-tip: ("o", "\\"), comment: `-\o`)
_seq("a", "a", end-tip: ("o", "\\\\"), comment: `-\\o`)
_seq("a", "a", end-tip: ("o", "/"), comment: `-/o`)
_seq("a", "a", end-tip: ("o", "//"), comment: `-//o`)
_seq("a", "a", start-tip: "x", end-tip: ("o", ">"), comment: `x->o`)
})
)
#chronos.diagram({
import chronos: *
_par("a", display-name: "Alice")
_par("b", display-name: "Bob", show-bottom: false)
_par("c", display-name: "Caleb", show-top: false)
_par("d", display-name: "Danny", show-bottom: false, show-top: false)
_gap()
}) |
https://github.com/VectorFrankenstein/Resume | https://raw.githubusercontent.com/VectorFrankenstein/Resume/main/resume.typ | typst | #let content = yaml("information.yaml") // Get the content file
// Set global params and values
#set page(
margin: 0.5cm,
numbering: "1",
)
#set text(
size: 10pt,
hyphenate: false,
)
#set list(
spacing: 6pt
)
#set par(
leading: 6pt,
justify: true,
)
// #show par: set block(spacing: 4pt)
#show heading.where(
level: 2,
): it => block(width: 100%)[
#set align(left)
#set text( size: 1em, weight: "bold")
#it.body
#line(length: 100%, stroke: 1pt + black)
#v(0em)// draw a line
]
// Name title/heading
#show heading.where(
level: 1,
): it => block(width: 100%)[
#set text( size: 1.5em, weight: "bold")
#it.body
#v(-1em)
#line(length: 100%)
]
#set heading(level: auto)
// Generic functions to keep the code readible
// My goal with these functions is to make them as reproducible as possible
#let contacts(entry) = {
if (entry.at("URL",default:none) != none and entry.at("Logo", default:none)!= none) {
box(image(entry.Logo),height:1em)
link(entry.URL)[#entry.Show]
h(1cm)
} else if entry.at("URL", default:none) != none {
link(entry.URL)[#entry.Show]
} else if entry.at("Logo",default:none) != none {
box(image(entry.Logo),height:1em)
[#entry.Show]
} else {
[#entry.show]
}
}
#let introduction(content) = {
set align(center)
[
#set text(size: 2.0em, weight: "bold")
#upper(content.Name)
#v(-0.75em)
]
[
#set text(size: 1.25em, weight: "bold")
#content.Profession
#v(-0.75em)
]
[
#set text(size: 1em)
#content.Location
#v(-0.75em)
]
[
#set text(size: 11pt)
#for entry in content.Contacts [
#contacts(entry)
]
]
}
#let experience_function(experience_entry) = {
[
*#experience_entry.Position* #h(1fr) *#experience_entry.Start* - *#experience_entry.End* \
#if (experience_entry.at("URL", default: none) != none) [
#underline[#link(experience_entry.URL)[#experience_entry.Company]] #h(1fr) #experience_entry.Location \
] else [
#underline[#experience_entry.Company] #h(1fr) #experience_entry.Location \
]
#for task in experience_entry.Tasks [
- #eval(task, mode: "markup")
]
#v(-0.25em)
]
}
#let education_entry(education_entry) = {
[
#if (education_entry.at("URL", default: none) != none) [
*#underline[#link(education_entry.URL)[#education_entry.Institute]]* #h(1fr) *#education_entry.Location* \
] else [
*#underline[#education_entry.Institute]* #h(1fr) *#education_entry.Location* \
]
#text(style: "italic")[#education_entry.Degree] #h(1fr) #education_entry.Start - #education_entry.End \
]
}
#let skills_entry(skills_entry) = {
[
*#underline[#skills_entry.Section]* \
#for (hit, details) in skills_entry.Details [
*#hit* : #details \
] #v(-0.25em) // Add some space for the next section
]
}
#let publication_entry(publication_entry) = {
[
#if (publication_entry.at("URL", default: none) != none) [
*#underline[#link(publication_entry.URL)[#publication_entry.Name]]* #h(1fr) *#publication_entry.Date*\
] else [
*#underline[#publication_entry.Name]* #h(1fr) *#publication_entry.Date*\
]
#publication_entry.DOI \
#v(-0.5em)
]
}
// Actual content
// For now there are these manually written #v() adjustments throughout the page because I do not know a better way.
#v(-1em)
#introduction(content.Introduction)
#v(-1em)
= Experience
#for entry in content.Experience {
experience_function(entry)
}
// #work_entry(content.Work)
#v(-0.75em) // to compensate for the previous sections's trailing white space
#pagebreak()
= Skills
// The grid makes it such that the items are distributed into two columns
// For more information
// visit https://stackoverflow.com/questions/78938372/how-to-send-content-into-specific-boxes-in-typst
#grid(
columns: (1fr, 1fr),
column-gutter: 1em,
row-gutter: 1em,
..content.Skills.map(entry => skills_entry(entry))
)
= Education
#for entry in content.Education {
education_entry(entry)
}
#v(-0.75em) // to compensate for the previous sections's trailing white space
= Research and Publications
#for entry in content.Publications {
publication_entry(entry)
}
#v(-0.75em)
|
|
https://github.com/Geson-anko/vconf24_template_typst | https://raw.githubusercontent.com/Geson-anko/vconf24_template_typst/main/vconf2024.typ | typst | // vconf2024.typ
#let to-string(content) = {
if content.has("text") {
content.text
} else if content.has("children") {
content.children.map(to-string).join("")
} else if content.has("body") {
to-string(content.body)
} else if content == [ ] {
" "
}
}
#let conf(
title: "",
authors: (),
affiliations: none,
abstract: [],
bibliography-file: none,
bibliography-margin: 40pt, // 本文と参考文献の行間調整
body
) = {
// Document setup
// set document(author: authors.map(a => to-string(a.name)), title: title) // 著者情報のメタデータを埋め込みたい場合はコメントアウト
set page(
paper: "a4",
margin: (top: 12.7mm, bottom: 12.7mm, left: 12.7mm, right: 12.7mm),
numbering: none,
)
// Font settings
set text(font: ("Yu Mincho", "YuMincho", "Century"), size: 10pt, lang: "ja")
set heading(numbering: "1.1.")
// Title block
align(center)[
#text(weight: 700, size: 18pt, title)
#v(12pt, weak: true)
#text(size: 10pt)[
#authors.map(author => [
#box(width: 30%, [
#author.name\
#text(size: 9pt, author.contact)
])
]).join([ ])
]
#v(10pt, weak: true)
#if affiliations != none {
text(size: 10pt)[
#affiliations.join([,#h(1em)])
]
}
#v(6pt, weak: true)
]
show par: set block(spacing: 0.65em) // 行間設定
set par(justify: true, first-line-indent: 1em) // 字下げ
// ヘッダー設定
show heading: it => {
set text(weight: "bold", size: 10pt) // 見出しサイズを変更
it
v(0em, weak: true) // 見出し下のスペース調整
par(text(size: 0pt, "")) // typstのバグで2段落目移行しか字下げされないので強制的に1段落目を追加
}
// 図表設定
show figure: it => {
set align(center)
set par(justify: true)
set text(size: 8pt)
it
}
show figure.caption: set align(left) // キャプションを左寄せ
show figure.where( // 表のキャプションは上に表示
kind: table
): set figure.caption(position: top)
// Abstract
block(width: 100%, inset: 10pt, breakable: false, [
*概要:* #abstract
])
v(12pt, weak: true)
// Main body
show: rest => columns(2, rest) // ダブルカラム
body
if bibliography-file != none {
set text(lang: "en")
v(bibliography-margin, weak: true) // 参考文献とメイン文書の間調整
bibliography(bibliography-file, title: "参考文献", style: "ieee")
}
}
|
|
https://github.com/kdog3682/2024-typst | https://raw.githubusercontent.com/kdog3682/2024-typst/main/src/base-utils.typ | typst | #import "very-base-utils.typ": *
#import "attrs.typ"
#let align-apart(col, row, length: none) = {
if col == 0 {
left + horizon
} else if col == length - 1 {
right + horizon
} else {
center + horizon
}
}
#let justify-space-between(arg, i, a) = {
if i == 0 {
return align(left, arg)
}
else if i == len(a) - 1 {
return align(right, arg)
}
else {
return align(center, arg)
}
}
#let justify-ref = (
space-between: (
justify: justify-space-between,
attrs: (
column-gutter: 1fr
),
container: grid,
),
centered-space-between: (
justify: justify-space-between,
attrs: (
column-gutter: 1fr,
stroke: none,
align: horizon,
),
container: table,
),
)
#let resolve-dict(ref, key) = {
if is-object(key) {
return key
}
return ref.at(key, default: none)
}
// #centered(block(width: 400pt, flex(lorem(100), lorem(15), justify-content: "start")))
#let bold-numbering-func(it) = [ *#it.* ]
#let bold-numbering-letter-func(it) = [ *#alphabet.at(it - 1).* ]
// dunno what this is ...
#let removeStartingDollars(s) = {
if s.starts-with("$") == true {
return s.slice(1, -1)
}
return s
}
#let is-exp(o) = {
return is-dict(o) and "base" in o and "t" in o
}
#let create-icon(name, fill: none, size: 20, key: none, ext: "svg", baseline: 0.85em) = {
assert(key != none, message: "a key is required to access the correct asset directory")
let root = "../"
let url = root + str(key) + "-assets/" + name + "." + ext
size = resolve-pt(size)
let attrs = (
width: size,
height: size,
)
let box-attrs = (
// stroke: black,
inset: 3pt,
radius: 0pt,
fill: none,
outset: 0pt,
// baseline: baseline,
baseline: 50%,
)
return box(..box-attrs, image(url, ..attrs))
// return box(..box-attrs, image(url, ..attrs))
// return image(url, ..attrs)
}
#let emoji-icon = create-icon.with(key: "emoji", ext: "svg", baseline: 2em)
#let assert-dict = assert-type.with(kind: "dict")
#let boo(..sink) = {
return type(sink)
}
#let foo(..sink) = {
return boo(..sink)
}
|
|
https://github.com/TideDra/seu-thesis-typst | https://raw.githubusercontent.com/TideDra/seu-thesis-typst/main/README.md | markdown | # SEU-Thesis-Typst
东南大学 Typst 论文模板库。
![SEU-Thesis-Typst](./figures/preview.png)
[点击查看完整 PDF 样本](./bachelor_thesis.pdf)
# 什么是 Typst?
[Typst](https://typst.app/)是一种全新的现代化排版语言,语法简洁堪比 Markdown,功能强大堪比 Latex,更有众多优秀的特性,例如毫秒级实时编译预览。下表是 Word、Markdown、Latex、Typst 一些方面的对比。
| | Word | Markdown | Latex | Typst |
| :--------- | :--: | :------: | :---: | :---: |
| 程序体量 | 大 | 小 | 极大 | 小 |
| 排版自由度 | 高 | 低 | 高 | 高 |
| 排版稳定性 | 中 | 高 | 高 | 高 |
| 使用难度 | 中 | 低 | 高 | 较低 |
| 可编程性 | 无 | 无 | 中 | 高 |
| 可拓展性 | 低 | 无 | 高 | 高 |
| 实时渲染 | √ | √ | × | √ |
| 多人协作 | - | × | √ | √ |
# 如何使用
## 网页编辑器
进入[Typst 官方网页编辑器](https://typst.app/),新建项目,导入本仓库所有文件,编辑模板。
## 本地编辑
克隆本仓库。按照 Typst[官方仓库](https://github.com/typst/typst)说明,安装 Typst,从 fonts 文件夹中安装缺失字体。编辑模板并编译生成。
推荐使用 VSCode 及 Typst LSP 插件,可以获得与网页编辑器类似的体验。
# 模板列表
- `bachelor_thesis.typ`: 本科毕设论文
- `translation_thesis.typ`: 本科毕设文献翻译
欢迎向本仓库贡献更多模板!
# 模板样例
```typst
#import "template.typ": translation_conf
#import "utils.typ": set_doc_footnote
#show :doc => set_doc_footnote(doc) //由于Typst目前的缺陷,footnote必须在开头设置。未来可能会改进。
#let info = (
raw_paper_name:"Name of Raw Paper",
translated_paper_name:"论文中文标题",
student_id:"123456",
name:"张三",
college:"霍格沃兹学院",
major:"母猪产后护理",
supervisor:"指导老师",
abstract:[此处编写中文摘要],
key_words:("关键词1","关键词2"),
)
#show :doc => translation_conf(
doc,
..info
) //对以下文本应用模板
= 绪论 //章标题
== 引言 //节标题
此处编写正文
```
# 注意事项
- 本仓库模板基于 Typst 0.11 版本编写,请确保所使用的 Typst 版本一致。后续会随 Typst 版本迭代更新模板。
- 本仓库模板已尽力复刻学校提供的 Word 模板,但是在一些细节上(页边距、行距、标题间距等)与 Word 模板仍有一些肉眼难以分辨的细微差距。**因使用本模板造成的各种后果请自行承担**。我们欢迎使用者向本仓库提出 PR,完善模板。
- 模板还在不断完善中,在使用过程中请及时拉取本仓库最新代码。
- Typst 目前暂不支持插入 PDF。矢量图请保存为 SVG 格式,或将 PDF 转为 SVG。
- 本科毕设模板目前采用[SEU-Typst-Template](https://github.com/csimide/SEU-Typst-Template)提供的`gb-t-7714-2015-numeric-seu-bachelor.csl`作为参考文献格式。该格式已尽量复刻官方Word模板中的格式,但仍有差异。详情请移步至原项目仓库查看。
# 参考项目
- [PKUTHSS-Typst](https://github.com/lucifer1004/pkuthss-typst)
# 相关项目
- [SEU-Typst-Template](https://github.com/csimide/SEU-Typst-Template) 提供了更多学位论文模板
|