repo
stringlengths 26
115
| file
stringlengths 54
212
| language
stringclasses 2
values | license
stringclasses 16
values | content
stringlengths 19
1.07M
|
---|---|---|---|---|
https://github.com/monaqa/typscrap.nvim | https://raw.githubusercontent.com/monaqa/typscrap.nvim/master/class/component/href.typ | typst | #let parse_url(url) = {
let body = url.trim(regex("http[s]?://"))
let (domain, ..path_ary) = body.split("/")
let paths = path_ary.join("/")
return (domain: domain, paths: paths, path_ary: path_ary)
}
#let is_raw_link(it) = {
return it.dest == it.body.at("text", default: none)
}
#let default_link_style(it) = {
if is_raw_link(it) {
return text(fill: blue, font: "CommitMono-height105", size: 0.85em, it)
} else {
return text(fill: blue, it)
}
}
#let github_link_converter(it) = {
let icon = text(font: "Hack Nerd Font", [])
let icon_color = rgb("#24292e")
if not is_raw_link(it) {
return [#text(fill: icon_color, icon)#h(0.5em)#default_link_style(it)]
}
let info = parse_url(it.dest)
let user_name = info.path_ary.at(0, default: none)
let repo_name = info.path_ary.at(1, default: none)
let kind = info.path_ary.at(2, default: none)
let _text
if user_name == none or repo_name == none {
_text = info.paths
} else {
_text = [#user_name/#strong(repo_name)]
if kind == "pull" {
let num = info.path_ary.at(3, default: none)
let prefix = if num != none {[PR\##num:]} else {[PRs:]}
_text = [#prefix #_text]
}
if kind == "issues" {
let num = info.path_ary.at(3, default: none)
let prefix = if num != none {[Issue\##num:]} else {[Issues:]}
_text = [#prefix #_text]
}
}
return text(font: "CommitMono-height105", box(
fill: icon_color,
inset: (x: 4pt, bottom: 1pt),
outset: (top: 4pt, bottom: 3pt),
radius: 4pt,
text(fill: white, size: 0.75em, weight: 400, [#icon #_text])
))
}
#let default_link_converters = ("github.com": github_link_converter)
#let pretty_link(link_converters: (:), link_style: default_link_style, it) = {
if type(it.dest) == location {
return it
}
// 再帰による無限ループを防ぐための措置。
let _link_processed_flag = metadata((_internal_link_processed: true))
let _metadata = it.body.at("children", default: ()).at(0, default: (:)).at("value", default: (:))
let processed = _metadata.at("_internal_link_processed", default: false)
if processed {
return it
}
// http:// ... と直書きしてる
let (domain: domain,) = parse_url(it.dest)
let converter = link_converters.at(domain, default: none)
if converter != none {
return link(it.dest, [#_link_processed_flag#converter(it)])
}
link_style(it)
}
#let emph_link(it) = locate(loc => {
let slug = lower(it.body.text)
let dest = query(heading, loc).find(x => lower(x.body.text) == slug)
if dest != none {
text(fill: blue, link(dest.location(), [[#it]]))
} else {
text(fill: red.darken(40%), [[#it]])
}
})
|
|
https://github.com/maxwell-thum/typst-pf3 | https://raw.githubusercontent.com/maxwell-thum/typst-pf3/main/README.md | markdown | MIT License | # typst-pf3
Unofficial Typst "port" of Leslie Lamport's `pf2.sty` LaTeX style ([link](https://lamport.azurewebsites.net/latex/pf2.sty)) for writing structured proofs (see Lamport's [_How to Write a 21st Century Proof_](https://lamport.azurewebsites.net/pubs/proof.pdf))
See also https://lamport.azurewebsites.net/latex/latex.html
|
https://github.com/Vikingu-del/Resume | https://raw.githubusercontent.com/Vikingu-del/Resume/main/EnglishResume/main.typ | typst | MIT License | #import "template.typ": *
#set page(
margin: (
left: 10mm,
right: 10mm,
top: 15mm,
bottom: 10mm
),
)
#set text(font: "Mulish")
#show: project.with(
theme: rgb("#0F83C0"),
name: "<NAME>",
title: "Software Engineer",
contact: (
contact(
text: "+49 176 361 713 25"
),
contact(
text: "<EMAIL>",
link: "mailto:<EMAIL>"
),
contact(
text: "GitHub.com/Vikingu-del",
link: "https://github.com/Vikingu-del"
),
contact(
text: "Portofolio",
link: "https://vikingu-del.github.io/MyPortofolio/"
),
),
main: (
section(
title: "Work Experience",
content: (
subSection(
title: "SHARP GROUP LTD",
titleEnd: "Time Period",
subTitle: "Web Development Intern",
subTitleEnd: "(November 2022 — December 2022)",
content:
[- Developed user interfaces with modern JavaScript frameworks, HTML5, and CSS3.
- Used content creation tools and digital media to design web sites
- Responded to customer inquiries and provided technical assistance over phone and in person.]
),
subSection(
title: "ISA NET",
titleEnd: "Time Period",
subTitle: "It Help Desk Support",
subTitleEnd: "(August 2021 — October 2021)",
content:
[- Diagnosed and troubleshot hardware, software and network issues.
- Maintained servers and systems to keep networks fully operational during peak periods.
- Created user accounts and assigned permissions.
- Responded to customer inquiries and provided technical assistance over phone and in person.]
),
),
),
section(
title: "Projects",
content: (
subSection(
title: "Webserv",
content: "Built a web server from scratch using C++ that complies with HTTP/1.1 standards, handling concurrent client connections and ensuring proper request parsing, response handling, and error management."
),
subSection(
title: "Inception",
content: "Deployed multiple Docker containers orchestrated with Docker Compose to simulate a multi-service system. This project showcases proficiency in containerization and service isolation for development and production environments."
),
subSection(
title: "Minishell",
content: "Implemented a functional shell in C, capable of parsing and executing simple commands, managing processes, handling environment variables, and offering basic error handling."
),
subSection(
title: "Cub3D",
content: "Developed a 3D game engine in C using the Raycasting technique, similar to the mechanics of early FPS games like Wolfenstein 3D. The project involved handling player movement, rendering textures, and implementing collision detection, providing an immersive 3D experience in a 2D world."
),
subSection(
title: "Push_swap",
content: "Created an algorithm to sort data on a stack using a limited set of operations. The project involved optimizing sorting algorithms for efficiency in terms of time and space complexity, and implementing various strategies to achieve the shortest possible sequence of operations."
),
),
),
),
sidebar: (
section(
title: "Skills",
content: (
subSection(
title: "Coding Languages",
content: (
"C",
"C++",
"CSS",
"HTML5",
"JavaScript",
"Python",
"BashScript",
"Typst(Cv is written in typst)"
).join(" • "),
),
subSection(
title: "Technologies",
content: (
"NodeJS",
"VueJS",
"Git",
"Sql",
"Linux",
"RHEL",
"Arduino",
"React",
"Microsoft Office",
).join(" • "),
),
subSection(
title: "Concepts",
content: (
"Object-oriented programming",
"Unix-based system programming",
"Memory management",
"Concurrency and multithreading",
"Network programming",
"Algorithm optimization",
"Data structures",
"Version control (Git)",
"Debugging and profiling",
"Shell scripting"
).join(" • ")
),
subSection(
title: "Languages",
content: (
"English - Fluent",
"Italian - Intermediate",
"Spanish - Beginner",
"German - Beginner",
).join(" • ")
),
),
),
section(
title: "Education",
content: (
subSection(
title: [
#set par(justify: false)
Polytechnic University of Tirana
],
subTitle: "BSc in Electronics Engineering",
content: [
Graduated: August 2022\
],
),
subSection(
title: [
#set par(justify: false)
42 Wolfsburg
],
subTitle: "Software Engineering",
content: [
"Project-based curriculum with peer-to-peer learning approach, focused on real-world problem solving and hands-on coding."
],
),
),
),
section(
title: "Hobbys",
content: (
subSection(
title: "Sports",
content: (
"MMA (Mixed Martial Arts), Previous Ballkan Champion",
"Table Tennis",
"Chess",
"Hiking",
).join(" • "),
),
),
),
),
)
|
https://github.com/brainworkup/neuropsych-report | https://raw.githubusercontent.com/brainworkup/neuropsych-report/main/_extensions/neuropsych-report/typst-template.typ | typst | #let script-size = 7.97224pt
#let footnote-size = 8.50012pt
#let small-size = 9.24994pt
#let normal-size = 10.00002pt
#let large-size = 11.74988pt
#let neuropsych-report(
title: "",
authors: (),
date: none,
// The path to a bibliography file if you want to cite some external
// works.
// The article's paper size. Also affects the margins.
paper-size: "a4",
bibliography-file: none,
body) = {
// Set the document's basic properties.
set document(author: authors.map(a => a.name), title: title)
set page(
margin: (left: 23mm, right: 25mm, top: 27mm, bottom: 27mm),
// margin: (top: 117pt, left: 118pt, right: 119pt, bottom: 96pt),
numbering: ("1/1"),
number-align: center,
header: locate(
loc => if [#loc.page()] == [1] {
[]
} else {
[
#set text(9pt)
#smallcaps[
*CONFIDENTIAL*\
Patient Name
]
]
}
)
)
// Save heading and body font families in variables.
let body-font = "Alegreya"
let sans-font = "Alegreya Sans"
// Set body font family.
set text(font: body-font, lang: "en", size: 12pt)
show math.equation: set text(weight: 400)
// Set paragraph spacing.
show par: set block(above: 1.2em, below: 1.2em)
show heading: set text(font: sans-font)
// set heading(numbering: "1.a")
// Set run-in subheadings, starting at level 4.
show heading: it => {
if it.level > 3 {
parbreak()
text(10pt, style: "italic", weight: "regular", it.body + ".")
} else {
it
}
}
// Configure lists and links.
set enum(indent: 10pt, body-indent: 5pt)
set list(indent: 10pt, body-indent: 5pt)
show link: set text(font: "New Computer Modern Mono")
// Configure citation and bibliography styles.
set cite(style: "numerical", brackets: true)
set bibliography(style: "apa", title: "References")
set par(leading: 0.75em)
// Logo
block(
figure(
image("logo.png"),
)
)
// Title row.
align(center)[
#block(text(font: sans-font, weight: 700, 1.75em, title))
#v(2.2em, weak: true)
// #date
]
// Main body.
set text(hyphenate: true)
body
}
|
|
https://github.com/GuTaoZi/SUSTech-thesis-typst | https://raw.githubusercontent.com/GuTaoZi/SUSTech-thesis-typst/main/utils/typst-boxes.typ | typst | MIT License | //import from https://github.com/lkoehl/typst-boxes
#let colorbox(title: "title", color: none, radius: 2pt, width: auto, body) = {
let strokeColor = luma(70)
let backgroundColor = white
if color == "red" {
strokeColor = rgb(237, 32, 84)
backgroundColor = rgb(253, 228, 224)
} else if color == "green" {
strokeColor = rgb(102, 174, 62)
backgroundColor = rgb(235, 244, 222)
} else if color == "blue" {
strokeColor = rgb(29, 144, 208)
backgroundColor = rgb(232, 246, 253)
}
return box(
fill: backgroundColor,
stroke: 2pt + strokeColor,
radius: radius,
width: width
)[
#block(
fill: strokeColor,
inset: 8pt,
radius: (top-left: radius, bottom-right: radius),
)[
#text(fill: white, weight: "bold")[#title]
]
#block(
width: 100%,
inset: (x: 8pt, bottom: 8pt)
)[
#body
]
]
}
#let slantedBackground(color: black, body) = {
set text(fill: white, weight: "bold")
style(styles => {
let size = measure(body, styles)
let inset = 8pt
[#block()[
#polygon(
fill: color,
(0pt, 0pt),
(0pt, size.height + (2*inset)),
(size.width + (2*inset), size.height + (2*inset)),
(size.width + (2*inset) + 6pt, 0cm)
)
#place(center + top, dy: size.height, dx: -3pt)[#body]
]]
})
}
#let slantedColorbox(title: "title", color: none, radius: 0pt, width: auto, body) = {
let strokeColor = luma(70)
let backgroundColor = white
if color == "red" {
strokeColor = rgb(237, 32, 84)
backgroundColor = rgb(253, 228, 224)
} else if color == "green" {
strokeColor = rgb(102, 174, 62)
backgroundColor = rgb(235, 244, 222)
} else if color == "blue" {
strokeColor = rgb(29, 144, 208)
backgroundColor = rgb(232, 246, 253)
}
return box(
fill: backgroundColor,
stroke: 2pt + strokeColor,
radius: radius,
width: width
)[
#slantedBackground(color: strokeColor)[#title]
#block(
width: 100%,
inset: (top: -2pt, x: 10pt, bottom: 10pt)
)[
#body
]
]
}
#let outlinebox(title: "title",color: none, width: 100%, radius: 2pt, centering: false, body) = {
let strokeColor = luma(70)
if color == "red" {
strokeColor = rgb(237, 32, 84)
} else if color == "green" {
strokeColor = rgb(102, 174, 62)
} else if color == "blue" {
strokeColor = rgb(29, 144, 208)
}
return block(
stroke: 2pt + strokeColor,
radius: radius,
width: width,
above: 26pt,
)[
#if centering [
#place(top + center, dy: -12pt)[
#block(
fill: strokeColor,
inset: 8pt,
radius: radius,
)[
#text(fill: white, weight: "bold")[#title]
]
]
] else [
#place(top + start, dy: -12pt, dx:20pt)[
#block(
fill: strokeColor,
inset: 8pt,
radius: radius,
)[
#text(fill: white, weight: "bold")[#title]
]
]
]
#block(
width: 100%,
inset: (top:20pt, x: 10pt, bottom: 10pt)
)[
#body
]
]
}
#let stickybox(rotation: 0deg, width: 100%, body) = {
let stickyYellow = rgb(255, 240, 172)
return rotate(rotation)[
#let shadow = 100%
#if width != 100% {
shadow = width
}
#place(bottom + center, dy: 0.04*shadow)[
#image("background.svg",
width: shadow - 3mm,
)
]
#block(
fill: stickyYellow,
width: width
)[
#place(top + center, dy: -2mm)[
#image("tape.svg",
width: calc.clamp(width * 0.35 / 1cm, 1, 4) * 1cm,
height: 4mm,
)
]
#block(
width: 100%,
inset: (top:12pt, x: 8pt, bottom: 8pt)
)[
#body
]
]
]
} |
https://github.com/ClazyChen/Table-Tennis-Rankings | https://raw.githubusercontent.com/ClazyChen/Table-Tennis-Rankings/main/README.md | markdown | <h1>Table Tennis Rankings</h1>
This repository demonstrates an excellent table tennis international ranking algorithm that better reflects the actual competitive level of table tennis players compared to the simple ELO algorithm and the new ranking method used by ITTF after January 1, 2018. The algorithm uses data provided on the ITTF official website and is modified based on the ELO algorithm to make the results more consistent with the situation of table tennis.
<b>The accuracy of the models in this repository for predicting women's singles matches is 76.53%, and for men's singles matches is 73.97%</b>, far higher than the international ranking of the ITTF.
This repository provides world rankings from January 2004 to December 2023 (the first day of each month is used as the ranking time node). Earlier rankings cannot be calculated because the ITTF does not provide relevant data.
All rankings use Typst, which you can easily convert to pdf files.
This repository includes men's singles ranking and women's singles ranking. You can see the changes of top players in the past twenty years: from <NAME>, <NAME>, <NAME>, <NAME>, <NAME>, <NAME> to <NAME>; from <NAME>, <NAME>, <NAME>, <NAME>, <NAME>, <NAME> to <NAME>.
For detailed description of the algorithm and latest rankings, please refer to introduction.pdf.
You are welcome to provide suggestions for improving the algorithm model or the display form of the ranking.
<h1>乒乓球排名</h1>
这个仓库展示了一种优秀的乒乓球国际排名算法,相比于简单的ELO算法和ITTF在2018年1月1日之后使用的新排名方法,该算法能够更好地反映乒乓球运动员的实际竞技水平。算法采用了ITTF官网上提供的数据,在ELO算法的算法的基础上进行了修正,使结果更符合乒乓球运动的情况。
<b>这个仓库中的模型预测女单比赛的正确率为 76.53%,男单比赛的正确率为 73.97%</b>,远高于ITTF的国际排名。
这个仓库提供从2004年1月至2023年12月的世界排名(每个月的第一天作为排名的时间节点)。更早的排名无法计算,因为ITTF没有提供相关数据。
所有的排名均使用Typst,您可以很方便地将其转换为pdf文件。
这个仓库包括男子单打排名和女子单打排名。您可以看到二十年的顶级运动员变化:从王励勤,马琳,王皓,张继科,马龙,樊振东到王楚钦;从张怡宁,郭跃,李晓霞,丁宁,刘诗雯,陈梦到孙颖莎。
算法的详细说明和最新排名参见 introduction_CN.pdf。
欢迎您对算法模型或者排名的展示形式提出改进意见。
<h1>Update Steps</h1>
+ Download new events and matches data from ITTF official website.
+ run `events_profile.py` to generate the profile of events.
+ run `matches_profile.py` to generate the profile of matches.
+ run `elo_preparation.py` for preprocessing.
+ run `elo.py` (WS / MS / WD / MD / XD) to generate all-time rankings.
+ run `translate.py` to translate the rankings to Chinese. |
|
https://github.com/Dherse/typst-brrr | https://raw.githubusercontent.com/Dherse/typst-brrr/master/samples/typst-ansi_render/README.md | markdown | # ANSI Escape Sequence Renderer
<a href="https://github.com/8LWXpg/typst-ansi_render/tags">
<img alt="GitHub manifest version (path)" src="https://img.shields.io/github/v/tag/8LWXpg/typst-ansi_render">
</a>
<a href="https://github.com/8LWXpg/typst-ansi_render">
<img src="https://img.shields.io/github/stars/8LWXpg/typst-ansi_render" alt="GitHub Repo stars">
</a>
<a href="https://github.com/8LWXpg/typst-ansi_render/blob/master/LICENSE">
<img alt="GitHub" src="https://img.shields.io/github/license/8LWXpg/typst-ansi_render">
</a>
This script provides a simple way to render text with ANSI escape sequences. It uses the `ansi_render` function from the `ansi_render.typ` module to render text with various formatting options, including font, font size and theme.
contribution is welcomed!
## Usage
```typst
#import "@preview/ansi-render:0.1.0": *
#ansi_render(string, font: string, size: length, theme: terminal_themes.theme)
```
## Demo
see [demo.typ](https://github.com/8LWXpg/typst-ansi_render/blob/master/demo.typ) [demo.pdf](https://github.com/8LWXpg/typst-ansi_render/blob/master/demo.pdf)
```typst
#ansi_render(
"\u{1b}[38;2;255;0;0mThis text is red.\u{1b}[0m
\u{1b}[48;2;0;255;0mThis background is green.\u{1b}[0m
\u{1b}[38;2;255;255;255m\u{1b}[48;2;0;0;255mThis text is white on a blue background.\u{1b}[0m
\u{1b}[1mThis text is bold.\u{1b}[0m
\u{1b}[4mThis text is underlined.\u{1b}[0m
\u{1b}[38;2;255;165;0m\u{1b}[48;2;255;255;0mThis text is orange on a yellow background.\u{1b}[0m
"
)
```

```typst
#ansi_render(
"\u{1b}[38;5;196mRed text\u{1b}[0m
\u{1b}[48;5;27mBlue background\u{1b}[0m
\u{1b}[38;5;226;48;5;18mYellow text on blue background\u{1b}[0m
\u{1b}[7mInverted text\u{1b}[0m
\u{1b}[38;5;208;48;5;237mOrange text on gray background\u{1b}[0m
\u{1b}[38;5;39;48;5;208mBlue text on orange background\u{1b}[0m
\u{1b}[38;5;255;48;5;0mWhite text on black background\u{1b}[0m"
)
```

```typst
#ansi_render(
"\u{1b}[31;1mHello \u{1b}[7mWorld\u{1b}[0m
\u{1b}[53;4;36mOver and \u{1b}[35m Under!
\u{1b}[7;90mreverse\u{1b}[101m and \u{1b}[94;27mreverse"
)
```

```typst
// uses the font supports ligatures
#ansi_render(read("test.txt"), font: "CaskaydiaCove Nerd Font Mono", theme: terminal_themes.putty)
```

|
|
https://github.com/ryuryu-ymj/mannot | https://raw.githubusercontent.com/ryuryu-ymj/mannot/main/examples/usage2.typ | typst | MIT License | #import "/src/lib.typ": *
#set page(width: auto, height: auto, margin: (x: 2cm, y: .5cm), fill: white)
#set text(24pt)
#show: mannot-init
$ // Need # before color names.
mark(3, color: #red) mark(x, color: #blue)
+ mark(integral x dif x, color: #green)
$
|
https://github.com/Mc-Zen/prism-typst | https://raw.githubusercontent.com/Mc-Zen/prism-typst/master/README.md | markdown | MIT License | # Prism-Typst
_Syntax-highlighting Typst code with [Prism](https://prismjs.com/)_
[](https://github.com/Mc-Zen/prism-typst/actions/workflows/node.js.yml)
A demo, which also explains some things, can be found [here](https://mc-zen.github.io/prism-typst/).
## Contents
The `src/` directory contains a Prism language definition for typst which you can import after importing Prism, e.g.,
```html
<script src="prism.js"></script>
<script src="prism-typst.js"></script>
```
as well as a CSS stylesheet that imitates the color scheme of the [Typst web app](https://typst.app).
For use with a program using [node.js](https://nodejs.org/en) (e.g., with [Docusaurus](https://docusaurus.io/)), a light theme as well as a dark theme are available with the file `src/typst-theme.js`.
## Contribution needed
In order to maintain and improve this language definition for Prism, I'm looking for help with
- writing tests (important since regex matching so many things is a little brittle) and
- treating/fixing more edge cases (and improvements in general). |
https://github.com/Myriad-Dreamin/typst.ts | https://raw.githubusercontent.com/Myriad-Dreamin/typst.ts/main/fuzzers/corpora/text/deco_06.typ | typst | Apache License 2.0 |
#import "/contrib/templates/std-tests/preset.typ": *
#show: test-page
// Test a bounds highlight.
#set highlight(top-edge: "bounds", bottom-edge: "bounds")
#highlight[abc]
#highlight[abc #sym.integral]
|
https://github.com/ryuryu-ymj/mannot | https://raw.githubusercontent.com/ryuryu-ymj/mannot/main/src/mark.typ | typst | MIT License | #let _mark-cnt = counter("_mannot-mark-cnt")
#let _sequence-func = (math.text("x") + math.text("y")).func()
#let _align-point-func = $&$.body.func()
#let _remove-leading-h(content) = {
if content.func() == _sequence-func {
let children = content.children
if children.len() == 0 {
return (none, none)
}
let rest
let remove
let leadingCount = 0
for c in children {
let (crest, cremove) = _remove-leading-h(c)
rest = crest
remove += cremove
if rest != none {
break
}
leadingCount += 1
}
children = children.slice(leadingCount)
children.first() = rest
let rest = _sequence-func(children)
return (rest, remove)
} else if content.func() == h {
return (none, content)
} else {
return (content, none)
}
}
#let _remove-trailing-h(content) = {
if content.func() == _sequence-func {
let children = content.children
if children.len() == 0 {
return (none, none)
}
let rest
let remove
let trailingCount = 0
for c in children.rev() {
let (crest, cremove) = _remove-leading-h(c)
rest = crest
remove += cremove
if rest != none {
break
}
trailingCount += 1
}
children = children.slice(0, children.len() - trailingCount)
children.last() = rest
let rest = _sequence-func(children)
return (rest, remove)
} else if content.func() == h {
return (none, content)
} else {
return (content, none)
}
}
#let _label-each-child(content, label) = {
if content.func() == math.equation {
let body = _label-each-child(content.body, label)
return body
} else if content.func() == _sequence-func {
// If `content` is the sequence of contents,
// then put `label` on each child.
let children = content.children.filter(c => c != [ ]).map(c => {
_label-each-child(c, label)
})
return content.func()(children)
} else if (content.func() == _align-point-func or content.func() == h or content.func() == v) {
// Do not put `label` on layout contents such as align-point(),
// h(), or v(), in order to avoid broken layout.
return content
} else {
// return [#content#label]
return math.attach(math.limits(content), t: [#none#label])
}
}
/// Marks a part of a math block with a custom overlay.
///
/// This function measures the position and size of the marked content,
/// places an overlay on it, and exposes metadata labeled with a tag.
/// This metadata includes the original content, its position (x, y), size (width, height),
/// and the color used for the overlay.
/// Its purpose is to create custom marking functions.
///
/// *Example*
/// #example(```
///let mymark(body, tag: none) = {
/// let overlay(width, height, color) = {
/// rect(width: width, height: height, stroke: color)
/// }
/// return core-mark(body, tag: tag, color: red, overlay: overlay, padding: (y: .1em))
///}
///
///$ mymark(x, tag: #<e>) $
///
///context {
/// let info = query(<e>).last()
/// repr(info.value)
///}
///```)
///
/// - body (content): The content to be marked within a math block.
/// - tag (none, label): An optional tag associated with the metadata.
/// - color (color): The color for the overlay and annotations put to this.
/// - overlay (none, function): An optional function to create a custom overlay.
/// The function takes `width`, `height`, and `color` as arguments,
/// where `width` and `height` represent the size of the marked content including padding,
/// and `color` is the same color passed to core-mark.
/// - padding (none, length, dictionary): The space between the marked content and the border of the overlay.
/// You can specify `left`, `right`, `top`, `bottom`, `x`, `y`, or a `rest` value.
/// - ctx (auto, string): The context of the marked content.
/// Possible values are `"inline"`, `"script"` or `"sscript"`.
/// If set to `auto`, it is automatically chosen.
/// -> content
#let core-mark(body, tag: none, color: black, overlay: none, padding: (:), ctx: auto) = {
// Extract leading/trailing horizontal spaces from body.
let (body, leading-h) = _remove-leading-h(body)
let (body, trailing-h) = _remove-trailing-h(body)
leading-h
_mark-cnt.step()
context {
set math.equation(numbering: none)
let cnt-get = _mark-cnt.get().first()
let loc-lab = label("_mannot-mark-loc-" + str(cnt-get))
let info-lab
if type(tag) == label {
info-lab = tag
} else {
info-lab = label("_mannot-mark-info-" + str(cnt-get))
}
let start = here().position()
let labeled-body = _label-each-child(body, loc-lab)
labeled-body
context {
let end = here().position()
let elems = query(loc-lab)
let min-y = start.y
for e in elems {
let pos = e.location().position()
let hpos = here().position()
let dx = pos.x - hpos.x
let dy = pos.y - hpos.y
if min-y > pos.y {
min-y = pos.y
}
}
let size
let attach-space = .2em
if ctx == auto {
size = measure($ body $)
let width = end.x - start.x
if calc.abs(width - size.width) > .01pt {
let size1 = measure($ inline(#labeled-body) $)
let size2 = measure($ script(#labeled-body) $)
let size3 = measure($ sscript(#labeled-body) $)
if calc.abs(width - size1.width) < .01pt {
size = measure($ inline(body) $)
} else if calc.abs(width - size2.width) < .01pt {
size = measure($ script(body) $)
attach-space = measure($ script(#rect(height: attach-space)) $).height
} else if calc.abs(width - size3.width) < .01pt {
size = measure($ sscript(body) $)
attach-space = measure($ sscript(#rect(height: attach-space)) $).height
}
}
} else if ctx == "inline" {
size = measure($ inline(body) $)
} else if ctx == "script" {
size = measure($ script(body) $)
attach-space = measure($ script(#rect(height: attach-space)) $).height
} else if ctx == "sscript" {
size = measure($ sscript(body) $)
attach-space = measure($ script(#rect(height: attach-space)) $).height
}
min-y += attach-space.to-absolute()
let padding = if type(padding) == none {
(left: 0pt, right: 0pt, top: 0pt, bottom: 0pt)
} else if type(padding) == length {
(left: padding, right: padding, top: padding, bottom: padding)
} else if type(padding) == dictionary {
let rest = padding.at("rest", default: 0pt).to-absolute()
let x = padding.at("x", default: rest).to-absolute()
let left = padding.at("left", default: x).to-absolute()
let right = padding.at("right", default: x).to-absolute()
let y = padding.at("y", default: rest).to-absolute()
let top = padding.at("top", default: y).to-absolute()
let bottom = padding.at("bottom", default: y).to-absolute()
(left: left, right: right, top: top, bottom: bottom)
}
let x = start.x - padding.left
let y = min-y - padding.top
let width = end.x + padding.right - x
let height = size.height + padding.top + padding.bottom
let info = (body: body, x: x, y: y, width: width, height: height, color: color)
[#metadata(info)#info-lab]
// Place `overlay(width, height, color)` in front of the `body`.
if overlay != none {
let hpos = here().position()
let dx = x - hpos.x
let dy = y - hpos.y
sym.wj
box(place(dx: dx, dy: dy, overlay(width, height, color)))
sym.wj
}
}
}
trailing-h
}
/// Marks a part of a math block with highlighting.
///
/// Marked content can be annotated with `annot` function.
///
/// *Example*
/// #example(```
///$ mark(x) $
/// ```)
///
/// - body (content): The content to be highlighted within a math block.
/// - tag (none, label): An optional tag used to identify the highlighted content for later annotation.
/// - color (auto, color): The color used for the highlight.
/// If set to `auto` and `fill` is `auto`, `color` will set be set to `orange`.
/// Otherwise, it defaults to `black`.
/// - fill (auto, none, color, gradient, pattern): The fill style for the highlight rectangle.
/// If set to `auto`, `fill` will be set to `color.transparentize(70%)`.
/// - stroke (none, auto, length, color, gradient, stroke, pattern, dictionary):
/// The stroke style for the highlight rectangle.
/// - radius (relative, dictionary): The corner radius of the highlight rectangle.
/// - padding (none, length, dictionary): he space between the highlighted content and the border of the highlight.
/// You can specify `left`, `right`, `top`, `bottom`, `x`, `y`, or a `rest` value.
/// - ctx (auto, string): The context of the marked content.
/// Possible values are `"inline"`, `"script"` or `"sscript"`.
/// If set to `auto`, it is automatically chosen.
/// -> content
#let mark(
body,
tag: none,
color: auto,
fill: auto,
stroke: none,
radius: (:),
padding: (y: .1em),
ctx: auto,
) = {
if fill == auto {
if color == auto {
color = orange
}
fill = color.transparentize(70%)
} else if color == auto {
color = black
}
let overlay(width, height, _) = {
if fill == none and stroke == none {
none
} else {
rect(
width: width,
height: height,
fill: fill,
stroke: stroke,
radius: radius,
)
}
}
return core-mark(body, tag: tag, color: color, overlay: overlay, padding: padding, ctx: ctx)
}
|
https://github.com/Tran-Thu-Le/typst-collection | https://raw.githubusercontent.com/Tran-Thu-Le/typst-collection/main/book-cover/book-cover-version2.typ | typst | #let title = align(center)[#text(fill: red, size: 5em, stroke: 1pt+white)[*A book's cover*]]
#let subtitle = align(center)[#text(fill: white, size: 3em, stroke: none)[_For creating Typst books_]]
#let author = align(right)[#text(fill: white, size: 2.5em, stroke: none)[By *<NAME>*] #h(4em)]
#let year = align(center)[#text(fill: black, size: 1.5em, stroke: none)[_Vietnam 2023-2024_] #h(4em)]
// #let background-color = gradient.linear(..color.map.viridis, angle: 60deg).sharp(9)
// #let background-color = gradient.linear(green, white, angle: 60deg).sharp(9)
// #let background-color = gradient.radial(aqua, white).repeat(10)
#let a-cover(
title: [*Simple Book's Cover*],
subtitle: [A Subtitle],
author: [<NAME>],
year: [Vietnam 2024],
image-link: "../book-cover/imgs/euclide.png",
color-background: gradient.linear(..color.map.viridis, angle: 60deg).sharp(9),
)= {
box(
width: 100%,
height: 100%,
// fill: gradient.linear(white, blue.lighten(20%), angle: 130deg),
fill: color-background,
outset: 1em,
radius: 1em,
stroke: 2pt + blue
)[
#v(20%)
#align(center)[#title]
// #v(-3em)
#align(center)[#subtitle]
#v(3em)
#align(right)[#author #h(5em)]
#align(center)[#image(image-link, width: 70%)]
#v(1fr)
#align(center)[#year]
]
}
#a-cover(
title: text(fill: red, size: 5em, stroke: 1pt+white)[*A book's cover*],
subtitle: text(fill: white, size: 3em, stroke: none)[_For creating Typst books_],
author: align(right)[#text(fill: white, size: 2.5em, stroke: none)[By *<NAME> Le*] #h(4em)],
year: text(fill: black, size: 1.5em, stroke: none)[_Vietnam 2024_],
color-background: gradient.linear(..color.map.viridis, angle: 60deg).sharp(9),
)
#a-cover(
title: text(fill: red, size: 5em, stroke: 1pt+white)[*A book's cover*],
subtitle: text(fill: black, size: 3em, stroke: none)[_For creating Typst books_],
author: align(right)[#text(fill: blue, size: 2.5em, stroke: none)[By *<NAME>*] #h(4em)],
year: text(fill: black, size: 1.5em, stroke: none)[_Vietnam 2024_],
image-link: "../book-cover/imgs/newton.png",
color-background: gradient.linear(green.lighten(30%), white, angle: 60deg).sharp(7),
)
#a-cover(
title: text(fill: red, size: 5em, stroke: 1pt+white)[*A book's cover*],
subtitle: text(fill: black, size: 3em, stroke: none)[_For creating Typst books_],
author: align(right)[#text(fill: blue, size: 2.5em, stroke: none)[By *<NAME> Le*] #h(4em)],
year: text(fill: black, size: 1.5em, stroke: none)[_Vietnam 2024_],
image-link: "../book-cover/imgs/archimedes.png",
color-background: gradient.conic(..color.map.rainbow, center: (-10%, 30%),).sharp(13, smoothness: 30%)
)
|
|
https://github.com/Blezz-tech/math-typst | https://raw.githubusercontent.com/Blezz-tech/math-typst/main/Картинки/Демо вариант 2024/Задание 03.1.typ | typst | #import "@preview/cetz:0.1.2"
#import "/lib/my_cetz.typ": cilynder
#set align(center)
#cetz.canvas(length: 0.5cm, {
import cetz.draw: *
let cilynder-color = blue.lighten(80%)
cilynder( width: 4
, height: 5
, water: 70
, colors: ( top: cilynder-color
, bottom: cilynder-color
, lateral: cilynder-color
)
)
cilynder( point: (6, 0)
, width: 6
, height: 5
, water: 35
, colors: ( top: cilynder-color
, bottom: cilynder-color
, lateral: cilynder-color
)
)
})
|
|
https://github.com/jgm/typst-hs | https://raw.githubusercontent.com/jgm/typst-hs/main/test/typ/math/multiline-06.typ | typst | Other | // Test no trailing line break.
$
"abc" &= c
$
No trailing line break.
|
https://github.com/benedictweis/typst-actions-demo | https://raw.githubusercontent.com/benedictweis/typst-actions-demo/main/README.md | markdown | MIT License | # typst-actions-demo
A Demo for using Github Actions and Releases to add CI/CD to your Typst projects
|
https://github.com/Languisher/touying-sjtu | https://raw.githubusercontent.com/Languisher/touying-sjtu/main/template/test.typ | typst | MIT License | #import "@preview/cetz:0.2.2"
#import "@preview/fletcher:0.4.5" as fletcher: node, edge
#import "@preview/touying:0.4.2": *
#import "../lib.typ" as buaa-theme
// cetz and fletcher bindings for touying
#let cetz-canvas = touying-reducer.with(reduce: cetz.canvas, cover: cetz.draw.hide.with(bounds: true))
#let fletcher-diagram = touying-reducer.with(reduce: fletcher.diagram, cover: fletcher.hide)
// Register university theme
// You can replace it with other themes and it can still work normally
#let s = buaa-theme.register()
// Set the numbering of section and subsection
#let s = (s.methods.numbering)(self: s, section: "1.", "1.1")
// Set the speaker notes configuration, you can show it by pympress
// #let s = (s.methods.show-notes-on-second-screen)(self: s, right)
// Global information configuration
#let s = (s.methods.info)(
self: s,
title: [TITLE],
subtitle: [SUBTITLE],
author: [AUTHOR],
date: datetime.today(),
institution: [INSTITUION],
)
// Pdfpc configuration
#let s = (s.methods.append-preamble)(self: s, pdfpc.config(
duration-minutes: 30,
start-time: datetime(hour: 14, minute: 00, second: 0),
end-time: datetime(hour: 14, minute: 30, second: 0),
last-minutes: 5,
note-font-size: 12,
disable-markdown: false,
default-transition: (
type: "push",
duration-seconds: 2,
angle: ltr,
alignment: "vertical",
direction: "inward",
),
))
// Extract methods
#let (init, slides, touying-outline, alert, speaker-note, tblock) = utils.methods(s)
#show: init.with(
lang: "en",
font: ("Linux Libertine", "Source Han Sans SC", "Source Han Sans"),
)
#show strong: alert
// Extract slide functions
#let (slide, empty-slide, title-slide, outline-slide, new-section-slide, ending-slide) = utils.slides(s)
#show: slides.with()
== TITLE
#slide[
CONTENTS
] |
https://github.com/Chwiggy/thesis_bachelor | https://raw.githubusercontent.com/Chwiggy/thesis_bachelor/main/src/chapters/07_discussion.typ | typst | #import "../preamble.typ": *
= Discussion
Well, what does that mean for these two potential indicators of travel time? In the following sections I discuss these indicators and see how they fit in with results from other studies. First again, this will concern the mean travel time indicator, and second the travel time difference indicator. Beyond that I talk about general limitations and provide an outlook of things that could still be done.
== Mean Travel Times
As expected, this indicator seems a useful proxy for the connectivity of specific locations.
As an indicator of general connectivity however it lacks the specificity of an measure of transit access with a strong model of itineraries that correspond to lived realities @levinson_towards_2020.
It can, however, serve as a general indicator for locations like boroughs.
As such, the results fit in with other more generalised travel time datasets @tenkanen_longitudinal_2020 @verduzco_torres_public_2024.
Usually these datasets focus on specific times of peak demand @verduzco_torres_public_2024. And focus specifically on travel time as an impedance factor.
The temporal variablity is interesting in so far as it sheds light on some often missed effects of travel at uncommon times. Research often focuses on peak hour travel, that is either the morning rush hour or the evening rush hour. And while an overproportional amount of travel happens within the morning rush hour @verduzco_torres_public_2024, there are always populations and scenarios that require travel add more odd hours. This can include work at hours that aren't the common nine to five office job, like shift work in manufacturing, health care, emergency services, or public transit jobs themselves, but this can also inclued free time activities, like evening events, visiting friends, parties etc.
In a mid size city like Heidelberg then, it seems specifically activities past midnight, that make it hard to travel back with public transit. Average travel times for these kind of journeys lie on average around 77 minutes. At these times public transport seems to be largely absent, with the exclusion of some limited local train services in irregular patterns from different stations. But between 03:00 and 05:00 even these services largely seem to stop existing, and only after 04:00 the first morning services start up again. While rnv offers reduced nighttime services, on normal weekdays these already cease at 01:00. Only on weekend days or on public holidays these services run untli the early morning @rnv_gmbh_nachtnetz_2024.
To gain more insight into these lived realities, it could have been useful to exclude cells without population or to find a better model for different kinds of destinations. Due to added complexity, this step was only taken after the routing and cell averages had already been computed. Thus unpopulated cells still counted as destinations even when this study only looked at populated cells for statistical analysis. Here again a more specific set of model itineraries could have been helpful. Such an accessibility measure could, for example, only consider other populated cells, and assume a scenario in which destinations such as friends and other people, that lie generally within populated areas but don't have a specific location in general, are of interest.
The current measure as is, however, does not distinguish between the impact of the spatial population distribution and the impact of the specific public transit network however (compare @levinson_towards_2020).
For this indicator I assumed travel time to be an objective cost measure, as suggested in some studies @levinson_towards_2020 however, percieved travel time might substantially vary from the objectively measured travel time. As human time perception varies considerably with the percieved pleasantness of the time spent.
And even hypothetical travelers with objective time perception might have different ideas about the cost a certain travel time entails based on the mode of transit.
That is they may have preferences on where and how they like to spend their travel time.
This may go so far as taking objectively worse routes to reach their destinations to avoid wait times at interchanges.
Beyond the difficulty of measuring percieved time, it also stands to reason, that travel time is not the only cost factor that public transit users and non-users take into account. Fare costs come up as an obvious cost factor quite often @conway_off_the_mta. To commuters with transit subscriptions in place like Heidelberg with integrated ticketing these differences might not play a huge role, but for an occasional or only potential user deciding between using a private car and public transit fare rules can make a considerable differennce. And as such, the effort of figuring out a fare system can become a cost factor in its own right. These can all be considered impedance factors that are considered in other transit analyses @levinson_towards_2020.
<end_of_chapter>
== Planning Indicator
Similar limitations apply to the planning indicator. Unfortunately here the usefulness of the indicator remains in question. Initially, the low travel time difference values for Handschuhsheim intrigued me, and explanations like the three tram lines converging at Hans-Thoma-Platz came to mind. Unfortunately the specifically low travel time difference cells don't actually lie within the populated area of Handschuhsheim, but in the hills to the east of Handschuhsheim. And while these cells aren't central to the transit network, they lie basically exactly at the line of equidistance between two stops at other ends of the city. Thus, starting from such a point there are two or more options for stops to walk to to catch a transit vehicle. Unfortunately for the idea of using this value as a transit indicator this however means, that in such a place one needs to make a fairly informed decision about which direction to walk in to actually benefit from lower transit times. This then is not really an indicator of how easy it is to randomly start a journey from this cell, but rather just also a case which relies on planning, despite the low travel time difference.
For a lot of unpopulated cells then low travel time differences can either mean that there is multiple possible entry points into the public transit system in roughly equal walking distance, or that a lot of walking is involved in any itinerary, as for example at night. This again means that the travel time difference indicator, unfortunately does not capture an ability to just show up at a transit stop and take whatever transit comes next, but rather captures the minimal difference between different starting times for a very well planned walking leg to a specific transit stop.
In populated areas the planning indicator then largely aligns with common tram and bus schedule headways. At least, as long as there still is transit service within the vicinity. This then becomes a measure that might be much easier to extract from GTFS schedule data without the indirection of computationally intensive routing for a large number of departure and destination locations, especially, as this scales horribly for larger study areas. Applying the average headway for services in a direction to the stops catchment area, would be a much easier problem to solve computationally. As such this measure, as presented in this thesis, only makes sense as a biproduct of a general travel time dataset, like the mean travel time indicator.
Furthermore, this tool cannot capture some more obscure ideosyncracies of the german local transit system. Especially for outlying individual settlements, like Grenzhof, scheduled transit service might often be rendered in the form of scheduled on demand services called Ruftaxi @vrn_vrn_2017. These taxi service require a call beyond 60 minutes ahead of the intended departure, and as such completely break the idea of just showing up to a transit stop on a whim.
As a remaining silver lining, the indicator offers some insights into how, especially at times outside regular commute times, some more suburban areas of Heidelberg experience less favourable headways. Travelling from Ziegelhausen in the evening or very early morning for example, public transit users seem to face less favourable headways than travellers in the city centre. To make the travel time difference measure more viable, it might again be useful to underpin it with a more selective idea of destinations based on model itineraries.
== General Limitations
Multi-modal routing as done with `r5py` and the underlying `r5`-engine makes a few idealistic assumptions about the behaviour of transit users @tenkanen_longitudinal_2020. As described above, transit users don't necessarily value only objective travel time. But routing with r5 also makes other assumptions about the feasibility or desirabilty of certain routes. Routing this way assumes a rational traveller, that knows exactly where to go, always takes the routing option with the shortest travel time, and is perfectly informed about the route to take. This leaves little option for taking the more scenic route, avoiding specific areas due to safety concerns or their general unpleasantness, taking transit based on familiar routes or avoiding tight interchanges, or dealing with delays in public transit. While a tight interchange might make for a fast route, it might make for a particularly slow route if delays make the connection unreliable.
To gauge these differences between ideal routing and actual public transit behaviour it would have been useful to include real world transit usage data as a comparison to the routing results attained from `r5`. This is a general limitation of this kind of theoretical approach. Empirical tests of the results attained are needed to really make these results more robust or test their veracity. To illucidate some of the results of the routing, it might also be useful to explore optimal example routes in detalil and compare them to routes actually taken, or suggested by publically accessible transit routing apps.
Beyond that, there is some real life data that would make these results much more useful, but is sometimes hard to include.
For example, there is no reliability and delay data included in this analysis. Such data in a disaggregated form is, unfortunately, rarely openly available and might require setting up data scraping @kriesel_bahnmining_2019.
I also excluded public transit fare structures as implemented in @conway_off_the_mta. While these are a common cost factor used next to travel time @levinson_towards_2020, they are complicated to implement for a simple analysis like this, especially when GTFS schedule data doesn't include the optional fare rules, dataset. And a focus on more detailed model itineraries could help make this a much more robust look into less stereotypical nine to five commute scenarios. Unfortunately point of interest data comes with its own challenges.
== Outlook
The analysis provide here, is of course a snapshot in time. Transit schedules change, permanently or due to constructions. These changes make it useful to reasses particular transit systems regularly and might make it interesting to check how transit system changes affect indicators like these. There is already valuable modelling of transit service quality improvements and their effects on percieved transit costs @litman_valuing_2008.
So what can be done to improve the robustness and veracity of these results. First the analysis could be expanded by differenc model scenarios. This could include school locations, which didn't make the cut because good school data with a distinction of school types was not available for Heidelberg, but for Bonn @ministerium_fur_schule_und_bildung_nrw_grunddaten_2016. However, this could also include a myriad of other point of interests for interesting travel scenarios.
Beyond that it seems useful to test these results against real world data. This could involve a more heavy usage of spatial statistics to correlate results with other measures like socio-economic data for example @pereira_is_2023. Just to test the assumption of the routing approach however, actual public transit usage data would be fairly useful. Unfortunately, this data rarely exists in a openly accessible way -- especially not in transit fare systems, like Germany, where there is no rigorous system of ticket checks or counting passengers.
Interesting could also be a comparison to dominant modes of transit like car traffic. This comparison of course carries the danger of reproducing the idea of car traffic as the standard mode of transportation, but it is also a useful comparison to understand why people might favour the usage of a car, beyond general societal assumptions about the 'freedom' that cars offer, or pricing.
In a similar vein, this analysis, at least in specific geographical contexts could include a comparison to ride hailing services @barajas_not_2021. For Heidelberg these play a subordinate role in transportation, but in a global context there are cities for which these are a common and feasible option of transportation.
Beyond that in 2024, rnv introduced trial schemes for related on demand services in Rohrbach and Schlierbach @nahverkehrsgesellschaft_baden-wurttemberg_mbh_-demand-verkehr_2024 @rhein-neckar-verkehr_gmbh_fips_2024. These schemes are hard to capture within an analysis of scheduled transit based on GTFS datasets, but of course they extend mobility options for transit users, specifically in terms of the so called last mile problem. These schemes however add a lot of complexity with their extra fare rules, and requirements for making your demand known.
With these kinds of improvements, at least the general connectivity measure of the mean travel time indicator has the potential to be a useful and easy to understand measure to include in more complex transit accesibility studies.
Another pattern to explore, might be social inequalities in transit access. A common approach to this question is the use of Lorentz-curves and GINI coefficients @kaplan_using_2014 @pereira_is_2023. Measuring _inequality_ like this can be rather silly at times, and reinforce ideas of social inequality that might not always be useful to reinforce @graeber_dawn_2022. I calculated Lorentz curves for an earlier iteration of this project, but this fell off the scope of this thesis in the end.
Another approach to finding patterns in this data might be automatic clustering, and trying to find correlations with other patterns. For this dimensionality reduction with PCA or UMAP might be a usable approach @mcinnes_umap_2018 for clustering the cells with K-means or HDBSCAN @mcinnes_hdbscan_2016
<end_of_chapter>
#locate(loc => bib_state.at(query(<end_of_chapter>, loc).first().location())) |
|
https://github.com/kpbaks/typst.fish | https://raw.githubusercontent.com/kpbaks/typst.fish/main/README.md | markdown | MIT License | # typst.fish
Some functions to make it easier to work with typst
|
https://github.com/7sDream/fonts-and-layout-zhCN | https://raw.githubusercontent.com/7sDream/fonts-and-layout-zhCN/master/chapters/02-concepts/dimension/vertical-2.typ | typst | Other | #import "/lib/draw.typ": *
#import "/lib/glossary.typ": tr
#let start = (0, 0)
#let end = (800, 500)
#let base = (40, 100)
#let widths = (0, 270, 728)
#let ys = (365, 300, 210, 0, -80)
#let graph = with-unit((ux, uy) => {
// mesh(start, end, (100, 100), stroke: 1 * ux + gray)
let (bx, by) = base
let line-stroke = (
paint: gray.darken(30%),
thickness: 3 * ux,
)
for y in ys {
segment(
(bx, by + y),
(bx + widths.last(), by + y),
stroke: line-stroke,
)
}
for x in widths {
segment(
(bx + x, by + ys.first()),
(bx + x, by + ys.last()),
stroke: line-stroke,
)
}
let half = (widths.at(1) + widths.at(2)) / 2
segment(
(bx + half, end.at(1)),
(bx + half, start.at(1)),
stroke: (..line-stroke, dash: "dashed"),
)
txt(text(cjk-latin-spacing: none)[H東], base, anchor: "lb", size: 420 * ux, dx: -20)
})
#canvas(end, start: start, width: 65%, graph)
|
https://github.com/TypstApp-team/typst | https://raw.githubusercontent.com/TypstApp-team/typst/master/tests/typ/bugs/parameter-pattern.typ | typst | Apache License 2.0 | // Test that underscore works in parameter patterns.
// Ref: false
---
#test((1, 2, 3).zip((1, 2, 3)).map(((_, x)) => x), (1, 2, 3))
|
https://github.com/1sSay/USPTU_conspects | https://raw.githubusercontent.com/1sSay/USPTU_conspects/main/src/philosophy/Renaissance.typ | typst | // Global settings and templates
#set text(14pt)
#let def(term, color: black) = {
box(stroke: color, inset: 7pt, text()[ #term ])
}
// Lecture header and date
#let lecture_header = text()[Эпоха Возрождения]
#let date = text()[7.09.2024]
// Header
#align(center, heading(level: 1)[Философия. \ #lecture_header ])
#align(center, text(weight: "thin")[#date])
#align(center, text(weight: "thin")[Конспект Сайфуллина Искандара БПО09-01-24])
// Content
#def[*Ренессанс* (фр. Возрождение)]
#def[*Секуляризация* -- снижение роли религии в сознании людей и жизни общества]
#def[*Пантеизм* -- философское учение, объединяющее и иногда отожествляющее Бога и мир]
#def[*Гуманизм* -- система построения человеческого общества, где высшей ценностью явялется жизнь человека]
#table(
columns: (auto, auto),
inset: 14pt,
align: horizon,
table.header([*Периоды*], [*Основные персоны*]),
[Гуманистический], [<NAME>, <NAME>, Лоренцо Валла],
[Неоплатонический], [<NAME>, Парацельс],
[Натурфилософский], [Леонардо да Винчи, <NAME>, Джордано Бруно, Галилео Галилей]
)
#heading(level: 1)[#text(red)[Гуманистический период]]
== <NAME> (1304 - 1374)
+ Человеческая жизнь дается один раз и она уникальна
+ Человек должен жить не для Бога, а для самого себя
+ Человекчакая личность должна быть свободной как физически, так и духовно
+ Человеку принадлежит свобода выбора и право выражать себя в соответсвии с этим
+ Человек может добиться счастья, опираясь только на себя и свои силы
+ Человек не должен приносить себя в журтву Богу, а должен наслаждаться жизнью и любить
+ Внешний облик и внутренний мир человека прекрасны
== <NAME> (1265 - 1321)
#def[Божественная комедия]
#heading(level: 1)[#text(red)[Неоплатонический период]]
== <NAME> (1401 - 1464)
*Структура мировоззрения*:
- *Бог* -- "абсолютный максимум", "актуальная бесконечность"
- *Мир* -- "ограниченный максимум", "потенциальная бесконечность"
- *Человек* -- эманация абсолютного максимума
#def[*Макрокосмос = микрокосмос*]
*Основные идеи*:
- Вселенная бесконечна в пространстве
- Земля не является центром Вселенной и находится в постоянном вращении
- Пантеистические взгляды
#def["Человек способен познавать мир посредством ощущений, рассудка и разума. Разум -- чисто духовная сущность, порождение самого Бога, который непозноваем" (схоже с мировоззрением *Канта*)]
#heading(level: 1)[#text(red)[Натурфилософский период]]
== <NAME>
#def[Коперник совершает *Коперниканский переворот* (переход от *геоцентризма* к *гелиоцентризму*)]
== <NAME> (1548 - 1600)
- Философскими источниками учения Джордано Бруно были взляды *Демокрита*, *Эпикура* и работы *Н. Кузанского*, *Н. Коперника*
- Джордано Бруно несправедливо отмечается учёными как продолжатель и последователь идей Кузанского и Коперника, однако идеи Джордано Бруно отличаются от идей Коперника (его звёзды движутся)
*Основные идеи*:
- Диалектическое единство божественного и природного\
#def["Природа есть либо сам Бог, либо божественная сила. скрытая в самих вещах"]
- Производящее начало бытия - материя (живая, непрерывно изменяющаяся)
- Мировая душа формирует материю изнутри
- Пиррода и вселенная бесконечны (бесконечный Бог не может ограничитсься созданием конечных вещей)
#def[*Джордано Бруно сожгла инквизиция за веру гелиоцентризм*]
== <NAME> (1564 - 1642)
#def[*<NAME>* -- итальянский физик, механик, астроном, философ, математик, оказавший значительное влияние на науку своего времени]
*Основные идеи*:
- Против птолемеевского (геоцентризм) и аристотельского видения мира (высмеивал Аристотеля)
- Поддерживал *гелиоцентрическую систему*
- Основатель *классический механики* (эксперименты с инерцией и свободным падением тел)
#def[*"И всё-таки она вертится!"*]
#heading(level: 1)[#text(red)[Утопическо-социалистические течения]]
== <NAME> (1478 - 1535)
#def["Золотая книжечка, столь же полезная, сколь и забавная о наилучшем устройстве государства и о новом острове *Утопия*"]
- В "Утопии" отменена частная собственность. Уничтожена всякая эксплуатация, взамен её устанавливается обоществлённое производство
== <NAME> (1568 - 1639)
#def[*Город Солнца*: все *солярии* (жители Города Солнца) являются "одновременно богатыми и вместе с тем бедным: богатыми -- потому что у них есть всё, бедными -- потому что у них нет кикакой собственности, и поэтому не они служат вещам, а вещи служат им"]
|
|
https://github.com/woojiahao/nus | https://raw.githubusercontent.com/woojiahao/nus/main/st2334/st2334_finals_raw/main.typ | typst | MIT License | #set page(flipped: false, margin: 7pt)
#show: columns.with(3, gutter: 4pt)
#set text(
font: "New Computer Modern Sans",
size: 8pt
)
#show par: set block(spacing: 5pt)
#set par(leading: 3pt)
#set list(tight: true)
#set block(spacing: 0.5em)
#align(center)[
#box(inset: 10pt, stroke: black, [
= ST2334 Finals Cheatsheet
by: #link("https://nus.woojiahao.com")[#underline("Jiahao")]
])
]
#show heading.where(level: 1): it => [
#set text(9pt, weight: "bold")
#block([#underline(smallcaps(it.body))])
// #block(smallcaps(it.body))
]
#show heading.where(level: 2): it => [
#set text(9pt, weight: "bold")
// #block([#underline(smallcaps(it.body))])
#block(smallcaps(it.body))
]
#show image: it => [
#align(center, it)
]
#show table: it => [
#align(center, it)
]
= definitions <definitions>
#strong[sample space ($S$):] set of all possible outcomes
- aka #emph[sure event]
#strong[sample point:] outcome in sample space, $p in S$
#strong[event:] subset of sample space, $E subset.eq S$
- no elements: #emph[null event], $nothing$
= event operations & relationships <event-operations-relationships>
\* Applicable to $n$ events
#strong[union:] $A union B = { x : x in A or x in B }$
#strong[intersection:] $A sect B = { x : x in A and x in B }$
#strong[complement:] $A prime = { x : x in S and x in.not A }$
#strong[mutually exclusive:] $A sect B = nothing$
#strong[contained:] $A subset B$
#strong[equivalent:] $A subset B and B subset A arrow.r.double A = B$
#strong[others:]
- $A sect A prime = nothing$
- $A sect nothing = nothing$
- $A union A prime = S$
- $lr((A prime)) prime = A$
- $A union lr((B sect C)) = lr((A union B)) sect lr((A union C))$
- $A sect lr((B union C)) = lr((A sect B)) union lr((A sect C))$
- $A union B = A union lr((B sect A prime))$
- $A = lr((A sect B)) union lr((A sect B prime))$
- $lr((A_1 union A_2 union dots.h union A_n)) prime = A_1 prime sect A_2 prime sect dots.h sect A_n prime$
- $lr((A_1 sect A_2 sect dots.h sect A_n)) prime = A_1 prime union A_2 prime union dots.h union A_n prime$
= counting methods <counting-methods>
#strong[multiplication principle:] $r$ different experiments performed sequentially, producing $n_1 times n_2 times dots.h times n_r$ outcomes
#strong[addition principle:] $r$ different procedures performed sequentially, producing $n_1 + n_2 + dots.h + n_r$ ways (non-overlapping) to perform an experiment
#strong[permutation:] selection and arrangement of $r$ objects out of $n$ where order matters (i.e. ${ a , b } eq.not { b , a }$)
$ P_r^n = n P r = frac(n !, lr((n - r)) !) = n lr((n - 1)) lr((n - 2)) dots.h lr((n - lr((r - 1)))) $
#strong[combination:] selection of $r$ objects out of $n$ where order does not matter
$ C_r^n = n C r = binom(n, r) = binom(n, n - r) = frac(n !, r ! lr((n - r)) !) $
= probability <probability>
$P lr((dot.op))$ is a function on the collection fo events of the sample space $S$ satisfying:
- axiom 1. For any event $A$, $0 lt.eq P lr((A)) lt.eq 1$
- axiom 2. For the sample space, $P lr((S)) = 1$
- axiom 3. For any two mutually exclusive events $A$ and $B$, $A sect B = nothing$ and $P lr((A union B)) = P lr((A)) + P lr((B))$
#strong[properties:]
- $P lr((nothing)) = 0$
- if $A_1 , A_2 , dots.h , A_n$ are mutually exclusive events, then $P lr((A_1 union A_2 union dots.h union A_n)) = P lr((A_1)) + P lr((A_2)) + dots.h + P lr((A_n))$
- $P lr((A prime)) = 1 - P lr((A))$
- $P lr((A)) = P lr((A sect B)) + P lr((A sect B prime))$
- #strong[inclusion-exclusion principle:] $P lr((A union B)) = P lr((A)) + P lr((B)) - P lr((A sect B))$
- $A subset B arrow.r.double P lr((A)) lt.eq P lr((B))$
#strong[finite sample space with equally likely outcomes:] $S = { a_1 , a_2 , dots.h , a_k }$ and all outcomes are equally likely, so any event occurring is where $A subset S$
$ P lr((A)) = lr(|A|) / lr(|S|) $
#strong[probability of repeated event:] if the outcome is always the same, then $P lr((K)) = P lr((A))^n$
= conditional probability <conditional-probability>
for any two events $A$ and $B$ with $P lr((A)) > 0$, the conditional probability of $B$ given that $A$ has occurred is
$ P lr((B \| A)) = frac(P lr((A sect B)), P lr((A))) $
since $A$ has occurred, $A$ becomes the reduced sample space
#strong[multiplication rule:] $P lr((A sect B)) = P lr((A)) P lr((B \| A))$ if $P lr((A)) eq.not 0$
#strong[inverse probability formula:] $P lr((A \| B)) = frac(P lr((A)) P lr((B \| A)), P lr((B)))$
= independence <independence>
events are independent ($A tack.t B$) iff $P lr((A sect B)) = P lr((A)) P lr((B))$
$ P lr((A)) eq.not 0 arrow.r.double P lr((A \| B)) = P lr((A)) $
$ P lr((B)) eq.not 0 arrow.r.double P lr((B \| A)) = P lr((B)) $
#strong[intuition:] $A$ and $B$ if the knowledge of $A$ does not change the probability of $B$
#strong[independence vs mutually exclusive:]
- $P lr((A)) > 0 and P lr((B)) > 0 , A tack.t B arrow.r.double upright("not mutually exclusive")$
- $P lr((A)) > 0 and P lr((B)) > 0 , A , B upright(" not mutually exclusive") arrow.r.double A ⊥̸ B$
- $S$ and $nothing$ are independent of any other event
- $A tack.t B arrow.r.double A tack.t B prime , A prime tack.t B , A prime tack.t B prime$
= total probability <total-probability>
#strong[partition:] if $A_1 , A_2 , dots.h , A_n$ are mutually exclusive events and $union.big_(i = 1)^n A_i = S$, then $A_1 , A_2 , dots.h , A_n$ is a partition of $S$ (i.e. how to split the sample space up into parts)
#strong[law of total probability:] given a partition of $S$, for any even $B$,
$ P lr((B)) = sum_(i = 1)^n P lr((B sect A_i)) = sum_(i = 1)^n P lr((A_i)) P lr((B \| A_i)) $
applied to single event $A$ and $B$:
$ P lr((B)) = P lr((A)) P lr((B \| A)) + P lr((A prime)) P lr((B \| A prime)) $
= bayes’ theorem <bayes-theorem>
give a partition of $S$, then for any event $B$ and $k = 1 , 2 , dots.h , n$,
$ P lr((A_k \| B)) = frac(
P lr((A_k)) P lr((B \| A_k)),
sum_(i = 1)^n P lr((A_i)) P lr((B \| A_k)),
) $
Applied to single event $A$ and $B$:
$ P lr((A \| B)) = frac(
P lr((A)) P lr((B \| A)),
P lr((A)) P lr((B \| A)) + P lr((A prime)) P lr((B \| A prime)),
) $
= random variables <random-variables>
a function $X$ which assigns a real number to every $s in S$ (mapping of values from sample space to some value representing a property of that value in the sample space)
$ X : S arrow.r.bar bb(R) $
#strong[range space:] set of real numbers produced by random variable $X$
$ R_X = { x \| x = X lr((s)) , s in S } $
#strong[notations:]
- ${ X = x } = { s in S : X lr((s)) = x } subset S$
- ${ X in A } = { s in S : X lr((s)) in A } subset S$
- $P lr((X = x)) = P lr(({ s in S : X lr((s)) = x }))$
- $P lr((X in A)) = P lr(({ s in S : X lr((s)) in A }))$
#strong[describing random variables:] (1) range of inputs to outputs, (2) constructing a table/formula
= probability distribution <probability-distribution>
#strong[probability distribution:] $lr((x_i , f lr((x_i))))$ where $f lr((x))$ is the probability function
== discrete random variables <discrete-random-variables>
number of values in $R_X$ is finite or countable
#strong[probability mass function:] for a discrete random variable $X$, the probability (mass) function is:
$ f lr((x)) = {P lr((X = x)) , x in R_X\
0 , x in.not R_X $
#strong[properties:] $f lr((x))$ must satisfy the following
- $f lr((x_i)) gt.eq 0 forall x_i in R_X$ (all fractional and $lt.eq 1$)
- $f lr((x)) = 0 forall x in.not R_X$
- $sum_(i = 1)^oo f lr((x_i)) = sum_(x_i in R_X) f lr((x_i)) = 1$
#strong[extension:] for any set $B subset bb(R)$,
$ P lr((X in B)) = sum_(x_i in B sect R_X) f lr((x_i)) $
== continuous random variables <continuous-random-variables>
$R_X$ is an interval or collection of intervals
#strong[probability density function:] quantifies probability that $X$ is in a certain range
#strong[properties:] $f lr((x))$ must satisfy the following
- $f lr((x)) gt.eq 0 forall x in R_X$
- $f lr((x)) = 0 forall x in.not R_X$
- $integral_(- oo)^oo f lr((x)) d x = integral_(R_X) f lr((x)) d x = 1$
#strong[extension 1:] given that $a lt.eq b$,
$ P lr((a lt.eq X lt.eq b)) & \
= P lr((a lt.eq X < b))\
= P lr((a < X lt.eq b))\
= P lr((a < X < b))\
= integral_a^b f lr((x)) d x $
#strong[extension 2:]
$ P lr((X = x)) = 0 $
= cumulative distribution function <cumulative-distribution-function>
probability distribution over a range (both discrete and continuous)
$ F lr((x)) = P lr((X lt.eq x)) $
#strong[properties:]
- $F lr((x))$ is always non-decreasing
- ranges of $F lr((x))$ and $f lr((x))$ satisfy
- $0 lt.eq F lr((x)) lt.eq 1$
- for discrete distributions, $0 lt.eq f lr((x)) lt.eq 1$
- for continuous distributions, $f lr((x)) gt.eq 0$ but #emph[not necessary] that $f lr((x)) lt.eq 1$
== discrete random variables <discrete-random-variables-1>
$ F lr((x)) & = sum_(t in R_X ; t lt.eq x) f lr((t))\
& = sum_(t in R_X ; t lt.eq x) P lr((X = t)) $
CDF is a step function and can be represented as such (note that probability is cumulated to reach 1):
$ F lr((x)) = {0 , x < 0\
1 \/ 4 , 0 lt.eq x < 1\
3 \/ 4 , 1 lt.eq x < 2\
1 , 2 lt.eq x $
for any two numbers $a < b$,
$ P lr((a lt.eq X lt.eq b)) = P lr((X lt.eq b)) - P lr((X < a)) = F lr((b)) - F lr((a -)) $
$F lr((a -))$ is the largest value in $R_X$ that is smaller than $a$
== continuous random variable <continuous-random-variable>
$ F lr((x)) = integral_(- oo)^x f lr((t)) d t $
$ f lr((x)) = frac(d F lr((x)), d x) $
for any two numbers $a < b$,
$ P lr((a lt.eq X lt.eq b)) = P lr((a < X < b)) = F lr((b)) - F lr((a)) $
note that if there are multiple functions per interval and $a , b$ run across multiple intervals, separately integrate each interval with the functions for each interval
= expectation <expectation>
expectation, also known as mean, of random variable is the average value of $X$ after repeating the experiment many times. This value may not be a possible value of $X$.
#strong[discrete random variable:]
$ mu_X = E lr((X)) = sum_(x_i in R_X) x_i f lr((x_i)) $
#strong[continuous random variable:]
$ E lr((X)) = integral_(- oo)^oo x f lr((x)) d x = integral_(x in R_X) x f lr((x)) d x $
#strong[properties:]
- $E lr((a X + b)) = a E lr((X)) + b$
- $E lr((X + Y)) = E lr((X)) + E lr((Y))$
- let $g lr((dot.op))$ be an arbitrary function,
$ E lr((g lr((X)))) = sum_(x in R_X) g lr((x)) f lr((x)) $ or $ E lr((g lr((X)))) = integral_(R_X) g lr((x)) f lr((x)) d x $
= variance <variance>
calculates the deviation of $X$ from its mean (expectation)
$ sigma_X^2 = V lr((X)) = E lr((X - mu_X))^2 = E lr((X^2)) - E lr((X))^2 $
applicable regardless of discrete/continuous random variable.
$ V lr((X)) = sum_(x in R_X) lr((x - mu_X))^2 f lr((x)) $
or
$ V lr((X)) = integral_(- oo)^oo lr((x - mu_X))^2 f lr((x)) d x $
#strong[properties:]
- $V lr((X)) gt.eq 0$ if $P lr((X = E lr((X)))) = 1$ where $X$ is a constant
- $V lr((a X + b)) = a^2 V lr((X))$
- standard deviation of $X$: $sigma_X = sqrt(V lr((X)))$
= joint distributions <joint-distributions>
$lr((X , Y))$ is a two-dimensional random vector/random variable
#strong[range space:] $R_(X , Y) = { lr((x , y)) \| x = X lr((s)) , y = Y lr((s)) , s in S }$ (effectively looking at all pairs of $lr((x , y))$; generalizable to $n$ dimensions)
#strong[discrete two-dimensional random variable:] number of possible values of $lr((X lr((s)) , Y lr((s))))$ is finite or countable (both $X$ and $Y$ are discrete)
#strong[continuous two-dimensional random variable:] number of possible values of $lr((X lr((s)) , Y lr((s))))$ can assume any value in some region of the Euclidean space $bb(R)^2$ (both $X$ and $Y$ are continuous)
= joint probability function <joint-probability-function>
== discrete joint probability function <discrete-joint-probability-function>
$ f_(X , Y) lr((x , y)) = P lr((X = x , Y = y)) $
#strong[properties:]
- $f_(X , Y) lr((x , y)) gt.eq 0 forall lr((x , y)) in R_(X , Y)$
- $f_(X , Y) lr((x , y)) = 0 forall lr((x , y)) in.not R_(X , Y)$
- $sum_(i = 1)^oo sum_(j = 1)^oo f_(X , Y) lr((x_i , y_j)) = sum_(i = 1)^oo sum_(j = 1)^oo P lr((X = x_i , Y = y_j)) = 1$
- above is the same as $sum sum_(lr((x , y)) in R_(X , Y)) f lr((x , y)) = 1$
let $A subset R_(X , Y)$,
$ P lr((lr((X , Y)) in A)) = sum sum_(lr((x , y)) in A) f_(X , Y) lr((x , y)) $
== continuous joint probability function <continuous-joint-probability-function>
$ & P lr((lr((X , Y)) in D))\
& = P lr((a lt.eq X lt.eq b , c lt.eq Y lt.eq d))\
& = integral_a^b integral_c^d f_(X , Y) lr((x , y)) d y d x $
\*the order of integration does not matter
#strong[properties:]
- $f_(X , Y) lr((x , y)) gt.eq 0 forall lr((x , y)) in R_(X , Y)$
- $f_(X , Y) lr((x , y)) = 0 forall lr((x , y)) in.not R_(X , Y)$
- $integral integral_(lr((x , y)) in R_(X , Y)) f_(X , Y) lr((x , y)) d x d y = 1$
\*focus of this module is ranges where $x$ and $y$ do not depend on each other (not the same as independence)
= marginal probability distribution <marginal-probability-distribution>
isolating $X$ or $Y$ from a joint probability distribution (projection of joint distribution to univariate distribution). To find $X$, use $Y$, and vice versa
$ P lr((X = x)) = f_X lr((x)) = sum_y f_(X , Y) lr((x , y)) $
or
$ f_X lr((x)) = integral_(- oo)^oo f_(X , Y) lr((x , y)) d y $
marginal probability distributions are probability functions.
= conditional distribution <conditional-distribution>
distribution of $Y$ given that the random variable $X$ is observed to take the value $x$
conditional probability function of $Y$ given that $X = x$:
$ f_(Y \| X) lr((y \| x)) = frac(f_(X , Y) lr((x , y)), f_X lr((x))) $
when given values, it finds $P lr((Y \| X = x))$
only defined for $x$ such that $f_X lr((x)) > 0$ (same for $y$)
#strong[$f_(Y \| X) lr((y \| x))$ is not a probability function of $x$:] the requirements of probability functions do not need to hold
#strong[applications:] you can also use summation for discrete joint random variables
$ P lr((Y lt.eq y \| X = x)) = integral_(- oo)^y f_(Y \| X) lr((y \| x)) d y $
$ E lr((Y \| X = x)) = integral_(- oo)^oo y f_(Y \| X) lr((y \| x)) d y $
== reading discrete joint probability tables <reading-discrete-joint-probability-tables>
#block[
#figure(
align(
center,
)[#table(
columns: 5,
align: (col, row) => (center, center, center, center, center,).at(col),
inset: 2.5pt,
[x/y],
[$y_1$],
[$y_2$],
[$y_3$],
[$f_X lr((x))$],
[$x_1$],
[a],
[b],
[c],
[a + b + c],
[$x_2$],
[d],
[e],
[f],
[d + e + f],
[$x_3$],
[g],
[h],
[i],
[g + h + i],
[$f_Y lr((y))$],
[a + d + g],
[b + e + h],
[c + f + i],
[1],
)],
)
]
$E lr((Y \| X = x))$ (same steps for $E lr((X \| Y = y))$) (using $x = x_1$):
+ sum of probability given $X = x_1 = f_X lr((x_1))$, $a + b + c = K$
+ divide each value in $X = x_1$ by $K$, $a \/ K$, $b \/ K$, $c \/ K$
+ multiply each by the corresponding $Y$ value, $frac(a y_1, K)$, $frac(b y_2, K)$, $frac(c y_3, K)$
+ sum the values: $E lr((Y \| X = x_1)) = frac(a y_1 + b y_2 + c y_3, K)$
$E lr((X))$ (same steps for $E lr((Y))$): $x_1 dot.op lr((a + b + c)) + x_2 dot.op lr((d + e + f)) + x_3 dot.op lr((g + h + i))$
simplified $E lr((X))$ (same steps for $E lr((Y))$): $x_1 dot.op f_X lr((x_1)) + x_2 dot.op f_X lr((x_2)) + x_3 dot.op f_X lr((x_3))$
= independent random variables <independent-random-variables>
$X$ does not decide $Y$ and vice versa
$X$ and $Y$ are independent iff for any $x$ and $y$ (all pairs),
$ f_(X , Y) lr((x , y)) = f_X lr((x)) f_Y lr((y)) $
\*must manually check all combinations
#strong[product feature:] necessary condition for independence: $R_(X , Y)$ needs to be a product space
$ & f_(X , Y) lr((x , y)) = f_X lr((x)) f_Y lr((y)) > 0\
& arrow.r.double R_(X , Y) = { lr((x , y)) \| x in R_X ; y in R_Y } = R_X times R_Y $
if $R_(X , Y)$ is not a product space, then $X$ and $Y$ are not independent (visually, it’s a rectangular space)
#strong[properties:]
- if $A subset bb(R) and B subset bb(R)$, the events $X in A$ and $Y in B$ are independent events in $S$
$ P lr((X in A ; Y in B)) = P lr((X in A)) P lr((Y in B)) $
$ P lr((X lt.eq x ; Y lt.eq y)) = P lr((X lt.eq x)) P lr((Y lt.eq y)) $
- for arbitrary functions $g_1 lr((dot.op))$ and $g_2 lr((dot.op))$, $g_1 lr((X)) tack.t g_2 lr((Y))$
- $f_X lr((x)) > 0 arrow.r.double f_(Y \| X) lr((y \| x)) = f_Y lr((y))$
- $f_Y lr((y)) > 0 arrow.r.double f_(X \| Y) lr((x \| y)) = f_X lr((x))$
== checking independence <checking-independence>
given a joint probability table (for discrete variables), if there are $0$ entries in the table, then $R_(X , Y)$ is not a product space, hence $X ⊥̸ Y$
more generally, both conditions must hold:
+ $R_(X , Y)$ is positive and is a product space
+ for any $lr((x , y)) in R_(X , Y)$, $f_(X , Y) lr((x , y)) = C times g_1 lr((x)) times g_2 lr((y))$ (can be decomposed into parts that all do not depend on each other)
\* $g_1 lr((X))$ and $g_2 lr((Y))$ do not need to be probability functions
= joint expectation <joint-expectation>
$ E lr((g lr((X , Y)))) = sum_x sum_y g lr((x , y)) f_(X , Y) lr((x , y)) $
or
$ E lr((g lr((X , Y)))) = integral_(- oo)^oo integral_(- oo)^oo g lr((x , y)) f_(X , Y) lr((x , y)) d y d x $
= covariance <covariance>
$ upright("cov") lr((X , Y)) & = E lr([lr((X - E lr((X)))) lr((Y - E lr((Y))))])\
& = sum_x sum_y lr((x - mu_X)) lr((y - mu_Y)) f_(X , Y) lr((x , y))\
& = integral_(- oo)^oo integral_(- oo)^oo lr((x - mu_X)) lr((y - mu_Y)) f_(X , Y) lr((x , y)) d x d y $
#strong[properties:]
- cov$lr((X , Y)) = E lr((X Y)) - E lr((X)) E lr((Y))$
- if $X tack.t Y$, cov$lr((X , Y)) = 0$ (but converse is not true)
- $X tack.t Y arrow.r.double E lr((X Y)) = E lr((X)) E lr((Y))$
- cov$lr((a X + b , c Y + d)) = a c dot.op upright("cov") lr((X , Y))$
- cov$lr((X , Y)) = upright("cov") lr((Y , X))$
- cov$lr((X + b , Y)) = c o v lr((X , Y))$
- cov$lr((a X , Y)) = a upright("cov") lr((X , Y))$
- $V lr((a X + b Y)) = a^2 V lr((X)) + b^2 V lr((Y)) + 2 a b dot.op upright("cov") lr((X , Y))$
- $V lr((a X)) = a^2 V lr((X))$
- $V lr((X + Y)) = V lr((X)) + V lr((Y)) + 2 upright("cov") lr((X , Y))$
- $V lr((a + b X)) = b^2 V lr((X))$
= joint variance <joint-variance>
- $X tack.t Y arrow.r.double V lr((X plus.minus Y)) = V lr((X)) + V lr((Y))$
- $V lr((X_1 + X_2 + dots.h.c + X_n)) = V lr((X_1)) + V lr((X_2)) + dots.h.c + V lr((X_n)) + 2 sum_(j > i) upright("cov") lr((X_i , X_j))$
- $X_1 tack.t X_2 tack.t dots.h.c tack.t X_n arrow.r.double V lr((X_1 plus.minus X_2 plus.minus dots.h.c plus.minus X_n)) = V lr((X_1)) + V lr((X_2)) + dots.h.c + V lr((X_n))$
= discrete distributions
== discrete uniform distribution
if random variable $X$ assumes values $x_1, x_2, ..., x_k$ with equal probability $p$, then $X$ follows a discrete uniform distribution
$
f_X (x) = cases(
1/k "if" x = x_1\, x_2\, ...\, x_k,
0 "otherwise"
)
$
- $mu_X = E(X) = sum_(i = 1)^k x_i f_X (x_i) = 1/k sum_(i = 1)^k x_i$
- $sigma_X^2 = V(X) = 1/k sum_(i = 1)^k x_i^2-mu_X^2$
== bernoulli distribution
*bernoulli trial:* random experiment with only two possible outcomes: `1` success, `0` failure
*bernoulli random variable:* let $X$ be the number of successes in a Bernoulli trial
- $X$ only has 2 values (${0, 1}$)
- $p$: probability of success for a Bernou.li trial
$
f_X\(x) = P(X = x) = cases(
p "if" x = 1,
1 - p "if" x = 0
) = p^x (1-p)^(1 - x)
$
- $X tilde "Bernoulli"(p)$ and $q = 1 - p$
$
f_X (1) = p; f_X (0) = q
$
- $mu_X = E(X) = p$
- $sigma_X^2 = V(X) = p(1 - p) = p q$
*bernoulli process:* sequence of repeatedly performed independent and identical Bernoulli trials
- generates sequence of independent and identically distributed Bernoulli random variables $X_1, X_2, ..., X_n$
== binomial distribution
number of successes in $n$ trials of a Bernoulli process; denoted by $X$
- $X tilde "Bin"(n, p)$ where $n$ is the number of trials and $p$ is the probability of success
$
P(X = x) = binom(n, x) p^x (1 - p)^(n - x)
$
- $E(X) = n p$, $V(X) = n p (1- p)$
- normal distribution may approximate binomial distribution
== negative binomial distribution
number of independent and identically distributed Bernoulli trials needed until the kth success occurs
- $X tilde "NB"(k, p)$
$
f_X (x) = P(X = x) = binom(x - 1, k - 1) p^k (1 - p)^(x - k)
$
- equivalent to probability of $x$ trial success and $k - 1$ success with $x - 1$ trials
- $binom(x - 1, k - 1)p^(k - 1)(1-p)^(x-k) times p$
- $E(X) = k / p$, $V(X) = ((1 - p)k) / p^2$
== geometric distribution
number of independent and identically distributed Bernoulli trials needed until first success occurs
- $X tilde "Geom"(p)$
$
f_X (x) = P(X = x) = (1 - p)^(x -1)p
$
- $E(X) = 1/p$, $V(X) = (1-p)/p^2$
- special case of negative binomial distribution
== poisson distribution
number of events occurring in a fixed period of time or fixed region
- $X tilde "Poisson"(lambda)$ where $lambda > 0$ is the expected number of occurrences during the given period/region
$
f_X (k) = P(X = k) = (e^(-lambda)lambda^k)/k!
$
- $k$ is the number of occurrences of such event
- $E(X) = lambda$, $V(X) = lambda$
$
P(X lt.eq.slant k) = e^(-lambda) (lambda + lambda^2 / 2! + lambda^3 / 3! + ... + lambda^k / k!)
$
*poisson process:* continuous time process with rate $alpha$; count the number of occurrences within some interval of time
- properties:
- expected number of occurrences in interval of length $T$ is $alpha T$
- no simultaneous occurrences
- number of occurrences in disjoint time intervals are independent
- follows $"Poisson"(alpha T)$ distribution
*approximation to binomial:* let $X tilde "Bin"(n, p)$; $n arrow infinity, p arrow 0$ such that $lambda = n p$ is a constant
- then $X tilde "Poisson"(n p)$
$
lim_(p arrow 0; n arrow infinity) P(X = x) = (e^(-n p) (n p)^x)/x!
$
- recommended values: $n$ big, $p$ small
- $n gt.eq.slant 20 and p lt.eq.slant 0.05$, OR
- $n gt.eq.slant 100 and n p lt.eq.slant 10$
= continuous distributions
continuous random variable $X$ follows the following distributions f they have the following probability density function
== continuous uniform distribution
over interval $(a, b)$
$
f_X (x) = cases(
1/(b - a) "if" a lt.eq.slant x lt.eq.slant b,
0 "otherwise"
)
$
- $X tilde U(a, b)$
- $E(X) = (a + b) / 2$, $V(X) = (b - a)^2 / 12$
#image(width: 80%, "continuous_uniform_distribution.png")
$
F_X (x) = cases(
0 "if" x < a,
(x - a)/(b - a) "if" a lt.eq.slant x lt.eq.slant b,
1 "if" x > b
)
$
== exponential distribution
parameter $lambda > 0$
$
f_X (x) = cases(
lambda e^(-lambda x) "if" x gt.eq.slant 0,
0 "if" x < 0
)
$
- $X tilde "Exp"(lambda)$
- $E(X) = 1 / lambda$, $V(X) = 1 / lambda^2$
- can be written with $mu$ if $mu = 1 \/ lambda$
#image(width: 80%, "exponential_distribution.png")
$
F_X (x) = P(X lt.eq.slant x) \
= integral_0^x lambda e^(-lambda t) "dt" \
= [- e^(- lambda t)]^x_0 \
= 1 - e^(-lambda x)
$
- if $x gt.eq.slant 0$, else $F_X (x) = 0$
*memory-less property:* if $X tilde "Bin"(lambda)$, then $P(X > s + t | X > s) = P(X > t)$
== normal distribution
parameter $mu$ and $sigma^2$
$
f_X (x) = 1 / (sqrt(2 pi) sigma) e^((-x-mu)^2\/2sigma^2)
$
- $X tilde N(mu, sigma^2)$
- $E(X) = mu$, $V(X) = sigma^2$
#image("normal_distribution.png")
*properties:*
- same $sigma_2$ but different $mu$ $arrow$ same shape, different center
- as $sigma_2$ increases $arrow$ curve flattens
*approximation to binomial:* let $X tilde "Bin"(n, p)$; $n arrow infinity$
- then $X tilde approx N(0, 1)$
$
Z = (X - E(X))/sqrt(V(X)) = (X - n p) / sqrt(n p(1 - p))
$
- recommended values: $n p > 5$ and $n(1 - p) > 5$
- continuity correction: adjusting ranges by $plus.minus 1\/2$
- $a lt.eq.slant X arrow.double - 1\/2$
- $a lt X arrow.double + 1\/2$
- $X lt.eq.slant b arrow.double + 1\/2$
- $X lt b arrow.double - 1\/2$
=== standard normal
given $X tilde N(mu, sigma^2)$, let $Z = (X - mu) / sigma, Z tilde N(0, 1)$
- $phi(dot) = f_Z (z) = 1/(sqrt(2 pi))e^(-z^2\/2)$: pdf
- $Phi(dot) = integral_(-infinity)^z phi(t) "dt" = 1 / (sqrt(2 pi)) integral_(-infinity)^z e^(-t^2 \/ 2) "dt"$: cumulative function
- $P(x_1 < X < x_2) arrow.double P(z_1 < Z < z_2) arrow.double Phi((x_2 - mu) / sigma) - Phi((x_1 - mu) / sigma)$
*properties:*
1. $P(Z gt.eq.slant 0) = P(Z lt.eq.slant 0) = Phi(0) = 0.5$
2. $forall z, Phi(z) = P(Z lt.eq.slant z) = P(Z gt.eq.slant -z) = 1 - Phi(-z)$
3. $Z tilde N(0, 1) arrow.double -Z tilde N(0, 1)$
4. $Z tilde N(0, 1) arrow.double sigma Z + mu tilde N(mu, sigma^2)$
5. $P(Z > z_alpha) = alpha$
#image("upper_tail.png")
*quantile:* upper ($alpha$th) quantile where $0 lt.eq.slant alpha lt.eq.slant 1$ is $x_alpha$ that satisfies $P(X gt.eq.slant x_alpha) = alpha$
- common $z_alpha$ values:
- $z_0.05 = 1.645$
- $z_0.01 = 2.326$
- symmetrical about 0, so $P(Z gt.eq.slant z_alpha) = P(Z lt.eq.slant - z_alpha) = alpha$
= population
*population:* all possible outcomes/observaations of a survey/experiment; size is $N$
- population mean: $mu_X$
- population variance: $sigma_X^2$
*sample:* subset of population; size is $n$
*finite population:* finite number of elements
*infinite population:* infinitely large number of elements
= random sampling
sample of $n$ members taken from a given population: $binom(N, n)$
- every member has the same probability of being selected
- yields sample that resembles the population; reducing chance that sample is seriously biased
*sampling infinite population:* let $X$ be a random variable with pdf $f_X (x)$
- let $X_1, X_2, ..., X_n$ be independent random variables with the same distribution as $X$
- $(X_1, X_2, ..., X_n)$ is a random sample of size $n$
- $f_(X_1, X_2, ..., X_n) = f_(X_1)(x_1)f_(X_2)(x_2)...f_(X_n)(x_n)$
- sampling from a finite population with replacement $arrow.double$ sampling from an infinite population
*sampling distrribution:* probability distribution of a statistic
= statistics
function of $n$ observations in sample; statistics are samples
*sample mean:*
$
overline(X) = 1/n sum_(i = 1)^n X_i
$
- $mu_overline(X) = E(overline(X)) = mu_X$
- in the "long run"
- $sigma_overline(X)^2 = V(overline(X)) = sigma_X^2\/n$
*sample variance:*
$
S^2 = 1/(n - 1) sum_(i = 1)^n (x_i - overline(x))^2
$
*standard error:* spread of sampling distribution (standard deviation): $S E$ or $sigma_overline(X)$
- how much $overline(X)$ tends to vary from sample to sample of size $n$
*law of large numbers:* if $X_1, X_2, ..., X_n$ are independent random variables with the same mean $mu$ and variance $sigma_2$, then for any $epsilon in RR$,
$
n arrow infinity arrow.double P(|overline(X) - mu| > epsilon) arrow 0
$
- i.e. as sample size increases, the probability that sample mean differs from population mean goes to 0
*central limit theorem:* if $overline(X)$ is a mean of random sample size $n$ from population with mean $mu$ and finite variance $sigma^2$, then
$
n arrow infinity & arrow.double (overline(X) - mu)/(sigma \/ sqrt(n)) arrow Z tilde N(0, 1)\
& arrow.double overline(X) arrow N(mu, sigma^2 / n)
$
- i.e. for large $n$, sums and means of random samples drawn from a population follow the normal distribution closely
- if sample comes from normal population, then $overline(X)$ is normally distributed as well
- rule of thumb:
- symmetric population: $n = 15-20$
- moderately skewed: $n = 30-50$
- extremely skewed: $n = 1000$
- convergence in distribution: for any $x$
$
lim_(n arrow infinity) P((overline(X) - mu)/(sigma \/ sqrt(n)) lt.eq.slant x) = Phi(x)
$
= sampling distributions
== chi-squared ($chi^2$) distribution
let $Z_1, Z_2, ..., Z_n$ be $n$ independent and identically distributed standard normal random variables
- a random variable with the same distribution as $Z_1^2 + Z_2^2 + ... + Z_n^2$ is a $chi^2$ random variable with $n$ degree of freedom
- $chi^2(n)$
#image(width: 60%, "chi_squared.png")
*properties:*
1. $Y tilde chi^2(n) arrow.double E(Y) = n; V(Y) = 2n$
2. for large $n$, $chi^2(n) approx N(n, 2n)$
3. if $Y_1$ and $Y_2$ are independent $chi^2$ random variable with $m, n$ degrees of freedom, then $Y_1 + Y_2$ is $chi^2(m + n)$
4. has a long right tail
*distribution of $((n - 1)S^2)/(sigma^2)$:* where $X_i tilde N(mu, sigma^2)$ has $chi^2(n - 1)$
$
((n - 1)S^2)/sigma^2 = (sum_(i = 1)^n (X_i - overline(X))^2)/sigma^2
$
== $t$-distribution
suppose $Z tilde N(0, 1)$ and $U tilde chi^2(n)$ and $Z perp U$:
$
T = Z / sqrt(U\/n) tilde t(n)
$
#image(width: 60%, "t_distribution.png")
*properties:*
1. $n arrow infinity arrow.double t(n) arrow N(0, 1)$ (when $n gt.eq.slant 30$, replace with $N(0, 1)$)
2. $T tilde t(n) arrow.double E(T) = 0; V(T) = n\/(n - 2), n > 2$
3. graph: symmetric about vertical axis and ressembles grapah of standard normal (but flatter)
4. used if $sigma$ (stdev) is unknown and sample size is small
- otherwise, if sample size is large, use $z$ but continue using $S$ instead of $sigma$
*relation to normal distribution:* if $X_1, ..., X_n$ are independent and identically distributed normal random variables with mean $mu$ and variance $sigma^2$
$
(overline(X) - mu)/(S\/sqrt(n)) tilde t(n - 1)
$
== $F$-distribution
suppose $U tilde chi^2(m)$ and $V tilde chi^2(n)$ are independent
$
F = (U\/m)/(V\/n) tilde F(m, n)
$
*properties:*
1. $X tilde F(m, n) arrow.double E(X) = n /(n - 2), n > 2; V(X) = (2n^2(m + n - 2))/(m(n - 2)^2(n - 4)), n > 4$
2. $F tilde F(n, m) arrow.double 1/F tilde F(m, n)$
3. $F(m,n;alpha) arrow.double P(F > F(m,n;alpha)) = alpha$
4. $F(m,n;1 - alpha) = 1\/F(n,m;alpha)$
= estimator
rule about how to calculate an estimate based on information in the sample
*unbiased estimator:* let $hat(Theta)$ be the estimator of $theta$
$
E(hat(Theta)) = theta
$
- $E(S^2) = sigma^2$
*maximum error of estimate:* replace $sigma$ with $S$ if necessary and $z_(alpha \/ 2)$ with $t_(n - 1; alpha \/ 2)$ if variance not known or sample size too small
$
E = z_(alpha \/ 2) sigma/sqrt(n)
$
reversing the formula:
$
n gt.eq.slant ((z_(alpha \/ 2) sigma)/E)^2
$
= confidence intervals
*interval estimator:* rule for calculating, from a sample, an interval $(a, b)$ with some level of certainty that the parameter of interest lies in
- quantified as degree of confidence/confidence level $(1 - alpha)$
- $(a, b)$ is the $(1 - alpha)$ confidence interval
$
P(a < mu < b) = 1 - alpha
$
- written as
$
overline(X) plus.minus E
$
*interpretation:* given some sample statistic, the population parameter is either contained within (or not) the confidence interval
- when repeated over many samples, about $100(1 - alpha)%$ of the confidence intervals will contain the population parameter
= 2 populations
== independent samples
usually focused on $mu_1 - mu_2 = delta$
=== known and unequal variance
populations are normal OR both samples are large
$
Z = ((overline(X) - overline(Y)) - (mu_1 - mu_2))/(sqrt(sigma^2_1/n_1 + sigma^2_2/n_2)) approx N(0, 1)
$
*confidence interval:*
$
(overline(X) - overline(Y)) plus.minus z_(alpha \/ 2) sqrt(sigma_1^2 / n_1 + sigma_2^2 / n_2)
$
=== large and unknown variance
$
Z = ((overline(X) - overline(Y)) - (mu_1 - mu_2))/sqrt(S_1^2/n_1 + S_2^2/n_2) approx N(0, 1)
$
*confidence interval:*
$
(overline(X) - overline(Y)) plus.minus z_(alpha \/ 2) sqrt(S_1^2 / n_1 + S_2^2 / n_2)
$
=== small, equal, unknown variance
*equal variance assumption:* if $1\/2 lt.eq.slant S_1 \/ S_2 lt.eq.slant 2$
*pooled estimator:* estimates $sigma^2$; follows $t_(n_1 + n_2 - 2)$ distribution
$
S_P^2 = ((n_1 - 1)S_1^2 + (n_2 - 1)S_2^2)/(n_1 + n_2 - 2)
$
$
Z = ((overline(X) - overline(Y)) - (mu_1 - mu_2))/(sigma sqrt(1/n_1 + 1/n_2)) approx N(0, 1)
$
*confidence interval:*
$
(overline(X) - overline(Y)) plus.minus t_(n_1 + n_2 - 2; alpha \/ 2) S_P sqrt(1 / n_1 + 1 / n_2)
$
=== large and equal variance
$
(overline(X) - overline(Y)) plus.minus z_(alpha \/ 2) S_P sqrt(1 / n_1 + 1 / n_2)
$
== dependent samples/paired data
each pair is independent from each other; let $D_i = X_i - Y_i$ and $mu_D = mu_1 - mu_2$
- treat $D_1, D_2, ..., D_n$ as random sample with mean $mu_D$ and variance $sigma_D^2$
$
T = (overline(D) - mu_D)/(S_D\/sqrt(n)); \
overline(D) = (sum_(i = 1)^n D_i)/n \
S_D^2 = (sum_(i = 1)^n (D_i - overline(D))^2)/(n - 1)
$
- $n < 30$ and population normally distributed: $T tilde t_(n - 1)$
- $n gt.eq.slant 30$: $T tilde N(0, 1)$
*confidence interval:*
$
overline(D) plus.minus t_(n - 1; alpha \/ 2) S_D/sqrt(n)
$
- replace $t_(n - 1; alpha \/ 2)$ with $z_(alpha \/ 2)$ if $n gt.eq.slant 30$
= hypothesis testing
1. set competing hypotheses: null and alternative
2. set level of significance
3. identify tet statistic, distribution, and rejection criteria
4. compute the observed test statistic value
5. conclusion
== null vs alternative hypothesis
looking for ways to reject that there is no change and show that there is significance
*null hypothesis ($H_0$):* assumed truth (i.e. no change)
*alternative hypothesis ($H_1$):* contrasting hypothesis; what we want to prove
*outcome:* reject or fail to reject hypothesis
*one-sided hypothesis test:* $H_1 : mu > overline(x)$ or $H_1 : mu < overline(x)$ (right or left leaning hypothesis test)
*two-sided hypothesis test:* $H_1 : mu eq.not overline(x)$ (both sides)
== level of significance
*conclusions:*
- reject $H_0$ and conclude $H_1$
- do not reject $H_0$ and conclude $H_0$
#table(
columns: (auto, auto, auto),
inset: 4pt,
align: horizon,
table.header(
[], [*Do not reject $H_0$*], [*Reject $H_0$*],
[$H_0$ is true], [Correct decision], [Type 1 error],
[$H_0$ is false], [Type 2 error], [Correct decision],
),
)
*level of significance $alpha$:* probability of making a type 1 error
- more serious so control this
*power of test $1-beta$:* probability of making type 2 error
== test statistic, distribution, and rejection region
quantifies how unlikely it is to observe the sample assuming the null hypothesis is true
#image(width: 50%, "rejection_region.png")
== calculation & conclusion
check if sample statistic falls within rejection region
- if so, sample is improbable, so reject $H_0$
- else, failed to reject $H_0$
= hypothesis testing with mean
population distribution is normal or $n$ is sufficient large
use $Z = (overline(X) - mu_0)/(sigma \/ sqrt(n)) tilde N(0, 1)$ as test statistic and rejection region is $P(|Z| > z_(alpha \/ 2)) = alpha$
- if two-tailed test: $Z < -z_(alpha \/ 2)$ or $Z > z_(alpha \/ 2)$
- if one-tailed test: $Z < -z_(alpha \/ 2)$ (for left tail) or $Z > z_(alpha \/ 2)$ (for right tail)
*unknown variance:* use $t$-distribution instead with $n - 1$ degree of freedom with $S$ replacing $sigma$; use standard normal distribution iff $n gt.eq.slant 30$
- swap $Z$ check with $t$ check
== $p$-value
probability of obtaining a test statistic at least as extreme than the observed sample value, given that $H_0$ is true; i.e. observed level of significance
- two-sided test: $p"-value" = P(|Z| > |z|) = 2P(Z > |z|) = 2P(Z < -|z|)$
- left-tailed test: $p"-value" = P(Z < -|z|)$
- right-tailed test: $p"-value" = P(Z > |z|)$
*rejection:* if $p"-value" < alpha$, reject $H_0$, else do not reject
== relation with confidence intervals
confidence intervals can be used to perform two-sided tests so by constructing a confidence interval given some confidence $100(1 - alpha)%$, then if $overline(X) in.not "CI"$, then we can reject $H_0$
= hypothesis testing with independent samples
$
H_0 : mu_1 - mu_2 = delta_0
$
where $delta_0$ is usually $0$
$
Z = ((overline(X) - overline(Y)) - delta_0)/(sqrt(sigma_1^2/n_1 + sigma_2^2/n_2)) tilde N(0, 1)
$
if $sigma^2$ is known, and population is normally distributed or $n_1, n_2$ are sufficiently large
otherwise, if $sigma^2$ is unknown but samples are sufficiently large
$
Z = ((overline(X) - overline(Y)) - delta_0)/(sqrt(S_1^2/n_1 + S_2^2/n_2)) tilde N(0, 1)
$
using the same rejection regions as when dealing with single samples
if $sigma^2$ is unknown but equal, underlying distribution are normal and samples are small, then use $t$-distribution and pooled estimator instead
$
Z = ((overline(X) - overline(Y)) - delta_0)/(S_P sqrt(1/n_1 + 1/n_2)) tilde t_(n_1 + n_2 - 2)
$
= hypothesis testing with dependent data/paired data
$
T = (overline(D) - mu_(D_0))/(S_D \/ sqrt(n)) tilde t_(n - 1)
$
if sample size $gt.eq.slant 30$, $T tilde N(0, 1)$ |
https://github.com/jgm/typst-hs | https://raw.githubusercontent.com/jgm/typst-hs/main/test/typ/compiler/array-28.typ | typst | Other | // Test the `rev` method.
#test(range(3).rev(), (2, 1, 0))
|
https://github.com/Myriad-Dreamin/typst.ts | https://raw.githubusercontent.com/Myriad-Dreamin/typst.ts/main/fuzzers/corpora/meta/figure_03.typ | typst | Apache License 2.0 |
#import "/contrib/templates/std-tests/preset.typ": *
#show: test-page
// Test breakable figures
#set page(height: 6em)
#show figure: set block(breakable: true)
#figure(table[a][b][c][d][e], caption: [A table])
|
https://github.com/RolfBremer/gloss-awe | https://raw.githubusercontent.com/RolfBremer/gloss-awe/main/Global/LocalGlossaryPool.typ | typst | Apache License 2.0 | // This is the glossary pool definition file.
#let local-glossary-pool = (
Amaranth: (
description: [
Amaranthus is a cosmopolitan genus of annual or short-lived perennial plants
collectively known as amaranths. Some amaranth species are cultivated as
leaf vegetables, pseudocereals, and ornamental plants.
]
),
"Complex Content": (
description: [
A Complex Content is an entry with a key consisting of more than a single
word.
]
),
XML: (
description: [
XML stands for `'eXtensible Markup Language'`.
This entry comes from the local pool.
],
link: [https://www.w3.org/XML]
),
)
|
https://github.com/Dr00gy/Typst-thesis-template-for-VSB | https://raw.githubusercontent.com/Dr00gy/Typst-thesis-template-for-VSB/main/main.typ | typst | // If you wish to add a title, authors or keywords, do so here!
#let title = "Bachelors thesis example"
#let author = "<NAME>"
#let czechKeywords = (
"klíčové slovo 1",
"klíčové slovo 2",
)
#let englishKeywords = (
"keyword 1",
"keyword 2",
)
// Edit this variable if you're in more nested folders, i.e. when using the template as a git submodule
#let templFolder = "thesis_template/"
#set document(
title: title,
author: (author),
// set keywords according to your language
keywords: englishKeywords,
)
// Imports template
// MAKE SURE YOU HAVE CALIBRI FONTS INSTALLED (or imported, if using the online version of typst)
#import templFolder + "template.typ" as temp
// Comment above and uncomment below to use paragraph spacing instead of first line indent
#show: temp.template
//#show: temp.template.with(firstLineIndent: true)
#set text(
// SET YOUR LANGUAGE HERE CORRECTLY
// use "cs" or "en", "sk" is not fully supported by typst
lang: "en",
// Template uses Calibri by default, if you want to overwrite that (guideline allows for more fonts, see links in template.typ), do it here
//font: "Palatino Linotype",
)
// If you want to set custom monospace font, do it here
//#show raw: set text(font: "Source Code Pro")
/*
The very first page:
Params:
1. Thesis title in Czech or English
2. Title again in the other language
3. Your full name
4. Supervisor
Optional params:
5. Type of your thesis - bachelor, bachelor-practice, master or phd, defaults to bachelor
6. Year of the thesis, defaults to current year
*/
#temp.titlePage(
title,
"Tool for something ig",
author,
"Ing. <NAME>, PhD.",
)
// Thesis assignment page
#temp.assignmentHeading
#lorem(50)
#lorem(50)
#pagebreak()
/*
All of the abstracts. Abstract should take about 10 lines.
1. Czech abstract
2. English abstract
3. Czech keywords
4. English keywords
5. Acknowledgment, if any
*/
#temp.abstracts(
[není to zadarmo],
[it's not free],
czechKeywords,
englishKeywords,
// If writing in Slovak, you can optionally provide keywords and abstracts in Slovak
//slovakAbstract: [nie je to zadarmo],
//slovakKeywords: ("kľúčové slovo 1", "kľúčové slovo 2"),
// You can also add a quote, if you feel like it
// and get insanely creative with it
quote: quote(
[
#text(lang: "he")[
ויאמר משה אל יהוה בי אדני לא איש דברים אנכי גם מתמול גם משלשם גם מאז דברך אל עבדך כי כבד פה וכבד לשון אנכי׃
]
],
attribution: [
_The Bible_, Exodus 4:10 #footnote([But Moses replied to the LORD, "Please, Lord, I have never been eloquent--either in the past or recently or since You have been speaking to Your servant--because I am slow and hesitant in speech." @bible]) @hebrew-bible
],
block: true,
),
acknowledgment: [Thank you],
// In case you need to set custom abstract spacing
//abstractSpacing: 2.5cm,
)
// Page numbering starts with outline
#set page(numbering: "1")
// Uncomment this if you don't want chapter title in headers
// headerHeadingPage sets if a header should be shown on a page starting with header
#show: temp.headerChapters.with(headerHeadingPage: false)
#temp.listChapters
// List of symbols and abbreviations, automatically alphabetically sorted
#temp.listSymbols((
("html", "Hyper Text Modeling Language"),
("HTML", "language"),
("glibc", "GNU C library"),
))
// List of Figures
#temp.listImages
// List of Tables
#temp.listTables
// Start heading numbering
#set heading(numbering: "1.1.1")
// Start of your text
= Introduction
#lorem(20)
= Massive Heading
== Some Text Header
#lorem(50)
=== Third Heading
#lorem(50)
#lorem(50)
#quote(lorem(50), attribution: [I made it up], block: true)
#lorem(50) And some inline math $5 + 10 = 15$.
$ sum_(k=0)^n k
&= 1 + ... n \
&= (n(n + 1)) / 2 $
Odkaz na @random_table[Tabulku]
- list example
- second item #footnote("is it really second?")
- indented item
+ numbered
+ numbered a inline `source code`
#figure([
```python
print("hello")
def add(a: int, b: int):
return a + b
```],
caption: "hello",
)
#lorem(10)
#figure(
table(
columns: (auto, auto),
table.header([*first*], [_second_]),
[1], [2],
),
caption: "What a table this is",
) <random_table>
// Idealy you'd create a function or a show rule to have your table style a bit more consistent
#let nohline = table.hline(stroke: none)
#figure(
table(
columns: (auto, auto, auto, auto, auto, auto),
align: bottom + left,
stroke: (top: 1pt, bottom: 1pt, x: none),
table.header(
table.cell(rowspan: 2)[Pokus],
table.cell(rowspan: 2)[A],
table.cell(colspan: 2)[Algoritmus 1],
table.cell(colspan: 2)[Algoritmus 2],
[B], [C], [D], [E]
),
[Hydrochloric acid], [12.0], [92.1], [104], [16.6], [104], nohline,
..for i in range(6) {([106],)}, nohline,
..for i in range(6) {([206],)},
),
caption: "A more customized table, keep your table style consistent tho!"
)
= Automatic page break with heading
some text here
#figure(
image("images/bacteria.jpg", height: 5cm),
caption: [Image of _Treponema pallidum_]
)
= Conclusion
/ Term: hello @house[p. 358] @halting
/ Secon term: #lorem(30) @wwdc-network
/ Halting: it is something @halting
#bibliography(
"main_bibliography.yml",
// this style is required by the styleguide
style: templFolder + "iso690-numeric-brackets-cs.csl"
)
// Start appendix
#show: temp.appendix
= First thing
#lorem(50)
= Second thing
#lorem(50)
|
|
https://github.com/7sDream/fonts-and-layout-zhCN | https://raw.githubusercontent.com/7sDream/fonts-and-layout-zhCN/master/chapters/06-features-2/substitution/chaining.typ | typst | Other | #import "/template/template.typ": web-page-template
#import "/template/components.typ": note
#import "/template/lang.typ": arabic
#import "/lib/glossary.typ": tr
#show: web-page-template
/// ### Chaining Substitutions
=== #tr[chaining substitution]
// The substitutions we've seen so far have applied globally - whenever the input glyph matches the rule, the substitution gets made. But what if we want to say that the rule should only apply in certain circumstances?
我们之前介绍的#tr[substitution]都是全局的,也就是只要输入#tr[glyph]匹配规则,#tr[substitution]就一定会发生。但如果我们希望某条规则只在特定情况下应用呢?
// The next three lookups do just this. They set the *context* in which a rule applies, and then they specify another lookup or lookups which are invoked at the given positions. The context is made up of what comes before the sequence we want to match (the prefix, or *backtrack*), the input sequence and lookups, and what comes after the input sequence (the suffix, or *lookahead*).
后面就要介绍三个这样的#tr[lookup]。它们关注规则匹配时的上下文,并且可以在给定位置调用另一个(或一些)查询组。上下文由匹配部分前的内容(称为前缀,也叫*回溯*)、整个输入序列、#tr[lookup]、匹配部分后的内容(称为后缀,也叫*前瞻*)四部分组成。
// Let's take a couple of examples to explain this concept. We'll start with a Latin one, taken from the [Libertinus](https://github.com/alif-type/libertinus) fonts. When a Latin capital letter is followed by an accent, then we want to substitute *some* of those accents by specially designed forms to fit over the capitals:
让我们来用于一些例子来解释这个概念。首先我们看一个Libertinus字体#[@Maclennan.Libertinus.2013]中的拉丁文的例子。当拉丁文大写字母后跟一个音调符号时,我们希望为其中某些音调符号设计一些和前面的字母更加贴合的特殊样式:
```fea
@capitals = [A B C D E F G H I J K L M N O P Q R S U X Z...];
@accents = [gravecomb acutecomb uni0302 tildecomb ...];
lookup ccmp_cap_accents {
sub acutecomb by acute.cap;
sub gravecomb by grave.cap;
sub uni0302 by circumflex.cap;
sub uni0306 by breve.cap;
} ccmp_cap_accents;
feature ccmp {
sub @capitals @accents' lookup ccmp_cap_accents;
} ccmp;
```
// What this says is: when we see a capital followed by an accent, we're going to substitute the accent (it's the replacement sequence, so it gets an apostrophe). But *how* we do the substitution depends on another lookup we now reference: acute accents for capital acutes, grave accents for capital graves, and so on. The tilde accent does not have a capital form, so is not replaced.
这段代码的含义是,当大写字母后跟着音调符号时,#tr[substitution]这些音调符号(参与替换的序列后面需要加一个撇号)。但具体怎么#tr[substitution]则取决于这条规则引用的另一个#tr[lookup],这里使用的#tr[lookup]将尖音符、重音符等都替换为适合大写的形式。波浪号没有大写形式,所以不会被替换。
// We can also use this trick to perform a *many to many* substitution, which OpenType does not directly support. In Urdu the `yehbarree-ar.fina` glyph "goes backwards" with a large negative right sidebearing, and if not handled carefully can bump into glyphs behind it. When `threedotsdownbelow-ar` occurs before a `yehbarre-ar.fina`, we want to insert an `extender` glyph to give a little more room for the dots. Here's what we want to achieve:
我们可以使用一些技巧来用这种方式做到OpenType当前不支持的多换多#tr[substitution]。在乌尔都语中,`yeharree-ar.fina`#tr[glyph]有一个巨大的负右#tr[sidebearing]。如果处理不当的话,它可能会导致显示位置向回走到上一个#tr[glyph]去。当 `yehbarre-ar.fina`前面出现`threedotsdownbelow-ar`#tr[glyph]时,我们希望通过插入一个扩充#tr[glyph]来让这些点有足够的空间可以显示。这个功能可以这么表述:
```fea
feature rlig {
lookup bari_ye_collision {
sub threedotsdownbelow-ar yehbarree-ar.fina by threedotsdownbelow-ar extender yehbarree-ar.fina;
} bari_ye_collision;
} rlig;
```
// But of course we can't do this because OpenType doesn't support many-to-many substitutions. This is where chaining rules come in. To write a chaining rule, first we create a lookup which explains *what* we want to do:
但我们没法这么做,因为OpenType不支持多换多#tr[substitution],这就是#tr[chaining rules]有用的地方了。首先需要创建一个描述我们具体想做什么的#tr[lookup]:
```fea
lookup add_extender_before {
sub yehbarree-ar.fina by extender yehbarree-ar.fina;
} add_extender_before;
```
然后,创建一个表示在什么时候需要做这件事的#tr[lookup]:
```fea
feature rlig {
lookup bari_ye_collision {
sub threedotsdownbelow-ar yehbarree-ar.fina' lookup add_extender_before;
} bari_ye_collision;
} rlig;
```
// Read this as "when a `threedotsdownbelow-ar` precedes a `yehbarree-ar.fina`, then call the `add_extender_before` lookup." This lookup applies to that `yehbarree-ar.fina` glyph and replaces it with `extender yehbarree-ar.fina`, giving the dots a bit more space.
上面这段代码可以理解为:当 `threedotsdownbelow-ar` 后跟着 `yehbarree-ar.fina` 时,调用 `add_extender_before` #tr[lookup]。这个#tr[lookup]应用于`yehbarree-ar.fina`#tr[glyph],将它替换为 `extender yehbarree-ar.fina`,从而给前面的点提供更多空间。
// Let's take another example from the Amiri font, which contains many calligraphic substitutions and special forms. One of these substitutions is that the sequence beh rah (بر) *and all similar forms based on the same shape* is replaced by another pair of glyphs with a better calligraphic cadence. (Actually, this needs to be done in two cases: when the beh-rah is at the start of the word, and when it is at the end. But we're going to focus on the one where it is at the end.) How do we do this?
接下来看一个Amiri字体中的例子。这个字体包含很多用于模拟书法和特殊形态的#tr[substitution],其中之一是将 `beh rah`(#arabic[بر])(以及所有与此具有相同结构的类似构体)替换为更有书法感的另一对#tr[glyph]。确切的说,这个功能需要处理两种情况,一种是 `beh rah` 在开头,一种在结尾。但这里我们就只关注在结尾的形式。这个功能要如何完成呢?
// First, we declare our feature and say that we're not interested in mark glyphs. Then, when we see a beh-like glyph (which includes not only beh, but yeh, noon, beh with three dots, and so on) in its medial form and a rah-like glyph (or jeh, or zain...) in its final form, then *both* of those glyphs will be subject to a secondary lookup.
首先,我们定义一个特性,让它不关系符号#tr[glyph]。然后当出现类似 `beh` #tr[glyph](并不只是 `beh`,也包括`yeh`、`noon`、带三个点的`beh`等)的词中形式和类似`rah`#tr[glyph](如`jeh`、`zain`等)的词尾形式时,这两个#tr[glyph]都需要被另一个#tr[lookup]处理。
```fea
@aBaa.medi = [ uni0777.medi uni0680.medi ]; # and others ...
@aRaa.fina = [ uni0691.fina uni0692.fina ]; # and others ...
feature calt {
lookupflag IgnoreMarks;
sub [@aBaa.medi]' lookup BaaRaaFina
[@aRaa.fina]' lookup BaaRaaFina;
} calt;
```
// The secondary lookup will turn beh-like glyphs into a beh-rah ligature form of beh, and all of the rah-like glyphs into a beh-rah ligature form of rah:
后一个#tr[lookup]将会把类似`beh`的#tr[glyph]转换为它在`beh-rah`#tr[ligature]中的形式,对于类似`rah`的字形也是同理:
```fea
lookup BaaRaaFina {
sub @aBaa.medi by @aBaa.medi_BaaRaaFina;
sub @aRaa.fina by @aRaa.fina_BaaRaaFina;
} BaaRaaFina;
```
// Because this lookup will only be executed when beh and rah appear together, and because it will be executed twice in the rule we gave above, it will change both the beh-like glyph *and* the rah-like glyph for their contextual calligraphic variants.
因为这个#tr[lookup]只会在 `beh` 和 `rah` 一起出现时才被使用,而且会被使用两次,所以它会把类似 `beh` 和 `rah` 的字符都转换为其对应的书法变体。
// Let's try another example from another script, with a slightly different syntax. Devanagari is an abugida script, where each consonant has an implicit vowel "a" sound. If you want to change that vowel, you precede the consonant with a *matra*. The "i" matra looks a little bit like the Latin letter f, but its hook is normally designed to stretch across the length of the consonant it follows and "point to" the stem of the consonant. Of course, this gives us a problem: the consonants have differing widths. What we need to do, then, is design a bunch of i-matra glyphs of different widths, and when i-matra is followed by a consonant, substitute it by the variant matra glyph with the appropriate width. For example:
再来看看另一种#tr[script]中的例子,这次的语法会略有不同。天城文是一种元音附标#tr[script],它的所有辅音都有一个隐含的元音a。如果需要改变这个元音,需要在辅音前添加一个`matra`。表示i的`matra`看上去有点像拉丁字母 f,不过它的长度需要根据附加到的辅音的长度进行拉伸,以保证它指向辅音的#tr[stem]。当然这存在一个问题,辅音的宽度也是不一样的。所以我们需要设计一系列不同宽度的 `i-matra` #tr[glyph]。当 `i-matra` 跟着一个辅音时,需要被#tr[substitution]为合适宽度的变体形式。例如这样:
```fea
@width1_consonants = [ra-deva rra-deva];
@width2_consonants = [ttha-deva tha-deva];
@width3_consonants = [ka-deva nga-deva]; # and others ...
# ...
feature pres {
lookup imatra {
sub iMatra-deva' @width1_consonants by iMatra-deva.1;
sub iMatra-deva' @width2_consonants by iMatra-deva.2;
sub iMatra-deva' @width3_consonants by iMatra-deva.3;
#...
} imatra;
} pres;
```
// Notice that here we are using a syntax which allows us to define both the "what we want to do" lookup (the substitution) and the "when we want to do it" lookup in the same line. The feature compiler will implicitly convert what we have written to:
注意这里我们用了另一种语法,它允许我们在“何时进行”的#tr[lookup]的规则行中直接定义“想做什么”的#tr[lookup]。编译器会将这段代码转换为:
```fea
lookup i1 { sub iMatra-deva' by iMatra-deva.1 } i1;
lookup i2 { sub iMatra-deva' by iMatra-deva.2 } i2;
lookup i3 { sub iMatra-deva' by iMatra-deva.3 } i3;
feature pres {
lookup imatra {
sub iMatra-deva' lookup i1 @width1_consonants;
sub iMatra-deva' lookup i2 @width2_consonants;
sub iMatra-deva' lookup i3 @width3_consonants;
# ...
} imatra;
} pres;
```
#note[
// > Again I would encourage you to use the more explicit syntax yourself in all but the simplest of cases to avoid surprises.
我依旧建议你尽量使用明确的语法来避免奇怪的问题,但这种最简单的情况可以例外。
]
// We put this in the `pres` (pre-base substitution) feature, which is designed for substituting pre-base vowels with their conjunct forms, and is normally turned on by shapers when handling Devanagari. The following figure shows the effect of the feature above:
我们将这些规则放在 `pres`(基本字符前部#tr[substitution])特性中,这个特性专门用于将在基本字符前的元音替换为其连接形式,在处理天城文时#tr[shaper]通常会启用它。下图展示了上述特性的效果:
#figure(
placement: none,
)[#include "i-matra.typ"] <figure:i-matra>
// In some cases, you may want to forego a substitution or set of substitutions in particular contexts. For example, in Malayalam, the sequence ka, virama, sa) should appear as a stacked Akhand character "Kssa" - except if the sa is followed by certain vowel sounds which change the form of the sa.
在某些场景中,可能希望根据上下文的情况放弃某个#tr[substitution]。比如在马拉雅拉姆文中,序列`ka virama sa`应该被堆叠显示为一个不可分#tr[character]`Kssa`。但如果这个 `sa` 后面跟着的是几个特殊元音的话,就不能使用堆叠形式,而是要去改变这个`sa`的形式。
#figure(
placement: none,
)[#include "manjari.typ"]
// We'll achieve this in two steps. First, we'll put a contextual rule in the `akhn` feature to make the Kssa conjunct. Even though this is a simple substitution we need to write it in the contextual form (using apostrophes, but with an empty backtrack and empty lookahead):
我们可以通过两步来达成这个效果。首先,我们在 `akhn` 特性中加入组建Kass#tr[character]的上下文规则。虽然这就是一个很简单的操作,我们也得用#tr[contextual]#tr[substitution]:
```fea
feature akhn {
sub ka-malayalam' halant-malayalam' sa-malayalam' by kssa;
}
```
// This creates the kssa akhand form. Now we need another rule to say "but if you see ka, virama, sa and then a matra, don't do that substitution." To do this, we use the `ignore` keyword:
这样 Kssa 的不可分形式就创建好了。接下来我们需要另一个规则,使 `ka virama sa` 后面是 `marta` 的时候上述组成 `Kssa` 的#tr[substitution]不要进行。这里需要使用 `ignore` 关键字:
```fea
@matras = [uMatra-malayalam uuMatra-malayalam ...];
feature akhn {
ignore sub ka-malayalam' halant-malayalam' sa-malayalam' @matras;
sub ka-malayalam' halant-malayalam' sa-malayalam' by kssa;
}
```
// This `ignore` rule ends processing of the current lookup if the context matches. You can have multiple `ignore` rules: once one of them is matched, processing of the current lookup is terminated. For instance, we also want to forego the akhand form in the sequence "ksra" (because we're going to want to use the "sra" ligature in that sequence instead):
一个#tr[lookup]内可以有多条`ignore`规则,一旦某条`ignore`规则匹配成功,它会结束当前#tr[lookup]的处理流程。比如,当序列是`ksra`时,就不能组成不可分的`kssa`#tr[character],因为此时我们希望使用 `sra` #tr[ligature]:
```fea
feature akhn {
ignore sub ka-malayalam' halant-malayalam' sa-malayalam' @matras;
ignore sub ka-malayalam' halant-malayalam' sa-malayalam' halant-malayalam' 'ra-malayalam;
sub ka-malayalam' halant-malayalam' sa-malayalam' by kssa;
}
```
// We said that `ignore` only terminates processing of a *lookup*. If you only want to skip over a given number of rules, but consider later rules in the same feature, you need to isolate the relevant `ignore`/`sub` rules inside their own lookup:
但要注意 `ignore` 只会终止当前的*#tr[lookup]*。如果你想跳过一些规则,让当前特性中的其他规则继续尝试匹配,你需要把 `ignore/sub` 规则放在独立隔离的#tr[lookup]中:
```fea
feature akhn {
lookup Ksa {
ignore sub ka-malayalam' halant-malayalam' sa-malayalam' @matras;
ignore sub ka-malayalam' halant-malayalam' sa-malayalam' halant-malayalam' 'ra-malayalam;
sub ka-malayalam' halant-malayalam' sa-malayalam' by kssa;
# "ksra" 被忽略了
}
# 但这里的规则还会继续尝试匹配
}
```
// We can combine contextual substitutions with lookup flags for situations when we want the context to only be interested in certain kinds of glyph. For example, the Arabic font [Amiri](https://github.com/alif-type/amiri) has an optional stylistic feature whereby if the letter beh follows a waw or rah (for example, in the word ربن - the name "Rabban", or the word "ribbon" in Urdu) then the nukta on the beh is dropped down:
在#tr[contextual]#tr[substitution]的#tr[lookup]中也可以使用#tr[lookup]选项,让它只关心特定种类的#tr[glyph]。比如,阿拉伯字体Amiri#[@Maclennan.Amiri.2015]支持一个可选样式 `ss01`。当此样式开启时,只要`beh`后是`waw`或者`rah`(比如 #arabic[ربن] 就符合描述,它表示姓名Rabban,或者乌尔都单词ribbon),那么就会把 `beh` 的点形变音符号往下落一些,见@figure:amiri-beh。
#figure(
caption: [Amiri字体中的可选样式]
)[#include "amiri-beh.typ"] <figure:amiri-beh>
我们现在知道怎么实现它:
```fea
feature ss01 {
sub @RaaWaw @aBaaDotBelow' by @aBaaLowDotBelow;
} ss01;
```
// The problem is that the text might be vocalised. We still want this rule to apply even if, for example, there is a fatah placed above the rah (رَبَن). We could, of course, attempt to write a context which would apply to rah and waw plus marks all possible combinations of the mark characters, but the easier solution is to tell the shaper that we are not interested in mark characters when applying this rule, only base characters - another use for lookup flags.
这样写的问题是没有考虑文本中的变音符号。我们希望,例如在 `rah` 上有 `fatah` 符号时(#arabic[رَبَن]),这个规则依然能够匹配上。当然,我们可以尝试去写一条匹配`rah` + `waw` + 任何可能符号的规则,但处理这种情况的最简单方法就是告诉#tr[shaper]在处理这条规则时我们不关心符号#tr[character]。#tr[lookup]选项大显身手的时候到了。
```fea
feature ss01 {
lookupflag IgnoreMarks;
sub @RaaWaw @aBaaDotBelow' by @aBaaLowDotBelow;
} ss01;
```
|
https://github.com/Jozott00/typst-LLNCS-template | https://raw.githubusercontent.com/Jozott00/typst-LLNCS-template/main/README.md | markdown | # Springer's Lecture Notes in Computer Science Typst Template
A non-perfect LLNCS (Lecture Notes in Computer Science) [typst](https://typst.app) template, that comes rather close to [Springer's Latex template](https://www.overleaf.com/latex/templates/springer-lecture-notes-in-computer-science/kzwwpvhwnvfj#.WuA4JS5uZpi).
## Installation
Download/clone the repository and use it as starting point for your typst project.
## Contribution
Contributions are welcome! Just fork the repo and create a merge request!
|
|
https://github.com/xsro/xsro.github.io | https://raw.githubusercontent.com/xsro/xsro.github.io/zola/typst/Control-for-Integrator-Systems/part3.typ | typst | #import "template.typ": template
#show: template.with(
title:[*Sliding Mode Control for Integrator Systems*],
part:[*part 3*: Noncontinuous Control Theory]
)
#include "5Filippov.typ"
|
|
https://github.com/Enter-tainer/natrix | https://raw.githubusercontent.com/Enter-tainer/natrix/main/lib.typ | typst | Apache License 2.0 | #import "nat.typ": nat, bnat, pnat, Bnat, vnat, Vnat
|
https://github.com/PhilChodrow/cv | https://raw.githubusercontent.com/PhilChodrow/cv/main/src/content/service.typ | typst | #import "../template.typ": *
#cvSection("Professional Service")
#cvSubSection("Journal Reviews")
#table(
columns: 3,
stroke: none,
[_SIAM Review_],
[_SIAM J. Math. Data Sci._],
[_SIAM J. Appl. Dyn. Sys._],
[_SIAM J. Matrix Analysis_],
[_Nature Communications_],
[_Science Advances_],
[_Proc. Nat. Acad. Sci. (PNAS)_],
[_J. Applied and Computational Topology_],
[_Physical Review Letters_],
[_Physical Review X_],
[_Physical Review E_],
[_IEEE Trans. Network Sci. and Eng._],
[_Nature Human Behavior_],
[_Social Network Analysis and Mining_],
[_Networks and Spatial Economics_],
[_Chaos_],
[_Int’l J. Geo. Info. Sys._],
[_PLoS One_]
)
#cvSubSection("Events Co-Organized")
#cvEntry(
title: [Minisymposium on Tensor Methods in Network Science],
organisation: [SIAM Conference on Mathematics of Data Science],
logo: "",
date: [2022],
location: [San Diego, CA]
)
#cvEntry(
title: [Southern California Applied Mathematics Symposium (SoCAMS)],
organisation: [Harvey Mudd College],
logo: "",
date: [2022],
location: [Claremont, CA]
)
#cvEntry(
title: [MAA Project NExT Workshop on Projects Across the Mathematics Curriculum],
organisation: [Joint Math Meetings],
logo: "",
date: [2022],
location: [Online]
)
#cvEntry(
title: [Workshop on Graphs and Complex Structures for Learning and Reasoning],
organisation: [Association for the Advancement of Artificial Intelligence (AAAI)],
logo: "",
date: [2022],
location: [Vancouver, CA]
)
#cvSubSection("Professional Societies")
#table(
columns: 2,
stroke: none,
[Society for Industrial and Applied Mathematics (SIAM)],
[Mathematical Association of America (MAA)],
[Association for Women in Mathematics (AWM)],
[National Association of Mathematicians (NAM)]
)
|
|
https://github.com/pluttan/shem | https://raw.githubusercontent.com/pluttan/shem/main/lab1/lab1.typ | typst | #import "@docs/bmstu:1.0.0":*
#import "@preview/tablex:0.0.8": tablex, rowspanx, colspanx, cellx
#show: student_work.with(
caf_name: "Компьютерные системы и сети",
faculty_name: "Информатика и системы управления",
work_type: "лабораторной работе",
work_num: "1",
discipline_name: "Схемотехника",
theme: "Исследование дешифраторов",
author: (group: "ИУ6-42Б", nwa: "<NAME>"),
adviser: (nwa: "<NAME>"),
city: "Москва",
table_of_contents: true,
)
#let xb = $op("x", limits: #true)^"__"$
= Задание
+ Синтез линейного DC 3-8
+ Синтез пирамидального DC 3-8
+ Наращивание сложного DC 5-32 на DC 2-4
+ Синтез шифратора CD 8-3
+ Наращивание сложного шифратора 64-6 на CD 8-3
Для Всех заданий требуется:
+ Построить таблицу переходов
+ Выписать формулы согласно методики построения
+ Построить схему в Multisim
+ Проверить по таблице переходов что она правильно работает
+ Нарисовать схему (элементы по ГОСТ)
+ Снять временную диаграмму
+ Высчитать практическую и теоретическую задержку
+ Написать вывод по заданию
= Задание 1: Синтез линейного DC 3-8
== Таблица переходов
#align(center)[
#tablex(
columns: 12,
inset: 10pt,
align: center + horizon,
[$E_n$],[$x_4$],[$x_2$],[$x_1$],[$y_0$],[$y_1$],[$y_2$],[$y_3$],[$y_4$],[$y_5$],[$y_6$],[$y_7$],
[$0$],[$✘$],[$✘$],[$✘$],[$0$],[$0$],[$0$],[$0$],[$0$],[$0$],[$0$],[$0$],
[$1$],[$0$],[$0$],[$0$],[$1$],[$0$],[$0$],[$0$],[$0$],[$0$],[$0$],[$0$],
[$1$],[$0$],[$0$],[$1$],[$0$],[$1$],[$0$],[$0$],[$0$],[$0$],[$0$],[$0$],
[$1$],[$0$],[$1$],[$0$],[$0$],[$0$],[$1$],[$0$],[$0$],[$0$],[$0$],[$0$],
[$1$],[$0$],[$1$],[$1$],[$0$],[$0$],[$0$],[$1$],[$0$],[$0$],[$0$],[$0$],
[$1$],[$1$],[$0$],[$0$],[$0$],[$0$],[$0$],[$0$],[$1$],[$0$],[$0$],[$0$],
[$1$],[$1$],[$0$],[$1$],[$0$],[$0$],[$0$],[$0$],[$0$],[$1$],[$0$],[$0$],
[$1$],[$1$],[$1$],[$0$],[$0$],[$0$],[$0$],[$0$],[$0$],[$0$],[$1$],[$0$],
[$1$],[$1$],[$1$],[$1$],[$0$],[$0$],[$0$],[$0$],[$0$],[$0$],[$0$],[$1$],
)
]
== Формулы
$ y_0 = xb_4 xb_2 xb_1 E_n\
y_1 = xb_4 xb_2 x_1 E_n\
y_2 = xb_4 x_2 xb_1 E_n\
y_3 = xb_4 x_2 x_1 E_n\
y_4 = x_4 xb_2 xb_1 E_n\
y_5 = x_4 xb_2 x_1 E_n\
y_6 = x_4 x_2 xb_1 E_n\
y_7 = x_4 x_2 x_1 E_n $
#pagebreak()
== Схема
#img(image("1 1.png", width:100%), [Схема дешифратора 8-3])
== Временная диаграмма
#img(image("1 2.png", width:80%), [Временная диаграмма дешифратора 8-3])
== Практические и теоретические задержки
Практические задержки 40 нс.
Теоретически задержки могут быть на инверторе и конъюнкторе.
$ t_"7404N" = 12 "нс" $
$ t_"74ALS21AM" = 9.5 "нс" $
$ T = t_"инв" + t_"кон" = 12 + 9.5 = 21.5 "нс" $
== Вывод
При выполнении здания 1 была построена схема дешифратора DC 3-8 по таблице истинности в среде Multisim, была изучена временная диаграмма и посчитаны задержки.
= Задание 2: Синтез пирамидального DC 3-8
== Таблица переходов
#align(center)[
#tablex(
columns: 12,
inset: 10pt,
align: center + horizon,
[$E_n$],[$x_4$],[$x_2$],[$x_1$],[$y_0$],[$y_1$],[$y_2$],[$y_3$],[$y_4$],[$y_5$],[$y_6$],[$y_7$],
[$0$],[$✘$],[$✘$],[$✘$],[$0$],[$0$],[$0$],[$0$],[$0$],[$0$],[$0$],[$0$],
[$1$],[$0$],[$0$],[$0$],[$1$],[$0$],[$0$],[$0$],[$0$],[$0$],[$0$],[$0$],
[$1$],[$0$],[$0$],[$1$],[$0$],[$1$],[$0$],[$0$],[$0$],[$0$],[$0$],[$0$],
[$1$],[$0$],[$1$],[$0$],[$0$],[$0$],[$1$],[$0$],[$0$],[$0$],[$0$],[$0$],
[$1$],[$0$],[$1$],[$1$],[$0$],[$0$],[$0$],[$1$],[$0$],[$0$],[$0$],[$0$],
[$1$],[$1$],[$0$],[$0$],[$0$],[$0$],[$0$],[$0$],[$1$],[$0$],[$0$],[$0$],
[$1$],[$1$],[$0$],[$1$],[$0$],[$0$],[$0$],[$0$],[$0$],[$1$],[$0$],[$0$],
[$1$],[$1$],[$1$],[$0$],[$0$],[$0$],[$0$],[$0$],[$0$],[$0$],[$1$],[$0$],
[$1$],[$1$],[$1$],[$1$],[$0$],[$0$],[$0$],[$0$],[$0$],[$0$],[$0$],[$1$],
)
]
== Формулы
$ y_0 = (xb_4 xb_2 E_n) xb_1 $
$ y_1 = (xb_4 xb_2 E_n) x_1 $
$ y_2 = (xb_4 x_2 E_n) xb_1 $
$ y_3 = (xb_4 x_2 E_n) x_1 $
$ y_4 = (x_4 xb_2 E_n) xb_1 $
$ y_5 = (x_4 xb_2 E_n) x_1 $
$ y_6 = (x_4 x_2 E_n) xb_1 $
$ y_7 = (x_4 x_2 E_n) x_1 $
#pagebreak()
== Схема
#img(image("1 3.png", width:80%), [Схема пирамидального дешифратора 3-8])
== Временная диаграмма
#img(image("1 4.png", width:70%), [Временная диаграмма пирамидального дешифратора 3-8])
== Практические и теоретические задержки
Практические задержки 50нс.
Теоретически задержки могут возникать из-за конъюнкторов и инверторов.
$ t_"7404N" = 12 "нс" $
$ t_"74ALS11AM" = 6.5 "нс" $
$ t_"7408N" = 18 "нс" $
$ T = t_"инв" + t_"кон3" + t_"кон2" = 12 + 6.5 + 18 = 36.5 "нс" $
== Вывод
При выполнении задания 2 был изучен пирамидальный дешифратор, посчитаны задержки и выявлены отличия от линейного дешифратора.
= Задание 3: Наращивание сложного DC 5-32 на DC 2-4
== Таблица переходов
#align(center)[
#tablex(
columns: 16,
inset: 6pt,
align: center + horizon,
[$E_n$],[$x_16$],[$x_8$],[$x_4$],[$x_2$],[$x_1$],[$y_0$],[$y_1$],[$y_2$],[$y_3$],[$y_4$], [$y_5$], [$y_6$], [$...$],[$y_30$],[$y_31$],
[$0$],[$✘$],[$✘$],[$✘$],[$✘$],[$✘$],[$1$],[$0$],[$0$],[$0$],[$0$],[$0$],[$0$],[$...$],[$0$],[$0$],
[$1$],[$0$],[$0$],[$0$],[$0$],[$0$],[$0$],[$1$],[$0$],[$0$],[$0$],[$0$],[$0$],[$...$],[$0$],[$0$],
[$1$],[$0$],[$0$],[$0$],[$0$],[$1$],[$0$],[$0$],[$1$],[$0$],[$0$],[$0$],[$0$],[$...$],[$0$],[$0$],
[$1$],[$0$],[$0$],[$0$],[$1$],[$0$],[$0$],[$0$],[$0$],[$1$],[$0$],[$0$],[$0$],[$...$],[$0$],[$0$],
[$1$],[$0$],[$0$],[$0$],[$1$],[$1$],[$0$],[$0$],[$0$],[$0$],[$1$],[$0$],[$0$],[$...$],[$0$],[$0$],
[$1$],[$0$],[$0$],[$1$],[$0$],[$0$],[$0$],[$0$],[$0$],[$0$],[$0$],[$1$],[$0$],[$...$],[$0$],[$0$],
[$1$],[$0$],[$0$],[$1$],[$0$],[$1$],[$0$],[$0$],[$0$],[$0$],[$0$],[$0$],[$1$],[$...$],[$0$],[$0$],
[$...$],[$...$],[$...$],[$...$],[$...$],[$...$],[$...$],[$...$],[$...$],[$...$],[$...$],[$...$],[$...$],[$...$],[$...$],[$...$],
[$1$],[$1$],[$1$],[$1$],[$1$],[$0$],[$0$],[$0$],[$0$],[$0$],[$0$],[$0$],[$0$],[$...$],[$1$],[$0$],
[$1$],[$1$],[$1$],[$1$],[$1$],[$1$],[$0$],[$0$],[$0$],[$0$],[$0$],[$0$],[$0$],[$...$],[$0$],[$1$],
)
]
== Формулы
$ y_0 = xb_16 xb_8 xb_4 xb_2 xb_1\
y_1 = xb_16 xb_8 xb_4 xb_2 x_1\
y_2 = xb_16 xb_8 xb_4 x_2 xb_1\
y_3 = xb_16 xb_8 xb_4 x_2 x_1\
y_4 = xb_16 xb_8 x_4 xb_2 xb_1\
y_5 = xb_16 xb_8 x_4 xb_2 x_1\
y_6 = xb_16 xb_8 x_4 x_2 xb_1\
y_7 = xb_16 xb_8 x_4 x_2 x_1\
y_8 = xb_16 x_8 xb_4 xb_2 xb_1\
y_9 = xb_16 x_8 xb_4 xb_2 x_1\
y_10 = xb_16 x_8 xb_4 x_2 xb_1\
y_11 = xb_16 x_8 xb_4 x_2 x_1\
y_12 = xb_16 x_8 x_4 xb_2 xb_1\
y_13 = xb_16 x_8 x_4 xb_2 x_1\
y_14 = xb_16 x_8 x_4 x_2 xb_1\
y_15 = xb_16 x_8 x_4 x_2 x_1 $
$ y_16 = x_16 xb_8 xb_4 xb_2 xb_1\
y_17 = x_16 xb_8 xb_4 xb_2 x_1\
y_18 = x_16 xb_8 xb_4 x_2 xb_1\
y_19 = x_16 xb_8 xb_4 x_2 x_1\
y_20 = x_16 xb_8 x_4 xb_2 xb_1\
y_21 = x_16 xb_8 x_4 xb_2 x_1\
y_22 = x_16 xb_8 x_4 x_2 xb_1\
y_23 = x_16 xb_8 x_4 x_2 x_1\
y_24 = x_16 x_8 xb_4 xb_2 xb_1\
y_25 = x_16 x_8 xb_4 xb_2 x_1\
y_26 = x_16 x_8 xb_4 x_2 xb_1\
y_27 = x_16 x_8 xb_4 x_2 x_1\
y_28 = x_16 x_8 x_4 xb_2 xb_1\
y_29 = x_16 x_8 x_4 xb_2 x_1\
y_30 = x_16 x_8 x_4 x_2 xb_1\
y_31 = x_16 x_8 x_4 x_2 x_1\ $
#pagebreak()
== Схема
#img(image("1 5.png", width:107%), [Схема дешифратора 5-32])
== Временная диаграмма
#img(image("1 6.png", width:80%), [Временная диаграмма нескольких выходов дешифратора 5-32])
== Практическая и теоретические задержки
Практические задержки 60нс.
Теоретически задержки могут возникать в дешифраторах и инверторах.
$ t_"74LS139D" = 22 "нс" $
$ t_"7404N" = 12 "нс" $
$ T = 3 * t_"деш" + 2 * t_"инв" = 3 * 22 + 2 * 12 = 90 "нс" $
== Вывод
Были изучены принципы синтеза сложного дешифратора на основе простого.
= Задание 4: Синтез шифратора CD 8-3
== Таблица переходов
#align(center)[
#tablex(
columns: 11,
inset: 10pt,
align: center + horizon,
[$x_0$],[$x_1$],[$x_2$],[$x_3$],[$x_4$],[$x_5$],[$x_6$],[$x_7$],[$y_4$],[$y_2$],[$y_1$],
[$1$],[$0$],[$0$],[$0$],[$0$],[$0$],[$0$],[$0$],[$0$],[$0$],[$0$],
[$0$],[$1$],[$0$],[$0$],[$0$],[$0$],[$0$],[$0$],[$0$],[$0$],[$1$],
[$0$],[$0$],[$1$],[$0$],[$0$],[$0$],[$0$],[$0$],[$0$],[$1$],[$0$],
[$0$],[$0$],[$0$],[$1$],[$0$],[$0$],[$0$],[$0$],[$0$],[$1$],[$1$],
[$0$],[$0$],[$0$],[$0$],[$1$],[$0$],[$0$],[$0$],[$1$],[$0$],[$0$],
[$0$],[$0$],[$0$],[$0$],[$0$],[$1$],[$0$],[$0$],[$1$],[$0$],[$1$],
[$0$],[$0$],[$0$],[$0$],[$0$],[$0$],[$1$],[$0$],[$1$],[$1$],[$0$],
[$0$],[$0$],[$0$],[$0$],[$0$],[$0$],[$0$],[$1$],[$1$],[$1$],[$1$],
)
]
== Формулы
$ y_4 = x_4 or x_5 or x_6 or x_7\
y_2 = x_2 or x_3 or x_6 or x_7\
y_1 = x_1 or x_3 or x_5 or x_7\
$
#pagebreak()
== Схема
#img(image("1 7.png", width:80%), [Схема шифратора 8-3])
== Временная диаграмма
#img(image("1 8.png", width:70%), [Временная диаграмма шифратора 8-3])
== Практические и теоретические задержки
Практические задержки 10нс.
Теоретически задержки могут возникать только на дизъюнкторах.
$ t_"74S32D" = 10 "нс" $
$ T = 2*t_"диз" = 20 "нс" $
== Вывод
Был изучен принцип шифратора, построена схема CD 8-3 и посчитаны его задержки.
= Задание 5: Наращивание сложного шифратора 64-6 на CD 8-3
== Таблица переходов
#align(center)[
#tablex(
columns: 16,
inset: 6pt,
align: center + horizon,
[$x_0$],[$x_1$],[$x_2$],[$x_3$],[$x_4$], [$x_5$], [$x_6$], [$...$],[$x_62$],[$x_63$],[$y_32$],[$y_16$],[$y_8$],[$y_4$],[$y_2$],[$y_1$],
[$1$],[$0$],[$0$],[$0$],[$0$],[$0$],[$0$],[$...$],[$0$],[$0$],[$0$],[$0$],[$0$],[$0$],[$0$],[$0$],
[$0$],[$1$],[$0$],[$0$],[$0$],[$0$],[$0$],[$...$],[$0$],[$0$],[$0$],[$0$],[$0$],[$0$],[$0$],[$1$],
[$0$],[$0$],[$1$],[$0$],[$0$],[$0$],[$0$],[$...$],[$0$],[$0$],[$0$],[$0$],[$0$],[$0$],[$1$],[$0$],
[$0$],[$0$],[$0$],[$1$],[$0$],[$0$],[$0$],[$...$],[$0$],[$0$],[$0$],[$0$],[$0$],[$0$],[$1$],[$1$],
[$0$],[$0$],[$0$],[$0$],[$1$],[$0$],[$0$],[$...$],[$0$],[$0$],[$0$],[$0$],[$0$],[$1$],[$0$],[$0$],
[$0$],[$0$],[$0$],[$0$],[$0$],[$1$],[$0$],[$...$],[$0$],[$0$],[$0$],[$0$],[$0$],[$1$],[$0$],[$1$],
[$0$],[$0$],[$0$],[$0$],[$0$],[$0$],[$1$],[$...$],[$0$],[$0$],[$0$],[$0$],[$0$],[$1$],[$1$],[$0$],
[$...$],[$...$],[$...$],[$...$],[$...$],[$...$],[$...$],[$...$],[$...$],[$...$],[$...$],[$...$],[$...$],[$...$],[$...$],[$...$],
[$0$],[$0$],[$0$],[$0$],[$0$],[$0$],[$0$],[$...$],[$1$],[$0$],[$1$],[$1$],[$1$],[$1$],[$1$],[$0$],
[$0$],[$0$],[$0$],[$0$],[$0$],[$0$],[$0$],[$...$],[$0$],[$1$],[$1$],[$1$],[$1$],[$1$],[$1$],[$1$],
)
]
== Формулы
$
y_6 = x_32 or x_33 or x_34 or x_35 or x_36 or x_37 or\
or x_38 or x_39 or x_40 or x_41 or x_42 or\
or x_43 or x_44 or x_45 or x_46 or x_47 or\
or x_48 or x_49 or x_50 or x_51 or x_52 or\
or x_53 or x_54 or x_55 or x_56 or x_57 or\
or x_58 or x_59 or x_60 or x_61 or x_62 or x_63
$
$
y_5 = x_16 or x_17 or x_18 or x_19 or x_20 or x_21 or\
or x_22 or x_23 or x_24 or x_25 or x_26 or\
or x_27 or x_28 or x_29 or x_30 or x_31 or\
or x_48 or x_49 or x_50 or x_51 or x_52 or\
or x_53 or x_54 or x_55 or x_56 or x_57 or\
or x_58 or x_59 or x_60 or x_61 or x_62 or x_63
$
$
y_4 = x_8 or x_9 or x_10 or x_11 or x_12 or x_13 or\
or x_14 or x_15 or x_24 or x_25 or x_26 or\
or x_27 or x_28 or x_29 or x_30 or x_31 or\
or x_40 or x_41 or x_42 or x_43 or x_44 or\
or x_45 or x_46 or x_47 or x_56 or x_57 or\
or x_58 or x_59 or x_60 or x_61 or x_62 or x_63
$
$
y_3 = x_4 or x_5 or x_6 or x_7 or x_12 or x_13 or\
or x_14 or x_15 or x_20 or x_21 or x_22 or\
or x_23 or x_28 or x_29 or x_30 or x_31 or\
or x_36 or x_37 or x_38 or x_39 or x_44 or\
or x_45 or x_46 or x_47 or x_52 or x_53 or\
or x_54 or x_55 or x_60 or x_61 or x_62 or x_63
$
$
y_2 = x_2 or x_3 or x_6 or x_7 or x_10 or x_11 or\
or x_14 or x_15 or x_18 or x_19 or x_22 or\
or x_23 or x_26 or x_27 or x_30 or x_31 or\
or x_34 or x_35 or x_38 or x_39 or x_42 or\
or x_43 or x_46 or x_47 or x_50 or x_51 or\
or x_54 or x_55 or x_58 or x_59 or x_62 or x_63
$
$
y_1 = x_1 or x_3 or x_5 or x_7 or x_9 or x_11 or\
or x_13 or x_15 or x_17 or x_19 or x_21 or\
or x_23 or x_25 or x_27 or x_29 or x_31 or\
or x_33 or x_35 or x_37 or x_39 or x_41 or\
or x_43 or x_45 or x_47 or x_49 or x_51 or\
or x_53 or x_55 or x_57 or x_59 or x_61 or x_63
$
#pagebreak()
== Схема
#img(image("1 9.png", width:95%), [Схема шифратора 64-6])
== Временная диаграмма
#img(image("1 10.png", width:80%), [Временная диаграмма для нескольких входов шифратора 64-6])
== Практические и теоретические задержки
Практические задержки 68нс.
Теоретически задержки могут возникать на инверторах, шифраторах и конъюнкторах.
$ t_"74LS04N" = 12 "нс" $
$ t_"74148N" = 22 "нс" $
$ t_"7430N" = 13 "нс" $
$ T = 2* t_"инв" +2*t_"шиф" + t_"кон" = 2*12 + 2*22 + 13 = 81 "нс" $
== Вывод
Был получен шифратор 64-6 на основе простейшего шифратора, посчитаны задержки.
|
|
https://github.com/NurRobin/ReTypst | https://raw.githubusercontent.com/NurRobin/ReTypst/main/README.md | markdown | Apache License 2.0 | # ReTypst
ReTypst is a web-based Typst editor designed for real-time editing and viewing of Typst documents. It provides a collaborative environment where multiple users can work on Typst documents simultaneously.
## Key Features
- **Real-time Collaboration**: Multiple users can edit the same document simultaneously with changes reflected in real-time.
- **Typst Document Editing**: Full-featured editor for creating and modifying Typst documents.
- **PDF Generation**: Compile Typst documents into PDF format for easy sharing and printing.
- **Document Management**: Save and load Typst documents from the server.
- **Asset Handling**: Manage assets such as images and bibliographies within your documents.
## API Endpoints
### Files
- **Create File**: `/api/v1/files/create/file`
- **Create Folder**: `/api/v1/files/create/folder`
- **Fetch Files**: `/api/v1/files/fetch`
- **Save File**: `/api/v1/files/save`
### Projects
- **Create Project**: `/api/v1/projects/create`
- **Fetch Project Files**: `/api/v1/projects/files`
- **List Projects**: `/api/v1/projects/list`
### Typst
- **Compile Typst File**: `/api/v1/typst/compile`
- **Watch Typst File**: `/api/v1/typst/watch`
## Getting Started
To get started with ReTypst, follow these steps:
1. **Install Dependencies**:
```bash
npm install
```
2. **Run the Development Server**:
```bash
npm run dev
```
3. **Open the Application**:
Open [http://localhost:3000](http://localhost:3000) in your browser to start using ReTypst.
## Project Structure
- **app/**: Contains the main application files.
- **api/**: API routes for fetching, saving, and compiling Typst documents.
- **editor/**: Editor components and pages.
- `layout.tsx`: Layout component for the application.
- `page.tsx`: Main page component.
- **documents/**: Contains Typst documents and related assets.
- `*.typ`: Typst document files.
- **public/**: Public assets.
- **.next/**: Next.js build output.
- **.eslintrc.json**: ESLint configuration.
- **next-env.d.ts**: TypeScript environment configuration.
- **next.config.mjs**: Next.js configuration.
- **postcss.config.mjs**: PostCSS configuration.
- **tailwind.config.ts**: Tailwind CSS configuration.
- **tsconfig.json**: TypeScript configuration.
- **package.json**: Project dependencies and scripts.
## Learn More
For more information about Typst and its capabilities, visit the [Typst documentation](https://typst.app/docs/).
Feel free to contribute to the project by submitting issues or pull requests on the [GitHub repository](https://github.com/NurRobin/retypst).
|
https://github.com/antran22/typst-cv-builder | https://raw.githubusercontent.com/antran22/typst-cv-builder/main/lib/common.typ | typst | MIT License | #import "@preview/fontawesome:0.1.0": *
#import "@preview/linguify:0.4.0": *
// const color
#let color-darknight = rgb("#131A28")
#let color-darkgray = rgb("#333333")
#let color-gray = rgb("#5d5d5d")
#let accent-color = rgb("#262F99")
#let text-font = "IBM Plex Sans"
#let display-font = "IBM Plex Sans"
// const icons
#let ICONS = (
github: box(fa-icon("github", fa-set: "Brands", fill: color-darknight)),
ycombinator: box(fa-icon("hacker-news", font: "Font Awesome 6 Brands", fill: color-darknight)),
linkedin: box(fa-icon("linkedin", fa-set: "Brands", fill: color-darknight)),
phone: box(fa-icon("phone", font: "Font Awesome 6 Pro Solid")),
email: box(fa-icon("envelope", font: "Font Awesome 6 Pro Solid", fill: color-darknight)),
location: box(fa-icon("location-dot", font: "Font Awesome 6 Pro Solid", fill: color-darknight)),
)
/// Helpers
// layout utility
#let __justify_align(left_body, right_body) = {
block[
#left_body
#box(width: 1fr)[
#align(right)[
#right_body
]
]
]
}
#let __justify_align_3(left_body, mid_body, right_body) = {
block[
#box(width: 1fr)[
#align(left)[
#left_body
]
]
#box(width: 1fr)[
#align(center)[
#mid_body
]
]
#box(width: 1fr)[
#align(right)[
#right_body
]
]
]
}
/// Show a link with an icon, specifically for Github projects
/// *Example*
/// #example(`resume.github-link("DeveloperPaul123/awesome-resume")`)
/// - github-path (string): The path to the Github project (e.g. "DeveloperPaul123/awesome-resume")
/// -> none
#let github-link(github-path) = {
set box(height: 11pt)
align(right + horizon)[
#ICONS.github #link(
"https://github.com/" + github-path,
github-path,
)
]
}
/// Right section for the justified headers
/// - body (content): The body of the right header
#let secondary-right-header(body) = {
set text(
size: 11pt,
weight: "medium",
)
body
}
/// Right section of a tertiaty headers.
/// - body (content): The body of the right header
#let tertiary-right-header(body) = {
set text(
weight: "light",
size: 9pt,
)
body
}
/// Justified header that takes a primary section and a secondary section. The primary section is on the left and the secondary section is on the right.
/// - primary (content): The primary section of the header
/// - secondary (content): The secondary section of the header
#let justified-header(primary, secondary) = {
set block(
above: 0.7em,
below: 0.7em,
)
pad[
#__justify_align[
== #primary
][
#secondary-right-header[#secondary]
]
]
}
/// Justified header that takes a primary section and a secondary section. The primary section is on the left and the secondary section is on the right. This is a smaller header compared to the `justified-header`.
/// - primary (content): The primary section of the header
/// - secondary (content): The secondary section of the header
#let secondary-justified-header(primary, secondary) = {
__justify_align[
=== #primary
][
#tertiary-right-header[#secondary]
]
}
/// --- End of Helpers
|
https://github.com/lucafluri/typst-templates | https://raw.githubusercontent.com/lucafluri/typst-templates/master/IEEE/main.typ | typst | // Guide
// ===========
// Single line comment
/*
multiline comment
*/
/*
Highlight:
#hl("text")
OR for a block:
#hl()[
BLOCK OF TEXT or LIST or whatever
]
TODO
#todo("TODO_text")
*/
// Imports
#import "template.typ": *
// Definitions
#let hl(text) = {
highlight(text, fill: rgb(255, 255, 0))
}
#let todo(t) = {
highlight(text(fill: white, weight: "bold", t), fill: rgb(255, 0, 0))
}
// Call modified IEEE template
#show: ieee.with(
title: "Title",
abstract: [
Blablabla
//Linebreak needed for template
#linebreak()
],
//Non-Anonymized Author Info
authors: (
(
name: "<NAME>",
department: [Institute for Interactive Technologies],
organization: [University of Applied Sciences and Arts Northwestern Switzerland],
location: [Windisch, Switzerland],
email: "<EMAIL>"
),
(
name: "<NAME>",
department: [Institute for Interactive Technologies],
organization: [University of Applied Sciences and Arts Northwestern Switzerland],
location: [Windisch, Switzerland],
email: "<EMAIL>"
),
),
index-terms: ("Point Clouds", "Data Selection", "Exploratory Data Analysis", "XR", "Hand-tracking"),
bibliography-file: "refs.bib",
//Optional header image
/*header-image: figure(
image("figures/header_image.png", width: 60%),
caption: "A box shaped selection volume being placed inside a point cloud. Points inside the selection volume are highlighted in real-time."
)
*/
)
= Introduction <chapter_intro>
= Related Work <chapter_related_work>
= Our Prototype
= User Experiment
= Results <chapter_results>
= Discussion
= Conclusion and outlook
|
|
https://github.com/EunTilofy/Compiler2024 | https://raw.githubusercontent.com/EunTilofy/Compiler2024/main/hw/template.typ | typst | #let font_song = ("New Computer Modern", "Simsun", "STSong", "Source Han Serif SC")
#let font_fangsong = ("FangSong", "STFangSong")
#let font_hei = ("Source Han Sans SC", "Source Han Sans HW SC", "SimHei", "Microsoft YaHei", "STHeiti")
#let font_kai = ("KaiTi_GB2312", "KaiTi", "STKaiti")
#let definition_counter = state("definition_counter", 0)
#let theorem_counter = state("theorem_counter", 0)
#let problem_counter = state("problem_counter", 0)
#let page_num = 0
#let fake_par = [#text()[#v(0pt, weak: true)];#text()[#h(0em)]]
#let project(course: "", title: "", date: none,
authors: "<NAME>", footer: "<EMAIL>)", has_cover: true,
body) = {
// 文档基本信息
set document(author: "张志心", title: title)
set page(
paper: "a4",
margin: (left: 20mm, right: 20mm, top: 30mm, bottom: 30mm),
numbering: "1",
number-align: center
)
// show page: it => [
// #page_num = #page_num + 1
// ]
// 页眉
set page(
header: locate(loc => {
if (counter(page).at(loc).at(0) > 1 or has_cover == false) {
set text(font: font_song, 10pt, baseline: 8pt, spacing: 2pt)
grid(
columns: (1fr, 1fr, 1fr),
align(left, title),
align(center, authors),
align(right, date),
)
line(length: 100%, stroke: 0.5pt)
}
}))
// ..(if counter(page).at() > 1 {
// (header: {
// set text(font: font_song, 10pt, baseline: 8pt, spacing: 2pt)
// grid(
// columns: (1fr, 1fr, 1fr),
// align(left, course),
// align(center, title),
// align(right, date),
// )
// line(length: 100%, stroke: 0.5pt)
// })
// }))
// 页脚
set page(
footer: {
set text(font: font_song, 10pt, baseline: 8pt, spacing: 3pt)
set align(center)
grid(
columns: (1fr, 1fr),
align(left, footer),
align(right, counter(page).display("1")),
)
}
)
set text(font: font_song, lang: "zh", size: 10pt)
show math.equation: set text(weight: 400)
// Set paragraph spacing.
show par: set block(above: 1.2em, below: 1.2em)
set heading(numbering: "1.1")
set par(leading: 0.75em)
// Title row.
align(center)[
#block(text(font: font_song, weight: 1000, lang: "en", 1.5em, [#title]))
#v(1.1em, weak: true)
]
// Author information and date
pad(
top: 0.5em,
bottom: 0.8em,
align(center)[
#block(text(font: font_song, weight: "semibold", 1.1em, authors))
// #v(1.1em, weak: true)
// #block(text(font: font_fangsong, weight: "regular", 1.1em, date))
]
)
// Main body.
set par(justify: true)
show "。": "."
show heading.where(level: 1): it => [
#definition_counter.update(x => 0)
#theorem_counter.update(x => 0)
#it
]
show heading.where(level: 2): it => [
#theorem_counter.update(x => 0)
#it
]
set par(first-line-indent: 2em)
show heading: it => {text()[#v(1.7em, weak: true)];it;fake_par}
show raw.where(block: true): block.with(
width: 100%,
stroke: 0.5pt + luma(200),
radius: 4pt,
inset: 8pt,
fill: luma(250)
)
body
}
#let def(x) = { text("【" + x + "】", weight: "bold") }
#let deft(x) = { text("【" + x + "】", weight: "bold", fill: rgb("#FFFFFF")) }
#let bold(x) = { text(x, weight: "bold") }
#let badge(content, fill: rgb("#000000")) = box(
fill: fill,
radius: 4pt,
inset: 1pt,
outset: 3pt,
text(
content,
weight: "bold",
size: 10pt,
fill: rgb("#ffffff")
)
)
#let ac = badge("Correct", fill: rgb("#25ad40"))
#let pc = badge("Partially Correct", fill: rgb("#01bab2"))
#let wa = badge("Wrong Answer", fill: rgb("#ff4f4f"))
#let un = badge("Unknown", fill: rgb("#5c5c5c"))
#import "@preview/physica:0.9.1": *
#let dp = math.display
#let sp = math.space
#let eps = math.epsilon
#let sim = "~ "
#let st = "s.t. "
#let cond = "cond"
#let other = "othwerwise"
#let kk = " "
#let pm = math.plus.minus
#let mp = math.minus.plus
#let dx = math.upright("d") + math.italic("x")
#let dy = math.upright("d") + math.italic("y")
#let dt = math.upright("d") + math.italic("t")
#let du = math.upright("d") + math.italic("u")
#let dv = math.upright("d") + math.italic("v")
#let ds = math.upright("d") + math.italic("s")
#let dz = math.upright("d") + math.italic("z")
#let Dx = math.Delta + math.italic("x")
#let Dy = math.Delta + math.italic("y")
#let Dt = math.Delta + math.italic("t")
#let Du = math.Delta + math.italic("u")
#let Dv = math.Delta + math.italic("v")
#let ddy = math.attach(math.upright("d"), tr: "2") + math.italic("y")
#let dddy = math.attach(math.upright("d"), tr: "3") + math.italic("y")
#let dny = math.attach(math.upright("d"), tr: "n") + math.italic("y")
#let hat(x) = vu(x)
#let arr(x) = va(x)
#let am = vb("a")
#let bm = vb("b")
#let um = vb("u")
#let vm = vb("v")
#let xm = vb("x")
#let ym = vb("y")
#let zm = vb("z")
#let Xm = vb("X")
#let Ym = vb("Y")
#let Zm = vb("Z")
#let Am = vb("A")
#let leq = math.lt.eq
#let geq = math.gt.eq
#let langle = math.angle.l
#let rangle = math.angle.r
#let varphi = math.phi.alt
#let BB(i) = math.bb(i)
#let emptyset = math.nothing
#let CAL(i) = math.cal(i)
#let bmatrix(..args) = math.mat(delim: "[", ..args)
#let infty = math.oo
#let bvec(..args) = math.vec(delim: "[", ..args)
#let CPP = raw.with(lang: "cpp")
#let dfrac(a, b) = $display(frac(#a, #b))$
#let arccot = math.op("arccot")
// add math opts
#show math.attach: it => {
import math: *
if it.has("b") and it.b.func() != upright[].func() and it.b.has("text") and it.b.text.len() == 1 {
let args = it.fields()
let _ = args.remove("base")
let _ = args.remove("b")
attach(it.base, b: upright(it.b), ..args)
} else {
it
}
}
#let song(it) = text(it, font: font_song)
#let fangsong(it) = text(it, font: font_fangsong)
#let hei(it) = text(it, font: font_hei)
#let kai(it) = text(it, font: font_kai)
#let bold = (it) => [#strong[#it]]
#let definition(it) = {block(width: 100%)[
// #definition_counter.update(x => (x + 1))
#theorem_counter.update(x => (x + 1))
#strong[
#hei[定义]#locate(loc => [#counter(heading).at(loc).at(0)]).#theorem_counter.display()
// #hei[定义]#locate(loc => [#counter(heading).at(loc).at(0)]).#definition_counter.display()
]
#math.space#it
];fake_par}
#let theorem(it, name: "", tag: "定理") = {block(width: 100%)[
#theorem_counter.update(x => (x + 1))
#strong[
// #hei[#tag]#locate(loc => [#counter(heading).at(loc).at(0).#counter(heading).at(loc).at(1)]).
#hei[#tag]#locate(loc => [#counter(heading).at(loc).at(0)]).#theorem_counter.display()
]
#if (name != "") [(#kai[#name])]
#math.space#it
];fake_par}
#let lemma(it, name: "") = theorem(it, name: name, tag: "引理")
#let corollary(it, name: "") = theorem(it, name: name, tag: "推论")
#let property(it, name: "") = theorem(it, name: name, tag: "性质")
#let conclusion(it, name: "") = theorem(it, name: name, tag: "结论")
#let Remark(it, name: "") = theorem(it, name: name, tag: "注解")
#let problem(it, name: "") = {block(width: 100%)[
#problem_counter.update(x => (x + 1))
#strong[
#hei[例]#problem_counter.display()
]
#if (name != "") [(#kai[#name])]
#math.space#it
];fake_par}
#let solution(it, tag: "解") = {block(width: 100%)[
#strong[#hei[#tag:]]
#math.space#it
#place(
right + bottom,
float: true,
clearance: 6pt,
[□]
)
];fake_par}
#let Proof(it, tag: "证明") = {block(width: 100%)[
#strong[#hei[#tag:]]
#math.space#it
#place(
right + bottom,
float: true,
clearance: 6pt,
[□]
)
];fake_par}
#let HWProb(it, name: "", color : black) = {block(
below: 1em, stroke: 0.5pt + color, radius: 3pt,
width: 100%, inset: 7pt)[
#if (name != "") [
#set text(font: "Noto Sans", fill: color)
#strong[#name]
]
#let fontcolor = color.darken(20%)
#set text(fill: fontcolor)
#set par(first-line-indent: 0em)
#it
];fake_par}
#let named_block(it, name: "", color: red, inset: 11pt) = {block(
below: 1em, stroke: 0.5pt + color, radius: 3pt,
width: 100%, inset: inset
)[
#place(
top + left,
dy: -6pt - inset, // Account for inset of block
dx: 8pt - inset,
block(fill: white, inset: 2pt)[
#set text(font: "Noto Sans", fill: color)
#strong[#name]
]
)
#let fontcolor = color.darken(20%)
#set text(fill: fontcolor)
#set par(first-line-indent: 0em)
#it
];fake_par}
#let example(it) = named_block(it, name: "Example", color: gray.darken(60%))
#let proof(it) = named_block(it, name: "Proof", color: rgb(120, 120, 120))
#let abstract(it) = named_block(it, name: "Abstract", color: rgb(0, 133, 143))
#let summary(it) = named_block(it, name: "Summary", color: rgb(0, 133, 143))
#let info(it) = named_block(it, name: "Info", color: rgb(68, 115, 218))
#let note(it) = named_block(it, name: "Note", color: rgb(68, 115, 218))
#let tip(it) = named_block(it, name: "Tip", color: rgb(0, 133, 91))
#let hint(it) = named_block(it, name: "Hint", color: rgb(0, 133, 91))
#let success(it) = named_block(it, name: "Success", color: rgb(62, 138, 0))
#let help(it) = named_block(it, name: "Help", color: rgb(153, 110, 36))
#let warning(it) = named_block(it, name: "Warning", color: rgb(184, 95, 0))
#let attention(it) = named_block(it, name: "Attention", color: rgb(216, 58, 49))
#let caution(it) = named_block(it, name: "Caution", color: rgb(216, 58, 49))
#let failure(it) = named_block(it, name: "Failure", color: rgb(216, 58, 49))
#let danger(it) = named_block(it, name: "Danger", color: rgb(216, 58, 49))
#let error(it) = named_block(it, name: "Error", color: rgb(216, 58, 49))
#let bug(it) = named_block(it, name: "Bug", color: rgb(204, 51, 153))
#let quote(it) = named_block(it, name: "Quote", color: rgb(132, 90, 231))
#let cite(it) = blockx(it, name: "Cite", color: rgb(132, 90, 231))
#let experiment(it) = named_block(it, name: "Experiment", color: rgb(132, 90, 231))
#let question(it) = nanamed_block(it, name: "Question", color: rgb(132, 90, 231))
#let analysis(it) = named_block(it, name: "Analysis", color: rgb(0, 133, 91))
#let mycite(it) = named_block(it, name: "Cite", color: rgb(132, 90, 231))
#let prob(it) = named_block(it, name: "Problem", color: luma(100))
#let Box(it, name : "") = named_block(it, name : name, color : black)
// Enum
// #block[
// #set enum(numbering: "1.a)") ]
// Fixed height vector
#let fvec(..children, delim: "(", gap: 1.5em) = { // change default gap there
style(styles =>
math.vec(
delim: delim,
gap: 0em,
..for el in children.pos() {
({
box(
width: measure(el, styles).width,
height: gap, place(horizon, el)
)
},) // this is an array
// `for` merges all these arrays, then we pass it to arguments
}
)
)
}
// fixed hight matrix
// accepts also row-gap, column-gap and gap
#let fmat(..rows, delim: "(", augment: none) = {
let args = rows.named()
let (gap, row-gap, column-gap) = (none,)*3;
if "gap" in args {
gap = args.at("gap")
row-gap = args.at("row-gap", default: gap)
column-gap = args.at("row-gap", default: gap)
}
else {
// change default vertical there
row-gap = args.at("row-gap", default: 1.5em)
// and horizontal there
column-gap = rows.named().at("column-gap", default: 0.5em)
}
style(styles =>
math.mat(
delim: delim,
row-gap: 0em,
column-gap: column-gap,
..for row in rows.pos() {
(for el in row {
({
box(
width: measure(el, styles).width,
height: row-gap, place(horizon, el)
)
},)
}, )
}
)
)
}
#import "@preview/codelst:2.0.0": sourcecode
#let mycode(it, size : 1em, lang: "cpp") = block[
#set text(size: size)
#sourcecode(it)
];
// uasge -> mycode
// #block[
// #set text(size : 12pt)
// #sourcecode[
// ```cpp
// ```
// ]
// ];
#let codex(code, lang: none, size: 1em, border: true) = {
if code.len() > 0 {
if code.ends-with("\n") {
code = code.slice(0, code.len() - 1)
}
} else {
code = "// no code"
}
set text(size: size)
align(left)[
#if border == true {
block(
width: 100%,
stroke: 0.5pt + luma(150),
radius: 4pt,
inset: 8pt,
)[
#raw(lang: lang, block: true, code)
]
} else {
raw(lang: lang, block: true, code)
}
]
}
#let importCode(file, namespace: none, lang: "cpp") = {
let source_code = read(file)
let code = ""
let note = ""
let flag = false
let firstlines = true
for line in source_code.split("\n") {
if namespace != none and line == ("} // namespace " + namespace) {
flag = false
}
if namespace == none or flag {
if firstlines and line.starts-with("// ") {
note += line.slice(3) + "\n"
} else {
code += line + "\n"
firstlines = false
}
}
if namespace != none and line == ("namespace " + namespace + " {") {
flag = true
}
}
if note.len() > 0 {
block(note)
}
codex(code, lang: lang, size: 1.05em)
}
#let bib_cite(..names) = {
for name in names.pos() {
cite(name)
}
}
#let references(path) = {
set heading(level: 1, numbering: none)
set par(justify: false, leading: 1.24em, first-line-indent: 2em)
bibliography(path, title:"参考文献")
}
#import "@preview/tablex:0.0.6": tablex, hlinex
#import "@preview/tablem:0.1.0": tablem
#let three-line-table = tablem.with(
render: (columns: auto, ..args) => {
tablex(
columns: columns,
auto-lines: false,
align: center + horizon,
hlinex(y: 0),
hlinex(y: 1),
..args,
hlinex(),
)
}
)
#show figure.caption: it => {
layout(size => style(styles => [
#let text-size = measure(
it.supplement + it.separator + it.body,
styles,
)
#let my-align
#if text-size.width < size.width {
my-align = center
} else {
my-align = left
}
#align(my-align, it)
]))
}
#import "@preview/tablex:0.0.8": tablex, gridx, hlinex, vlinex, colspanx, rowspanx
#let figurex(
img,
caption,
) = {
show figure.caption: it => {
set text(size: 0.9em, fill: luma(100), weight: 700)
it
v(0.1em)
}
set figure.caption(separator: ":")
figure(
img,
caption: [
#set text(weight: 400)
#caption
]
)
} |
|
https://github.com/ymgyt/techbook | https://raw.githubusercontent.com/ymgyt/techbook/master/programmings/typst/polylux.md | markdown | # polylux
typstのslide用package
```typst
#import "@preview/polylux:0.3.1": *
#import themes.bipartite: *
#show: bipartite-theme.with(aspect-ratio: "16-9")
#set text(
size: 25pt,
font: (
"Noto Sans CJK JP",
// "Noto Color Emoji",
// "JetBrainsMono Nerd Font",
))
#title-slide(
title: [TUIのFeed Viewerを自宅サーバーで公開するまで],
subtitle: [NixでRustの開発環境からCI,Deployまで管理する],
author: [<NAME>],
date: [2024-03-05],
)
#west-slide(title: "自己紹介")[
はじめまして
]
#east-slide(title: "概要")[
概要を書く
]
```
|
|
https://github.com/Nerixyz/icu-typ | https://raw.githubusercontent.com/Nerixyz/icu-typ/main/res/example.typ | typst | MIT License | #import "../api.typ": *
#import experimental: fmt-timezone, fmt-zoned-datetime
#set page(width: auto, height: auto, margin: 1em)
#set text(
font: (
"Linux Libertine",
"New Computer Modern",
"New Computer Modern Math",
"DejaVu Sans Mono",
"Noto Serif SC",
)
)
#let day = datetime(
year: 2024,
month: 5,
day: 31,
)
#let time = datetime(
hour: 18,
minute: 2,
second: 23,
)
#let dt = datetime(
year: 2024,
month: 5,
day: 31,
hour: 18,
minute: 2,
second: 23,
)
#let tz = (
offset: "-07",
iana: "America/Los_Angeles",
zone-variant: "st", // standard
)
= Date
#fmt-date(day, locale: "km", length: "full") \
#fmt-date(day, locale: "af", length: "full") \
#fmt-date(day, locale: "za", length: "full") \
= Time
#fmt-time(time, locale: "id", length: "medium") \
#fmt-time(time, locale: "en", length: "medium") \
#fmt-time(time, locale: "ga", length: "medium") \
= Date and Time
#fmt-datetime(dt, locale: "ru", date-length: "full") \
#fmt-datetime(dt, locale: "en-US", date-length: "full") \
#fmt-datetime(dt, locale: "zh-Hans-CN", date-length: "full") \
#fmt-datetime(dt, locale: "ar", date-length: "full") \
#fmt-datetime(dt, locale: "fi", date-length: "full")
= Timezone (experimental)
#fmt-timezone(
..tz,
local-date: datetime.today(),
format: "specific-non-location-long"
) \
#fmt-timezone(
..tz,
format: (
iso8601: (
format: "utc-extended",
minutes: "required",
seconds: "optional",
)
)
)
= Zoned Datetime (experimental)
#fmt-zoned-datetime(dt, tz) \
#fmt-zoned-datetime(dt, tz, locale: "lv") \
#fmt-zoned-datetime(dt, tz, locale: "en-CA-u-hc-h24-ca-buddhist") \
// the default undefined language
#assert.eq(
locale-info("und"),
(
id: (
language: "und",
script: none,
region: none,
variants: (),
),
extensions: (
unicode: (keywords: "", attributes: ()),
transform: (lang: none, fields: ""),
private: (),
other: (),
)
)
)
// full unicode language identifier
#assert.eq(
locale-info("en-arab-DE-posix-macos-u-foo-bar-hc-h12-ca-buddhist-t-en-latn-US-windows-rusty-h0-hybrid-a-other-ext-x-typst-wasm"),
(
id: (
language: "en",
script: "Arab",
region: "DE",
variants: ("macos", "posix"),
),
extensions: (
unicode: (
keywords: "ca-buddhist-hc-h12",
attributes: ("bar", "foo"),
),
transform: (
lang: (
language: "en",
script: "Latn",
region: "US",
variants: ("rusty", "windows"),
),
fields: "h0-hybrid",
),
private: ("typst", "wasm"),
other: ("a-other-ext",),
),
)
)
|
https://github.com/claudiomattera/typst-modern-cv | https://raw.githubusercontent.com/claudiomattera/typst-modern-cv/master/src/theme.typ | typst | MIT License | // Copyright <NAME> 2023-2024.
//
// Distributed under the MIT License.
// See accompanying file License.txt, or online at
// https://opensource.org/licenses/MIT
/// Create a default theme configuration
///
/// -> dictionary: A dictionary with the default theme.
#let default() = {
(
color: blue,
width: 2cm,
thickness: 1.5mm,
radius: 1pt,
style: "underline",
base_date: datetime(year: 2005, month: 1, day: 1),
current_date: datetime.today(),
)
}
#let state = state("timeline", default())
/// Update theme configuration
///
/// There are two supported styles: `underline` (default) and `lighten`.
/// `underline` shows timelines as coloured intervals above gray underlines, such as the original LaTeX package `moderntimeline`.
/// `lighten`, on the other hand, shows timelines as coloured intervals over full, lightened intervals.
///
/// Note: all arguments are optional, and their default value will be used if missing.
///
/// - color (color): The theme base color.
/// - width (length): The width of right bars and timelines.
/// - thickness (length): The thickness of right bars and timelines.
/// - radius (length): The radius of timelines.
/// - style (str): The theme style.
/// - base_date (datetime): The earliest date in all entries.
/// - current_date (datetime): The latest date in all entries.
/// -> dictionary: A dictionary with the default theme.
#let update(
color: none,
width: none,
thickness: none,
radius: none,
style: none,
base_date: none,
current_date: none,
) = {
context {
let state_value = state.get()
if color != none {
state_value.color = color
}
if width != none {
state_value.width = width
}
if thickness != none {
state_value.thickness = thickness
}
if radius != none {
state_value.radius = radius
}
if style != none {
state_value.style = style
}
if base_date != none {
state_value.base_date = base_date
}
if current_date != none {
state_value.current_date = current_date
}
state.update(state_value)
}
}
|
https://github.com/Pavanato/Prob-A2 | https://raw.githubusercontent.com/Pavanato/Prob-A2/main/provas.typ | typst | #import "theorems.typ": *
#show: thmrules.with(qed-symbol: $square$)
#set page(numbering: "1")
// #set page(margin: 1.5cm)
#set text(font: "Linux Libertine", lang: "pt")
#set heading(numbering: "1.")
#let theorem = thmbox("teorema", "Teorema", fill: rgb("#eeffee"))
#let corollary = thmbox(
"Corolário",
"Corolário",
base: "teorema",
fill: rgb("#f8e8e8"),
titlefmt: strong
)
#let definition = thmbox(
"definição",
"Definição",
// inset: (x: 1.2em, top: 1em),
fill: rgb("#e7e7e7")
)
#let example = thmplain("exemplo", "Exemplo").with(numbering: none)
#let proof = thmproof("prova", "Prova", titlefmt: strong)
#set heading(numbering: (..nums) => {
let (part, ..chapter_and_sections) = nums.pos()
if chapter_and_sections.len() == 0 {
[Capítulo #part.]
}
else {
let (section, ..subsections) = chapter_and_sections
if subsections.len() == 0 {
[Seção #part.#section.]
} else {
numbering("1.", part, section, ..subsections)
}
}
}
)
#let var = $op("Var")$
#context counter(heading).update(4)
=
#context counter(heading).update((5,3))
#theorem("Universalidade da Uniforme")[Seja $F$ uma CDF, uma função contínua e estritramente crescente no suporte da distribuição. Isto garante que a função inversa $F^(-1)$ existe e é única, onde $F^(-1): (0,1) -> RR$. Os seguintes resultados valem:
+ Seja $U tilde "Unif"(0,1)$ e $X = F^(-1)(U)$. Então, $X$ é uma v.a. com CDF $F$.
+ Seja $X$ uma v.a. com CDF $F$. Então, $F(X) tilde "Unif"(0,1)$.
]
#proof[
+ Tomando $X = F^(-1)(U)$, temos que $ P(X <= x) = P(F^(-1)(U) <= x) = P(U <= F(x)) = F(x). $
+ Seja $U = F(X)$, então $ P(U <= u) = P(F(X) <= u) = P(X <= F^(-1)(u)) = F(F^(-1)(u)) = u. $
]<universal>
#theorem("Propriedades da Normal", numbering: none)[Seja $Z ~ text(N)(0,1)$ com PDF $phi(z)$ e CDF $Phi(z)$. Então, as seguintes propriedades valem:
- Simetria: $phi(z) = phi(-z)$
- Simetria das caudas: $Phi(z) = 1 - Phi(-z)$
- Simetria entre Z e -Z: $Phi_(-Z)(z) = Phi_(Z)(z)$
]
#proof[
- A simetria é trivial, pois $phi(z) = (1/sqrt(2 pi))e^(-z^2/2) = (1/sqrt(2 pi))e^(-(-z)^2/2) = phi(-z)$.
- A simetria das caudas é dada por $Phi(z) = integral_(- infinity)^(z)phi(t) d t = integral_(- infinity)^(z)phi(-t)d t = - integral_(infinity)^(-z)phi(u)d u = integral_(-z)^(infinity)phi(u)d u =1 - integral_(-infinity)^(-z)phi(u)d u = 1 - Phi(-z)$.
- A simetria entre $Z$ e $-Z$ é dada por $Phi_(-Z)(z) = P(-Z <= z) = P(Z >= -z) = 1 - P(Z <= -z) = 1 - Phi(-z) = Phi(z)$.
]
#definition(number: "5.5.2", "Propriedade da não memória")[ Dizemos que uma v.a. $X$ tem a propriedade da não memória se, para todo $s, t > 0$, vale
$ P(X > s + t | X > s) = P(X > t) $
]
Note que se $X ~ text("Expo")(lambda) $, então $X$ tem a propriedade da não memória. Pois
$ P(X > s + t | X > s) = P((X > s + t) sect (X > s))/P(X > s) = P(X > s + t)/P(X > s) = e^(-lambda(s + t))/e^(-lambda s) = e^(-lambda t) = P(X > t) $
#theorem(number: "5.5.3")[Se $X$ é uma v.a. contínua positiva com a propriedade da não memória, então $X$ é uma v.a. exponencial.]
#proof(title: "Prova 1")[Seja $F$ a CDF de $X$ e $G(x) = P(X > x) = 1 - F(x)$. Pela propriedade da não memória, temos
$ G(s+t) = G(s)G(t) $
pois $G(s+t) = P(X > s + t) = P(X > s + t | X > s)P(X > s) = P(X > t)P(X > s) = G(t)G(s)$, a segunda igualdade decorre da lei da probabilidade total e de que $P(X > s + t | X <= s) = 0$. Diferenciando em relação a $s$, temos
$ G'(s + t) = G'(s)G(t) $
e quando $s = 0$
$ G'(t) = G'(0)G(t) $
resolvendo a equação diferencial, temos
$ G(t) = K e^(-lambda t) $
onde $lambda = -G'(0)$, e $K = G(0) = 1$. Portanto, $X ~ text("Expo")(lambda)$.]
#proof(title: "Prova 2")[Usando o resultado da *prova 1:* $G(s+t) = G(s)G(t)$, podemos mostrar que $G$ é uma função exponencial. Note que $G(0) = 1$, pois
$ G(0) = G(0 + 0) = G(0)G(0) = G(0)^2 $
E se $G(0) = 0$, então $G(t) = 0$ para todo $t$, o que é absurdo, pois $G(t) = P(X > t)$. Portanto, $G(0) = 1$. Podemos encontrar $G(2)$ da seguinte forma
$ G(2) = G(1 + 1) = G(1)G(1) = G(1)^2 $
De forma similar $G(3)$ é
$ G(3) = G(1 + 2) = G(1)G(2) = G(1)G(1)^2 = G(1)^3 $
podemos provar por indução que $G(n) = G(1)^n$, para $n$ inteiro positivo da seguinte forma
$ G(n) = G(1)^n $
$ G(n + 1) = G(n)G(1) = G(1)^n G(1) = G(1)^(n+1). $
Queremos estender essa propriedade para $n$ racional, para isso observe que
$ G(1) = G(underbrace(1/n + dots +1/n, "n termos")), $
então
$ G(1) = G(1/n)G(1/n) dots G(1/n) = G(1/n)^n $
e portanto
$ G(1/n) = G(1)^(1/n) $
e para $m$ inteiro positivo, temos
$ G(m/n) = G(underbrace(1/n + dots + 1/n, "m termos")) = G(1/n) dots G(1/n) = G(1/n)^m = G(1)^(m/n) $
A extensão para $x$ real positivo vem com a pré requesito de um entendimento de análise real, portanto não será feito aqui. Portanto, $G(x) = G(1)^x$. Por fim, observe que
$ G(x) = G(1)^x = e^(ln (G(1)^x)) = e^(x ln (G(1))) $
Chamando $lambda = - ln (G(1))$, temos que $G(x) = e^(-lambda x)$, ou seja, $X ~ text("Expo")(lambda)$.]
=
#theorem("Caiu no teste uma parte", number: "6.1.4")[Seja $X$ uma v.a. com média $mu$ e mediana $m$. Então
- O valor $c$ que minimiza $E(X - t)^2$ é $t = mu$.
- O valor $c$ que minimiza $E|X - t|$ é $t = m$.
]<test>
#proof[Seja $f(t) = E(X - t)^2 = E(X^2 - 2 X t + t^2) = E(X^2) - 2 t E(X) + t^2$. Derivando em relação a $t$, temos
$ f'(t) = -2 E(X) + 2 t $
e igualando a zero concluímos que
$ -2 E(X) + 2 t = 0 => t = E(X) = mu. $
E esse ponto é de mínimo, pois $f''(t) = 2 > 0$, ou por conta da função ser uma parábola para cima.
Já para $f(t) = E|X - t|$, não podemos derivar diretamente. Portanto, vamos provar que $E|X - t| >= E|X - m|$ para todo $t$. Podemos simplificar o problema da seguinte maneira
$ E|X - t| >= E|X - m| ==> E(|X - t| - |X - m|) >= 0. $
Assuma que $t > m$ (o caso $t < m$ é similar). Então, para $X <= m$ temos
$ |X - t| - |X - m| = -(X - t) -(m - X) = t - m, $
e se $X > m$ temos
$ |X - t| - |X - m| = X - t - (X - m) = m - t. $
Seja $Y = |X - t| - |X - m|$, então, pela lei da esperança total, temos
$ E(Y) &= E(Y | X <= m)P(X <= m) + E(Y | X > m)P(X > m) \
&= E(t - m | X <= m)P(X <= m) + E(m - t | X > m)P(X > m) \
&= (t - m)P(X <= m) + (m - t)P(X > m) \
&= (t - m)P(X <= m) - (t - m)(1 - P(X <= m)) \
&= 2(t - m)P(X <= m) - (t - m) = (t - m)(2P(X <= m) - 1).
$
Como $P(X <= m) >= 1/2$, temos que $2P(X <= m) - 1 >= 0$, e portanto $E(Y) >= 0$. Concluindo que $E|X - t| >= E|X - m|$ para todo $t$.]
=
#theorem(number: "7.1.20")[Seja $f_(x y)$ a PDF conjunta de $X$ e $Y$ tal que
$ f_(x y)(x,y) = g(x)h(y) $
para todo $x$ e $y$, onde $g(x)$ e $h(y)$ são funções não negativas. Então $X$ e $Y$ são independentes. Se $g$ ou $h$ for uma PDF válida, então a outra também é, e a PDF conjunta é o produto das marginais.
]
#proof[defina
$ c = integral_(- infinity)^(infinity)h(y)d y > 0 $
podemos reescrever a PDF conjunta como
$ f_(x y)(x,y) = g(x)h(y) = c g(x)(h(y))/c $
então a PDF marginal de $X$ é
$ f_X = integral_(- infinity)^(infinity)f_(x y)(x,y)d y = integral_(- infinity)^(infinity)c g(x)(h(y))/c d y = c g(x)integral_(- infinity)^(infinity)(h(y))/c d y = c g(x). $
Segue que $integral_(- infinity)^(infinity)g(x)d x = 1$ já que $f_X$ é uma PDF válida. Analogamente, $(h(y))/c$ é a PDf marginal de $Y$. Portanto, $c g(x)$ e $(h(y))/c$ são PDFs válidas, o que conclui que $X$ e $Y$ são independentes.]
#theorem("independente implica corr = 0", number: "7.3.2")[Sejam $X$ e $Y$ v.a. independentes. Então, $"corr"(X,Y) = 0$.]
#proof[Como a fórmula da correlação é
$ "corr"(X,Y) = "cov"(X,Y)/(sqrt("var"(X)"var"(Y))) $
Basta mostrar que a covariância é zero. Como $X$ e $Y$ são independentes, temos que
$ "cov"(X,Y) = E(X Y) - E(X)E(Y) = E(X)E(Y) - E(X)E(Y) = 0 $
e a prova de que $E(X Y) = E(X)E(Y)$ é, no caso contínuo,
$ E(X Y) &= integral_(- infinity)^(infinity)integral_(- infinity)^(infinity)x y f_(x y)(x,y)d x d y \ &= integral_(- infinity)^(infinity)integral_(- infinity)^(infinity)x y f_X(x)f_Y(y)d x d y \ &= integral_(- infinity)^(infinity)x f_X(x)d x integral_(- infinity)^(infinity)y f_Y(y)d y = E(X)E(Y) $
E no caso discreto
$ E(X Y) &= sum_(x)sum_(y)x y f_(x y)(x,y) \ &= sum_(x)sum_(y)x y f_X(x)f_Y(y) \ &= sum_(x)x f_X(x)sum_(y)y f_Y(y) = E(X)E(Y) $
]
*Observação:* A recíproca não é verdadeira, ou seja, $"corr"(X, Y) = 0$ não implica independência.
#theorem(number: "7.5.2")[Dentro de uma distribuição normal multivariada (MVN), não correlacionadas implica independência. Ou seja, se $bold(X) tilde (bold(X)_1, bold(X)_2)$, onde $bold(X)_1$ e $bold(X)_2$ são subvetores de $bold(X)$, e $"corr"(bold(X)_1, bold(X)_2) = 0$, então $bold(X)_1$ e $bold(X)_2$ são independentes.]
#proof[A prova será feita para o caso bivariado, onde a prova em maiores dimensões é análoga. Seja $bold(X) = (X, Y)$, onde $W = s X + t Y$ é uma normal univariada para todo $s, t$. Lembrando que a MGF de uma normal é
$ M_W (t_1, ..., t_n) = exp(t_1 E(X_1) + ... + t_k E(X_k) + 1/2 var(t_1 X_1 + ... + t_k X_k)) $
Então, a MGF de $W$ é
$ M_W (s, t) = exp(s E(X) + t E(Y) + 1/2 var(s X + t Y)) $
Chamando $E(X) = mu_X$, $E(Y) = mu_Y$, $var(X) = sigma_X^2$, $var(Y) = sigma_Y^2$ e $"corr"(X, Y) = rho$, temos
$ M_W (s, t) = exp(s mu_X + t mu_Y + 1/2 (s^2 sigma_X^2 + t^2 sigma_Y^2 + 2 s t rho)) $
Se $rho = 0$, então
$ M_W (s, t) &= exp(s mu_X + t mu_Y + 1/2 (s^2 sigma_X^2 + t^2 sigma_Y^2)) \ &=exp(s mu_X + 1/2 s^2 sigma_X^2) exp(t mu_Y + 1/2 t^2 sigma_Y^2) $
Porém isto é a MGF de $X$ e $Y$ separadamente, o que implica que $X$ e $Y$ são independentes. Portanto, $"corr"(X, Y) = 0$ implica independência (em multivariadas)]
=
#theorem("Convolução", number: "8.2.1")[ Sejam $X$ e $Y$ v.a.s independentes discretas, então a PMF da sua soma $T = X+Y$ é
$ P(T = t) = sum_x P(Y = t - x)P(X = x) $
$ P(T = t) = sum_y P(X = t - y)P(Y = y) $
E para o caso contínuo, a PDF da soma é
$ f_T(t) = integral_(- infinity)^(infinity)f_Y (t - x)f_X (x)d x $
$ f_T(t) = integral_(- infinity)^(infinity)f_X (t - y)f_Y (y)d y $
]
#proof[Para o caso discreto, temos
$ P(T = t) = P(X + Y = t) attach(=, t: "LOTP")& sum_(x)P(X + Y = t|X = x)P(X = x) \
=& sum_(x) P(Y = t - x|X=x)P(X = x) \
=& sum_(x)P(Y = t - x)P(X = x)
$
De forma análoga, pode-se provar para $P(T = t) = sum_y P(X = t - y)P(Y = y)$.
Note que a terceira igualdade é verdadeira pois $X$ e $Y$ são independentes. Para o caso contínuo:
$ f_T(t) = P(T <= t) =& P(X + Y <= t) \ attach(=, t: "LOTP") &integral_(- infinity)^(infinity)P(X + Y <= t|X = x)f_X (x)d x \
=& integral_(- infinity)^(infinity)P(Y <= t - x)f_X (x)d x \
=& integral_(- infinity)^(infinity)f_Y (t - x)f_X (x)d x
$
Analogamente para $f_T(t) = integral_(- infinity)^(infinity)f_X (t - y)f_Y (y)d y$.]
#theorem(number: "8.4.3", "Gamma = soma expo")[ Sejam $X_1, dots, X_n$ v.a.s independentes com $X_i tilde text("Expo")(lambda)$. Então
$ X_1 + dots + X_2 tilde "Gamma"(n, lambda) $
]
#proof[A MGF de $X_i$ é $M(t) = lambda/(lambda-t)$, então a MGF da soma é
$ M_(X_1 + dots + X_n)(t) = M_(X_1)(t) times dots times M_(X_n)(t) = (lambda/(lambda-t))^n $
Para $t < lambda$. Seja $Y tilde "Gamma"(n, lambda)$, então a MGF de $Y$ é
$ M_Y (t) = E(e^(t Y)) &= integral_0^(infinity) 1/Gamma(n) e^(t y) (lambda y)^(n)e^(-lambda y) (d y)/y \
&= lambda^n integral_0^(infinity) 1/Gamma(n) y^(n)e^(-(lambda - t) y) (d y)/y \
&= (lambda^n)/(lambda - t)^n integral_0^(infinity) 1/Gamma(n) ((lambda - t)y)^(n)e^(-(lambda - t) y) (d y)/y \
&= (lambda^n)/(lambda - t)^n
$
Na segunda igualdade apenas foi retirado o $lambda^n$ da integral. E na terceira foi multiplicado e dividido por $(lambda - t)^n$ e nota-se que a integral restante é a PDF de uma v.a. $"Gamma"(n, lambda - t)$. Portanto, comos as MGFs são iguais, temos que $X_1 + dots + X_n tilde "Gamma"(n, lambda)$.]
=
#context counter(heading).update((9,1,4))
#theorem(number: "9.1.5", "lei da esperança total")[Seja $A_1, dots, A_n$ uma partição do espaço amostral, onde $P(A_i) > 0$ para todo $i$, e $X$ uma v.a. Então
$ E(X) = sum_(i = 1)^(n)E(X|A_i)P(A_i) $
]
#proof[Pelo *Teorema 9.3.7* (Lei de Adão), temos que
$ E(E(X|Y)) &= E(X) $
Considerando $Y$ uma v.a. discreta, e $g(y) = E(X|Y = y)$, então
$ E(E(X|Y)) = E(g(Y)) = sum_y g(y)P(Y = y) = sum_y E(X|Y = y) P(Y = y)
$
Fazendo a relação $A_i = {Y = i}$, temos
$ E(E(X|Y)) = sum_y E(X|Y = y) P(Y = y) = sum_(i = 1)^(n) E(X|A_i)P(A_i) = E(X) $
Portanto, $E(X) = sum_(i = 1)^(n)E(X|A_i)P(A_i)$. Para o caso contínuo, a prova é análoga.]
#theorem(number: "9.3.7", "Lei de Adão")[ Para quaisquer v.a.s $X$ e $Y$ vale
$ E(E(Y|X)) = E(Y) $
]
#proof[Para $X$ e $Y$ discretas e $g(X) = E(Y|X)$, temos
$ E(g(X)) &= sum_x g(x)P(X=x) \
&= sum_x E(Y|X=x)P(X=x) \
&= sum_x (sum_y y P(Y=y|X=x))P(X=x) \
$
Lembre-se que $P(A sect B) = P(A|B)P(B)$, então
$ E(g(X)) &= sum_x sum_y y P(Y=y|X=x)P(X=x) \
&= sum_y y sum_x P(Y=y sect X=x) \
&= sum_y y P(Y=y) = E(Y) $
Portanto, $E(E(Y|X)) = E(Y)$. Para o caso contínuo, a prova é análoga.]
#theorem("Lei de Eva", number: "9.5.4")[Para quaisquer v.a.s $X$ e $Y$ vale
$ var(Y) = E(var(Y|X)) + var(E(Y|X)) $
O nome da lei vem de que a ordem de esperanças e variâncias é $"EVVE"$, onde em inglês $"EVE"$ é o nome de Eva.
]
#proof[Seja $g(X) = E(Y|X)$, então pela lei de Adão $E(Y) = E(E(Y|X)) = E(g(X))$. Então
$ E(var(Y|X)) &= E(E(Y^2|X) - E(Y|X)^2) \ &= E(E(Y^2|X)) - E(E(Y|X))^2 \
&= E(Y^2) - E(g(X))^2 $
e
$ var(E(Y|X)) &= var(g(X)) \ &= E(g(X)^2) - E(g(X))^2 \
&= E(g(X)^2) - E(Y)^2 $
Por fim, somando as duas equações, temos
$ E(var(Y|X)) + var(E(Y|X)) &= E(Y^2) - E(g(X))^2 + E(g(X)^2) - E(Y)^2 \ &= E(Y^2) - E(Y)^2 = var(Y) $
]
=
vazio por hora
#pagebreak()
#set heading(numbering: "1.")
= Desigualdades
#theorem("Desigualdade de Markov")[
Seja $X$ uma variável aleatória não negativa. Então, para todo $a > 0$,
$ P(|X| >= a) <= (E(|X|))/a $
]
#proof[Seja $Y = (|X|)/a$ e $I_(Y >= 1)$ a função indicadora de $Y >= 1$. Temos que $I_(Y >= 1) = 1 <=> Y >= 1$ e $I_(Y >= 1) = 0 <=> Y < 1$. Isso implica que $I_(Y >= 1) <= Y$. Logo, aplicando a esperança em ambos os lados, temos
$
E(I_(Y >= 1)) <= E(Y) => P(Y >= 1) <= E(Y) => P((|X|)/a >= 1) <= E((|X|)/a) => P(X >= a) <= (E(|X|))/a
$
]
#let Var(X) = $"Var"(X)$
#theorem("Desigualdade de Chebyshev")[
Seja $X$ uma variável aleatória com média $mu$ e variância $sigma^2$. Então, para todo $a > 0$,
$ P(|X - mu| >= a) <= (sigma^2)/(a^2) $
]
#proof[Seja $Y = |X - mu|^2$, com isso temos
$ P(|X - mu| >= a) = P(|X - mu|^2 >= a^2) = P(Y >= a^2) $
Aplicando a desigualdade de Markov, temos
$ P(Y >= a^2) <= E(Y)/a^2 = E(|X - mu|^2)/a^2 = (sigma^2)/a^2 $
Portanto
$ P(|X - mu| >= a) <= (sigma^2)/(a^2) $
]
#theorem("Desigualdade de Chernoff")[
Seja $X$ uma variável aleatória com média $mu$. Então, para todo $a > 0$,
$ P(X >= a) <= e^(-t a) M_X(t) = E(e^(t X))/e^(t a) $
onde $M_X(t)$ é a função geradora de momentos de $X$.
]
#proof[Seja $Y = e^(t X)$, com isso temos
$ P(X >= a) = P(e^(t X) >= e^(t a)) = P(Y >= e^(t a)) $
Aplicando a desigualdade de Markov, temos
$ P(Y >= e^(t a)) <= E(Y)/e^(t a) = E(e^(t X))/e^(t a) $
Portanto
$ P(X >= a) <= e^(-t a) M_X(t) = E(e^(t X))/e^(t a) $
]
#definition("convexidade e concavidade")[Seja $g$ uma função duas vezes diferenciável. Dizemos que $g$ é convexa se $g''(x) >= 0$ para todo $x$ e concava se $g''(x) <= 0$ para todo $x$.]
#theorem("Desigualdade de Jensen")[ Seja $X$ uma variável aleatória e $g$ uma função convexa, então
$ g(E(X)) <= E(g(X)) $
Se $g$ é concava, a desigualdade é invertida, ou seja,
$ g(E(X)) >= E(g(X)) $
onde a igualdade vale se, e somente se, $g(X) = a + b X$ com probabilidade 1.
]
#proof[ Se $g$ é convexa, então $g''(x) >= 0$ para todo $x$. E seja $a + b X$ a reta tangente a $g$ em $E(X)$, então temos
$ g(X) >= a + b X $
aplicando a esperança em ambos os lados, temos
$ E(g(X)) >= a + b E(X) = g(E(X)) $
Onde a igualdade vale pois a reta é tangente em $E(X)$.
Usando a mesma $g$, temos que $h = -g$ é concava, usando a desigualdade encontrada acima, temos
$ E(-h(X)) >= -h(E(X)) ==> -E(h(X)) >= -h(E(X)) $
multiplicando por $-1$ em ambos os lados, temos
$ E(h(X)) <= h(E(X)) $
]
|
|
https://github.com/hei-templates/hevs-typsttemplate-thesis | https://raw.githubusercontent.com/hei-templates/hevs-typsttemplate-thesis/main/01-settings/metadata.typ | typst | MIT License |
//
// Description: Metadata of the document
//
#import "../00-templates/constants.typ": *
#let title= "Thesis Template"
#let subtitle= "Longer Subtitle"
#let version= "v0.1"
#let author= (
name: "<NAME>",
email: "<EMAIL>",
degree: "Bachelor",
affiliation: "HEI-Vs",
place: "Sion",
signature: resources-folder + "signature.png",
)
#let professor= (
name: "Prof. <NAME>",
email: "<EMAIL>",
affiliation: "HEI-Vs",
)
#let expert= (
name: "<NAME>",
email: "<EMAIL>",
affiliation: "Company",
)
#let school= (
name: "University of Applied Sciences Western Switzerland, HES-SO Valais Wallis",
shortname: "HEI-VS",
orientation: "Systems Engineering",
specialisation: "Infotronics",
dean: "Dr. <NAME>",
)
#let date= (
submission: "18 August " + datetime.today().display("[year]"),
current: datetime.today().display("[day].[month].[year]"),
year: datetime.today().display("[year]"),
)
#let tableof = (
toc: true,
tof: false,
tot: false,
tol: false,
toe: false,
)
#let icons = (
topleft: resources-folder + "logos/hei-vs-light.svg",
topright: resources-folder + "logos/hesso-logo.svg",
bottomleft: resources-folder + "logos/hevs-pictogram-only.svg",
bottomright: resources-folder + "logos/valais-excellence-logo.svg",
)
#let bib= true
#let icon="04-resources/icon.svg"
#let bibstyle="ieee" //"apa", "chicago-author-date", "chicago-notes", "mla" |
https://github.com/felsenhower/kbs-typst | https://raw.githubusercontent.com/felsenhower/kbs-typst/master/examples/09.typ | typst | MIT License | Es gilt $e^(i pi) = -1$, wobei
$
e^x = exp(x)
= sum_(n=0)^infinity (x^n)/(n!)
= lim_(n arrow infinity) (1 + x/n)^n.
$
|
https://github.com/maucejo/cnam_templates | https://raw.githubusercontent.com/maucejo/cnam_templates/main/src/report/_report.typ | typst | MIT License | #import "../common/_colors.typ": *
#import "../common/_utils.typ": *
#import "_report-utils.typ": *
#let default-titre = (
titre: none,
surtitre: ("En-tête", "personnalisable"),
composante: "cnam",
alignement: "irreg",
logo: none
)
#let cnam-rapport(
config-titre: (:),
toc: true,
sec-number: true,
body
) = {
let titre-dict = create_dict(default-titre, config-titre)
set text(font: "Crimson Pro", size: 12pt, lang: "fr", ligatures: false, number-type: "old-style")
set par(justify: true)
set list(marker: ([#text(fill:primary.dark-blue)[#sym.bullet]], [#text(fill:primary.dark-blue)[#sym.triangle.filled.r]], [#text(fill:primary.dark-blue)[--]]))
set page(
paper: "a4",
header: none,
footer: none
)
show outline.entry: it => {
set text(font: "Raleway")
if it.level == 1 {
set text(fill: primary.red, weight: "bold")
block(above: 0.5em, below: 0.1em)[#it]
} else {
set text(fill: primary.dark-blue)
block(above: 0.25em, below: 0em)[#it]
}
}
title-page(titre-dict)
if toc {
show heading.where(level: 1): it => {
set text(size: 16pt, fill: primary.dark-blue)
it
v(1em)
}
outline(depth: 2, fill:none)
pagebreak()
}
let numbering = none
if sec-number {
numbering = "1.1."
}
show heading.where(level: 1): it => {
set text(font: "Raleway", size: 14pt, fill: primary.red)
it
v(0.5em)
}
set heading(numbering: numbering)
show heading.where(level: 2): it => {
set text(font: "Raleway", size: 12pt, fill: primary.dark-blue)
it
v(0.25em)
}
let footer = context {
let current-page = counter(page).at(here()).first()
if calc.odd(current-page) {
set align(right)
box(outset: 6pt, stroke: (right: 1pt + primary.dark-blue, bottom: 1pt + primary.dark-blue))[#current-page]
} else {
set align(left)
box(outset: 6pt, stroke: (left: 1pt + primary.dark-blue, bottom: 1pt + primary.dark-blue))[#current-page]
}
}
set page(
paper: "a4",
footer: footer
)
counter(page).update(1)
body
} |
https://github.com/Myriad-Dreamin/typst.ts | https://raw.githubusercontent.com/Myriad-Dreamin/typst.ts/main/fuzzers/corpora/layout/repeat_03.typ | typst | Apache License 2.0 |
#import "/contrib/templates/std-tests/preset.typ": *
#show: test-page
// Test unboxed repeat.
#repeat(rect(width: 2em, height: 1em))
|
https://github.com/jamesrswift/typst-chem-par | https://raw.githubusercontent.com/jamesrswift/typst-chem-par/main/src/lib.typ | typst | MIT License | #import "chem-par.typ": chem-style
#import "stateful.typ": chem-toggle |
https://github.com/nafkhanzam/typst-common | https://raw.githubusercontent.com/nafkhanzam/typst-common/main/src/common/answer.typ | typst | #import "@preview/showybox:2.0.1": showybox
#let ANS = if "ANS" in sys.inputs {
let v = lower(sys.inputs.ANS)
v == "true" or v == "1"
} else {
false
}
#let answer(body) = {
if ANS {
v(-.5em)
showybox(
frame: (
border-color: blue.darken(50%),
title-color: blue.lighten(60%),
body-color: blue.lighten(80%),
),
shadow: (
offset: 3pt,
),
body,
)
v(1em)
}
}
|
|
https://github.com/typst/packages | https://raw.githubusercontent.com/typst/packages/main/packages/preview/scholarly-tauthesis/0.4.0/template/content/04.typ | typst | Apache License 2.0 | /** 04.typ
*
* This is an example chapter in a multi-file typst project.
*
***/
#import "../preamble.typ": *
#import "@preview/scholarly-tauthesis:0.4.0" as tauthesis
= Conclusions <conclusions>
This template and the writing guidelines should help achieving a
consistently formatted and clear documents. A similar template is
also available for Word.
Every writing and presentation must have a conclusion. This fact
is here emphasized by having this short and rather artificial
summary also in this template. The purpose of this chapter is to
discuss how the things we set out to do in the introduction
succeeded, and compare our results to other literature on the
same topic.
|
https://github.com/sitandr/typst-examples-book | https://raw.githubusercontent.com/sitandr/typst-examples-book/main/src/basics/math/vec.md | markdown | MIT License | # Vectors, matrices, semicolumn syntax
## Vectors
> By vector we mean a column there. \
> To write arrow notations for letters, use `$arrow(v)$` \
> I recommend to create shortcut for this, like `#let arr = math.arrow`
To write columns, use `vec` command:
```typ
$
vec(a, b, c) + vec(1, 2, 3) = vec(a + 1, b + 2, c + 3)
$
```
### Delimiter
You can change parentheses around the column or even remove them:
```typ
$
vec(1, 2, 3, delim: "{") \
vec(1, 2, 3, delim: bar.double) \
vec(1, 2, 3, delim: #none)
$
```
### Gap
You can change the size of gap between rows:
```typ
$
vec(a, b, c)
vec(a, b, c, gap:#0em)
vec(a, b, c, gap:#1em)
$
```
### Making gap even
You can easily note that the gap isn't necessarily even or the same in different vectors:
```typ
$
vec(a/b, a/b, a/b) = vec(1, 1, 1)
$
```
That happens because `gap` refers to _spacing between_ elements, not the distance between their centers.
To fix this, you can use [this snippet](../../snippets/math/vecs.md).
## Matrix
> See [official reference](https://typst.app/docs/reference/math/mat/)
Matrix is very similar to `vec`, but accepts rows, separated by `;`:
```typ
$
mat(
1, 2, ..., 10;
2, 2, ..., 10;
dots.v, dots.v, dots.down, dots.v;
10, 10, ..., 10; // `;` in the end is optional
)
$
```
### Delimiters and gaps
You can specify them the same way as for vectors.
<div class="warning">
Specify the arguments either before the content, or <strong>after the semicolon</strong>. The code will panic if there is no semicolon!
</div>
```typ
$
mat(
delim: "|",
1, 2, ..., 10;
2, 2, ..., 10;
dots.v, dots.v, dots.down, dots.v;
10, 10, ..., 10;
gap: #0.3em
)
$
```
## Semicolon syntax
When you use semicolons, the arguments _between the semicolons_ are merged into arrays. See yourself:
```typ
#let fun(..args) = {
args.pos()
}
$
fun(1, 2;3, 4; 6, ; 8)
$
```
If you miss some of elements, they will be replaced by `none`-s.
You can mix semicolon syntax and named arguments, but be careful!
```typ
#let fun(..args) = {
repr(args.pos())
repr(args.named())
}
$
fun(1, 2; gap: #3em, 4)
$
```
For example, this will not work:
```typ-norender
$
// ↓ there is no `;`, so it tries to add (gap:) to array
mat(1, 2; 4, gap: #3em)
$
```
|
https://github.com/0x1B05/nju_os | https://raw.githubusercontent.com/0x1B05/nju_os/main/am_notes/content/chapter1.typ | typst | #import "../template.typ": *
= 模板说明
#link("https://github.com/a-kkiri/SimpleNote")[SimpleNote] #cite(<SimpleNote>) 修改自 #link("https://github.com/jskherman/jsk-lecnotes")[jsk-lecnotes],是一个简单的 Typst 模板。本模板主要适用于编写课程笔记,默认页边距为2.5cm,中文字体为 Noto Sans CJK SC,英文字体为 Linux Libertine,字号为12pt(小四)。封面图片来自于 #link("https://unsplash.com/photos/a-lone-tree-in-the-middle-of-a-snowy-field-e6izyojjM1s")[illes_cristi - Unsplash]。
默认模板文件由主要以下六部分组成:
#list(indent:4em,
[main.typ 主文件],
[template.typ 文档格式控制,包括一些基础的设置、函数],
[refs.bib 参考文献],
[content 正文文件夹,存放正文章节],
[fonts 字体文件夹],
[figures 图片文件夹]
)\ #v(-16pt)
使用模板首先需配置 main.typ,设置标题、描述、作者等信息。如需要进一步更改文档格式,请修改 template.typ。 |
|
https://github.com/waterlens/resume | https://raw.githubusercontent.com/waterlens/resume/main/resume.typ | typst | MIT License | #import "template.typ": *
#show: resume
= <NAME>
#align(center)[
#iconlink("mailto:<EMAIL>", text: "<EMAIL>", icon: fa-envelope())
#iconlink("https://github.com/waterlens", text: "github.com/waterlens", icon: fa-github())
]
== Research Interests
I am interested in the implementation and optimization of programming languages, particularly in the following areas:
- Automatic memory management assisted by type systems
- Improved data representation for compute-intensive programs
- Explicit vectorization
- Formal verification of transformations
== Education
#entry(
tl: [Hong Kong University of Science & Technology],
tr: [*Aug. 2023 - June 2025 (expected)*],
bl: [*M. Phil.* in _Computer Science and Engineering_],
br: [_Hong Kong S.A.R., China_],
)[
- Advisor: <NAME>
]
#entry(
tl: [Zhejiang University],
tr: [*Sep. 2019 - June 2023*],
bl: [*B. Eng.* in _Computer Science and Technology_],
br: [_Hangzhou, China_],
)[
- GPA: 3.84/4.0
- A/A+ Courses: Programming Language Principles, Compilation Principles, Data Structure and Algorithm, etc.
]
== Projects
#entry(
tl: [MLScript #link("https://github.com/waterlens/mlscript")[#fa-link()]],
tr: [*Autumn 2023 - Now*],
)[
- This is an ongoing project in HKUST TACO Lab. It's an object-oriented and functional programming language with numerous advanced type system features.
- Designed an ANF-based IR with join points support and integrated it into MLS compiler.
- Implemented an optimizer based on it. It contains a non-duplicate partial inliner leveraging function splitting.
- Implemented a C++ backend. Using a universal object representation, and reference counting for memory management.
]
#entry(
tl: [Calocom #link("https://github.com/permui/calocom")[#fa-link()]],
tr: [*Spring 2022*],
)[
- This is a coursework for the course _compilation principle_.
- Designed and implemented a programming language with functional features like algebraic data type, closure, and pattern matching.
- Topics include: type checking, closure conversion, LLVM-based code generation, and runtime system.
]
#entry(
tl: [SyOC #link("https://github.com/waterlens/syoc")[#fa-link()]],
tr: [*Spring 2022 - Summer 2022*],
)[
- This is an optimizing compiler for SysY (a subset of C) language.
- Typical dataflow analysis: immediate dominator analysis, iterated domination frontier analysis for SSA IR construction.
- Optimizations: constant propagation, CFG simplification, and dead code elimination.
- Implemented linear scan register allocation.
]
== Experience
#entry(
tl: [*Teaching Assistant* of _Principles of Programming Languages_],
tr: [*Sept. 2022 - Jan. 2023*],
)[
- Prepared a lab that requires students to implement Hindley-Milner type inference with let generalization in a simple typed lambda calculus.
- Designed and wrote the auto judgement system of labs.
]
#entry(
tl: [*Keynote Presentation* in a PL enthusiasts group],
tr: [*July 2023*],
)[
- Gave a presentation on the topic of "Efficient Pattern Matching Compilation".
]
#entry(
tl: [*Teaching Assistant* of _Programming with C++_],
tr: [*Jan. 2024 - June 2024*],
)[
- Prepared a lab that helps students learn dynamic memory management in C++.
]
== Skills
*Programming Languages:*
OCaml, Rust, Haskell, C/C++, Zig, Scala, Java, Python, etc.
#v(-6pt)
*Proof Assistant:*
Coq
#align(right + bottom, text(fill: gray)[Last Updated on May 24, 2024])
|
https://github.com/ClazyChen/Table-Tennis-Rankings | https://raw.githubusercontent.com/ClazyChen/Table-Tennis-Rankings/main/history/2018/WS-04.typ | typst |
#set text(font: ("Courier New", "NSimSun"))
#figure(
caption: "Women's Singles (1 - 32)",
table(
columns: 4,
[Ranking], [Player], [Country/Region], [Rating],
[1], [DING Ning], [CHN], [3470],
[2], [LIU Shiwen], [CHN], [3387],
[3], [ZHU Yuling], [MAC], [3324],
[4], [CHEN Meng], [CHN], [3317],
[5], [WANG Manyu], [CHN], [3243],
[6], [ISHIKAWA Kasumi], [JPN], [3195],
[7], [SUN Yingsha], [CHN], [3161],
[8], [CHEN Xingtong], [CHN], [3156],
[9], [MU Zi], [CHN], [3147],
[10], [WU Yang], [CHN], [3094],
[11], [FENG Yalan], [CHN], [3056],
[12], [GU Yuting], [CHN], [3046],
[13], [KIM Song I], [PRK], [2990],
[14], [ITO Mima], [JPN], [2987],
[15], [WEN Jia], [CHN], [2958],
[16], [HU Limei], [CHN], [2945],
[17], [CHEN Ke], [CHN], [2920],
[18], [HIRANO Miu], [JPN], [2915],
[19], [#text(gray, "LI Xiaodan")], [CHN], [2903],
[20], [FENG Tianwei], [SGP], [2899],
[21], [SUH Hyo Won], [KOR], [2898],
[22], [JEON Jihee], [KOR], [2896],
[23], [KATO Miyu], [JPN], [2866],
[24], [CHENG I-Ching], [TPE], [2858],
[25], [ZHANG Qiang], [CHN], [2854],
[26], [LI Jie], [NED], [2850],
[27], [YANG Xiaoxin], [MON], [2849],
[28], [GU Ruochen], [CHN], [2849],
[29], [CHE Xiaoxi], [CHN], [2845],
[30], [HAN Ying], [GER], [2844],
[31], [POLCANOVA Sofia], [AUT], [2839],
[32], [YANG Ha Eun], [KOR], [2839],
)
)#pagebreak()
#set text(font: ("Courier New", "NSimSun"))
#figure(
caption: "Women's Singles (33 - 64)",
table(
columns: 4,
[Ranking], [Player], [Country/Region], [Rating],
[33], [WANG Yidi], [CHN], [2835],
[34], [LEE Ho Ching], [HKG], [2831],
[35], [SHI Xunyao], [CHN], [2822],
[36], [HU Melek], [TUR], [2817],
[37], [SZOCS Bernadette], [ROU], [2816],
[38], [HASHIMOTO Honoka], [JPN], [2814],
[39], [SHAN Xiaona], [GER], [2814],
[40], [SATO Hitomi], [JPN], [2813],
[41], [HAYATA Hina], [JPN], [2810],
[42], [SHIBATA Saki], [JPN], [2804],
[43], [LI Qian], [POL], [2801],
[44], [LANG Kristin], [GER], [2795],
[45], [#text(gray, "KIM Kyungah")], [KOR], [2794],
[46], [HE Zhuojia], [CHN], [2791],
[47], [DOO Hoi Kem], [HKG], [2789],
[48], [YU Fu], [POR], [2786],
[49], [LIU Jia], [AUT], [2776],
[50], [ZENG Jian], [SGP], [2769],
[51], [ZHANG Rui], [CHN], [2768],
[52], [SUN Mingyang], [CHN], [2765],
[53], [#text(gray, "TIE Yana")], [HKG], [2764],
[54], [<NAME>], [JPN], [2763],
[55], [CHEN Szu-Yu], [TPE], [2762],
[56], [CHOI Hyojoo], [KOR], [2762],
[57], [LI Jiao], [NED], [2762],
[58], [<NAME>], [ROU], [2760],
[59], [SAMARA Elizabeta], [ROU], [2760],
[60], [EKHOLM Matilda], [SWE], [2756],
[61], [#text(gray, "<NAME>")], [CHN], [2754],
[62], [HAMAMOTO Yui], [JPN], [2753],
[63], [LIU Xi], [CHN], [2753],
[64], [NI Xia Lian], [LUX], [2752],
)
)#pagebreak()
#set text(font: ("Courier New", "NSimSun"))
#figure(
caption: "Women's Singles (65 - 96)",
table(
columns: 4,
[Ranking], [Player], [Country/Region], [Rating],
[65], [SOO Wai Yam Minnie], [HKG], [2745],
[66], [LI Jiayi], [CHN], [2727],
[67], [NAGASAKI Miyu], [JPN], [2726],
[68], [YU Mengyu], [SGP], [2724],
[69], [<NAME>], [JPN], [2719],
[70], [POTA Georgina], [HUN], [2715],
[71], [#text(gray, "JIANG Huajun")], [HKG], [2714],
[72], [CHA Hyo Sim], [PRK], [2713],
[73], [LIU Gaoyang], [CHN], [2712],
[74], [LI Fen], [SWE], [2702],
[75], [<NAME>], [JPN], [2693],
[76], [ZHANG Mo], [CAN], [2691],
[77], [LEE Zion], [KOR], [2688],
[78], [MATSUZAWA Marina], [JPN], [2687],
[79], [MIKHAILOVA Polina], [RUS], [2685],
[80], [SOLJA Petrissa], [GER], [2683],
[81], [GRZYBOWSKA-FRANC Katarzyna], [POL], [2682],
[82], [<NAME>], [JPN], [2677],
[83], [NG Wing Nam], [HKG], [2672],
[84], [MAEDA Miyu], [JPN], [2667],
[85], [LIU Fei], [CHN], [2659],
[86], [<NAME>], [JPN], [2655],
[87], [<NAME>-Tzu], [TPE], [2654],
[88], [<NAME>], [UKR], [2653],
[89], [ZHOU Yihan], [SGP], [2643],
[90], [<NAME>], [IND], [2640],
[91], [HUANG Yi-Hua], [TPE], [2640],
[92], [<NAME>], [THA], [2638],
[93], [<NAME>], [PUR], [2637],
[94], [#text(gray, "<NAME>")], [PRK], [2630],
[95], [#text(gray, "<NAME>")], [KOR], [2622],
[96], [HAPONOVA Hanna], [UKR], [2621],
)
)#pagebreak()
#set text(font: ("Courier New", "NSimSun"))
#figure(
caption: "Women's Singles (97 - 128)",
table(
columns: 4,
[Ranking], [Player], [Country/Region], [Rating],
[97], [EERLAND Britt], [NED], [2621],
[98], [PARTYKA Natalia], [POL], [2621],
[99], [PAVLOVICH Viktoria], [BLR], [2616],
[100], [WINTER Sabine], [GER], [2616],
[101], [KIHARA Miyuu], [JPN], [2613],
[102], [#text(gray, "VACENOVSKA Iveta")], [CZE], [2610],
[103], [VOROBEVA Olga], [RUS], [2607],
[104], [#text(gray, "CHOI Moonyoung")], [KOR], [2607],
[105], [<NAME>], [SGP], [2598],
[106], [KATO Kyoka], [JPN], [2598],
[107], [MITTELHAM Nina], [GER], [2595],
[108], [<NAME>], [KOR], [2594],
[109], [<NAME>], [PRK], [2587],
[110], [SASAO Asuka], [JPN], [2581],
[111], [PASKAUSKIENE Ruta], [LTU], [2579],
[112], [<NAME>], [TPE], [2578],
[113], [MESHREF Dina], [EGY], [2573],
[114], [NOSKOVA Yana], [RUS], [2572],
[115], [SABITOVA Valentina], [RUS], [2566],
[116], [SO Eka], [JPN], [2565],
[117], [LEE Eunhye], [KOR], [2564],
[118], [TIAN Yuan], [CRO], [2561],
[119], [ODO Satsuki], [JPN], [2558],
[120], [SHAO Jieni], [POR], [2551],
[121], [PROKHOROVA Yulia], [RUS], [2550],
[122], [STRBIKOVA Renata], [CZE], [2547],
[123], [FAN Siqi], [CHN], [2546],
[124], [<NAME>], [THA], [2545],
[125], [<NAME>], [CZE], [2543],
[126], [<NAME>], [KOR], [2543],
[127], [<NAME>], [FRA], [2542],
[128], [<NAME>], [ROU], [2542],
)
) |
|
https://github.com/maantjemol/Aantekeningen-Jaar-2 | https://raw.githubusercontent.com/maantjemol/Aantekeningen-Jaar-2/main/RE/samenvatting.typ | typst | // Update this import to where you put the `lapreprint.typ` file
// It should probably be in the same folder
#import "../template/lapreprint.typ": template
#import "../template/frontmatter.typ": loadFrontmatter
#import "@preview/drafting:0.2.0": *
#import "@preview/cetz:0.2.2"
#import cetz.plot
#let defaultColor = rgb("#f2542d")
#let caution-rect = rect.with(inset: 1em, radius: 0.5em, fill: defaultColor.lighten(96%), width:100%)
#let note = (content) => inline-note(rect: caution-rect)[#content]
#show: template.with(
title: "Requirements Engineering",
subtitle: "Samenvatting",
short-title: "Requirements Engineering Samenvatting",
venue: [Leiden University],
// This is relative to the template file
// When importing normally, you should be able to use it relative to this file.
theme: defaultColor,
authors: (
(
name: "<NAME> . ",
),
),
kind: "Samenvatting",
abstract: (
(title: "Samenvatting", content: [This document provides a foundational introduction to Requirements Engineering concepts. It covers the basics of requirements, the requirements engineering process, and the different types of requirements. It also discusses the importance of requirements engineering and the challenges that come with it.\ \
#line(length: 100%, stroke: gray)
#outline(depth: 1,title: text(defaultColor, size: 9pt)[Contents:])
]),
),
open-access: true,
margin: (
(
title: "",
content: [
],
),
),
font-face: "Open Sans"
)
#set page(
margin: (left: 1in, right: 1in), paper: "us-letter"
)
#let default-rect(stroke: none, fill: none, width: 0pt, content) = {
pad(left:width*(1 - marginRatio), rect(width: width*marginRatio, stroke: stroke)[
#content
])
}
#set-page-properties()
#show terms: it => [
#note[#text(defaultColor, weight: 600, size: 10pt)[#it.children.first().term]\ #it.children.first().description]
]
#set quote(block: true)
#set heading(numbering: none)
#show heading: set text(defaultColor, weight: "medium")
= Introduction:
The 3 levels of Requirements Artifacts:
+ *Goals:* What the system should achieve
+ *Scenarios:* Describes a concrete example of satisfying or failing to satisfy a goal
+ *Requirements:* Define the data, functions, behavior, quality, and constraints, often imply solution
= Scenarios:
Scenarios are the glue between abstract models and reality. They can be abstracted (video) or concrete (sequence diagram). Abstraction can also be achieved by using different english levels.
== Information in scenarios:
Some typical information in scenarios:
+ *Actor:* The entity that interacts with the system
+ *Roles*: The roles of the actors
+ *Goal:* The reason for the interaction
+ *Precondition:* The state of the system before the interaction
+ *Postcondition:* The state of the system after the interaction
+ *Location*: Where the interaction takes place
+ *Req. resources:* The resources needed for the interaction
== 8 scenario types:
+ *State scenarios:*
+ *Current-state scenarios:* Describe the current situation
+ *Desired-state scenarios:* Describe the desired situation
+ *Type & Instance:*
+ *Type scenario:* describes the general process
+ *Instance scenario:* Describes a specific instance of a type scenario, added when there is need for more clarification.
+ *Alternatives:*
+ *Main scenario:* sequence of interactions to satisfy (set of) goal(s)
+ *Alternative scenario:* sequence of interactions, instead of main scenario, to satisfy the same (set of) goal(s) $->$ “Plan B”
+ *Exception scenario:* Describes what happens when something goes wrong. As a consequence one or more of the initial goals will not be satisfied.
+ *What if? scenarios:* Describes what happens when the environment changes. Documents alternative realizations.
+ *Descriptive scenario:* Describes process or workflow
+ *Explanatory scenario:* Provides background information and rationales
+ *Misuse scenarios:* Describes how the system can be misused
+ *Negative scenarios:* Goal is not satisfied. Should be explicitly not allowed.
+ *System-internal, interaction and context scenarios:*
+ *System-internal:* focus on interactions within system
+ *Interaction:* focus on interactions between system and actors
+ *Context:* focus on interactions between system and environment
#pagebreak()
== Documenting scenarios:
/ Narrative scenarios: Describe the scenario in a narrative way, as a sequence of events.
== Diagrams
+ *Sequence diagrams:* Show the sequence of interactions between actors and the system
+ *Activity diagrams:* Show the flow of activities in a scenario.
+ *Use case diagrams:* Suited for documenting relationships between use cases
= Business problems:
== Scoping the business problem:
What is the purpose of the project, what is the scope of the work and what are the goals of the project? This should take into account the needs of the stakeholders. It should also include:
- *Constraints*: restrictions which help determine the scope of the work. They can be solutions constraints or project constraints.
- *Terminology:* define from the start to enhance clarity and understanding. make sure it's shared terminology
- *Estimated costs:* measured is always better than guess
- *Risks*: identify, assess and manage risks.
- *To go or not to go:* SWOT and other models can help here
The scope, goals and stakeholders of the business problem are interconnected.
== Goals:
What do you want to achieve? Make sure your goals are SMART:
- *Specific:* Clearly defined
- *Measurable:* Can be measured
- *Achievable:* Can be achieved
- *Relevant:* Relevant to the stakeholders
- *Time-bound:* Achievable within a certain time frame
Goal orientation is important because it helps to ensure that the system meets the needs of the stakeholders. It also helps to reduce the risk of project failure. It provides focus and gives justification for the requirements.
Goals can be set on different levels:
- *AND-decomposition:* All subgoals must be achieved
- *OR-decomposition:* At least one subgoal must be achieved
#pagebreak()
*Goal dependencies:*
- *Requires dependency:*
- Satisfaction of Goal X is prerequisite for satisfaction of Goal Y
- *Support dependency*
- Satisfaction of Goal X contributes to satisfaction of Goal Y
- *Obstruction dependency:*
- Satisfaction of Goal X hinders satisfaction of Goal Y
- *Conflict dependency:*
- Satisfaction of Goal X excludes satisfaction of Goal Y
- *Goal equivalence:*
- Satisfaction of Goal X leads to satisfaction of Goal Y
*How to document goals:*
+ be concise
+ bedrijvende vorm (actief), voorbeeld: "Het systeem moet..."
+ Precise documentation
+ Decompose goals
+ Explain added value
+ Document why the goal is introduced
+ Avoid unnecessary restrictions
Goals initiate the definition of the scenarios. The definition of scenarios leads to refinement of the goals. Goals can also be used to classify scenarios.
== Scope:
Your scope shouldn't focus exclusively on the system, but should also include humans.
== Stakeholders:
Examples:
- Sponsor
- Customers
- Users
- Management
= BUC (business use case):
A BUC is a collection of related scenarios that describes how a system or product should respond to a specific business event.
== BUC requirements:
- *A "natural" partition of the work*, making an obvious and logical contribution.
- *Isolated*, with minimal connectivity to other parts of the work.
- Clearly *defined in scope*, with rules for defining that scope.
- *Recognisable to stakeholders*, using names and terms they understand.
- *Readily determined to exist*, not something that is unclear or debatable.
- *Supported by one or two known experts* for that part of the work.
#pagebreak()
== Buc structure:
- *Context*
- *One main scenario*
- *One or more alternative scenarios*
- *One or more exception scenarios*
== Scope:
The scope of each BUC includes anything that you are allowed to change, as well as anything you need to understand to determine what can or should be changed.
/ Business events: are things that happen outside the system that the system needs to respond to. They can be triggered by people, other systems, or even time passing. When a business event happens, the system should respond by *initiating the* *correct BUC*
= Motivatie voor requirements engineering:
Systems mainly driven by software.
/ N.I.V.E.A.: <NAME> Voor <NAME>.
Requirements engineering is important because it helps to ensure that the system meets the needs of the stakeholders, and it helps to reduce the risk of project failure. It reduces costs because logical errors can be detected early in the process.
RE can be embedded in the business:
+ *Processes:* Marketing, sales, production, maintenance
+ *Developmental processes:* Project management, design, quality assurance.
Involving these stakeholders reduces the risk of project failure.
== RE vs SE:
Software is build according to specifications. These specifications come from requirements.
#figure(
image("./images/fuik.png", width: 80%),
caption: "Fuik van de softwareontwikkeling"
)
== Fundamental truths:
+ Requirements are about understanding the real business problem (or opportunity) and providing a solution for it.
+ We build software with optimal value for the stakeholders.
+ Understand the need to build the right software
+ Building software does not necessarily solve the whole business problem
+ Requirements have to become known to the builders
+ Customers do not always give ‘the right’ answer.
+ Requirements do not come about by chance
+ Iterative approaches (like Agile/Scrum) do NOT make requirements [engineering] redundant.
+ There is no ‘silver bullet’.
+ Requirements should be measurable and testable.
+ You will change the way the user thinks.
= Requirements engineering process:
*RE is an iterative process!* It's about what you want to build, not yet about how you want to build it.
/ 3 dimensions of RE: #text[
+ *Content:* from vague to complete
+ *Agreement:* from conflicting to agreed
+ *Documentation:* from informal to formal
]
Requirements engineering is about understanding the real business problem (or opportunity) and providing a solution for it. Requirements process is iterative
== The Volere requirements process:
The Volere requirements process is a process for gathering, documenting, and managing requirements. It consists of 9 steps:
+ *Start of project*: define business problem and scope, identify stakeholders and goals. produce cost estimate and decide whether to proceed.
+ *Requirements elicitation:* gather requirements from stakeholders, document requirements, and validate them. Avoid _old wine in new bottles_.
+ *Writing and documenting requirements:* write requirements in a structured way, unambiguous (using a rationale), testable using *fit criterion*. The process of writing requirements might be even more important.
+ *Quality Gateway:* testing each requirement for completeness, correctness, measurability, absence of ambiguity and several other attributes, before allowing the requirement to be passed to the developers.
+ *Reusing requirements:* like quality requirements
+ *Reviewing the requirements:* nothing missing, consistent, conflicts resolved, etc.
+ *Iterate:* iterate on the requirements until they are complete and correct.
+ *Retrospective:* what went well, what went wrong, what can be improved.
+ *Evolution of requirements:* requirements change over time, so they need to be managed.
The Volere template is a template about _What_ to write about. The _snow card_ is a guide to _how_ to write about it.
== The future how (solution):
There are many factors to decide what the best solution is, such as: cost, constraints, PUC (Product Use Case), innovation, organizational goals, etc.
Once you understand the complete BUC, you can establish how much of it wil be solved by the product. This is the _future how_. Keep in mind the *real origin* of the business event. Also consider the users and don't forget NIVEA.
Also keep in mind the technology and systems already in place.
/ Product Use Case: sets out functionality of the product. Good tool to consolidate the views of the stakeholders.
== Sequential strategy:
In a sequential strategy, the requirements are first gathered and then the software is developed. This is a traditional approach.
#figure(
image("./images/sequential.png"),
caption: "Sequential strategy"
)
+ *Conception $->$ Scoping:* establish goals, sponsors, identify key stakeholders, etc.
+ *Scoping -> Investigation:* identify the work, all stakeholders, detailed constraints, etc.
+ *Investigation $->$ product Determination:* understanding business carried out by each BUC.
+ *Product Determination $->$ Atomic requirements:* Specification for each PUC is understood and agreed.
+ *Atomic requirements $->$ Construction:* Detailed requirements are understood and agreed.
== Iterative strategy:
Basically the same as the sequential strategy, but the steps are repeated. This is a more modern approach. Construction is done in small increments. BUC's are prioritized and the most important ones are developed first.
#pagebreak()
== Breakout:
The point at which the requirement knowledge is sufficient to move to the next activity (software development).
In a *sequential strategy*, the breakout is at the end of the requirements phase.
== Quality Gateway:
The quality gateway is a point in the requirements process where the requirements are tested for completeness, correctness, measurability, absence of ambiguity, and several other attributes, before allowing the requirement to be passed to the developers. The requirement must pass a set of tests:
- *Within scope:* does the requirement fall within the scope of the project?
- *Relevant:* is the requirement relevant to the stakeholders/project?
- *Complete:* no missing attributes?
- *Fit criterion:* is the requirement testable?
- *Consistent:* does the requirement conflict with other requirements?
- *Viable:* can the requirement be implemented?
- *Requirement or Solution:* is the requirement a requirement or a solution?
- *Gold plating:* is the requirement more than what is needed?
- *Creep:* is the effort worth the benefit?
- *Traceable:* can the requirement be traced back to a goal?
Quality control is important, because it prevents *error propagation* and *cost escalation* down the line. Principles of quality control:
- Involve the right stakeholders:
- Separate defect detection from defect correction
- Multiple views
- Use appropriate documentation formats
- Create development artifacts (e.g. prototypes, test, architecture)
- Repeat quality control
Some techniques for quality control are *inspection* and *prototyping*. Others are creating *checklists* and *artifacts*
== Reusing requirements:
Requirements can often be reused across projects with similar purpose. Existing stakeholders can also be a source of reused requirements. Some sources of requirements include colleagues, experiences, existing specs, domain models and books.
/ Requirement patterns: are used as a guide when choosing requirements. Can improve accuracy and completeness of requirements. There are patterns for domains, and across domains.
== Communicating requirements:
Use a template to communicate requirements. The Volere template is a good example. It is a template about _What_ to write about. The _snow card_ is a guide to _how_ to write about it. It's important to document. The requirements artifacts should be complete, traceable, correct, unambiguous, comprehensible, consistent, rated, verifiable, upt-to-date and atomic. Use simple language.
= Requirements elicitation:
Requirements elicitation should be focust on diversity of requirement sources. It focuses on *goals*, *scenarios* and the tree requirement types: *functional*, *constraints* and *quality* *requirements*.
== Objectives of requirements elicitation:
- identify relevant requirement sources
- elicit existing requirements
- develop new requirements
Elicitation is first diverging and then converging.
== Activities:
- *Identify relevant requirement sources:* stakeholders, documentation, existing systems, etc. Filter on relevance.
- *Elicit existing requirements:* interviews, questionnaires, workshops, etc.
- *Develop new requirements:* brainstorming, prototyping, etc.
/ The Brown Cow Model: #text[
The Brown Cow Model. This shows four views of the work, each of which provides the business analyst and the stakeholders with information that is useful at different stages of the requirements discovery process. The four views are:
+ *How (solution) now:* What is the current situation?
+ *What (essence) now:* BUCs, essence of the work
+ *Future what (essence):* Future state situation
+ *Future how(solution):* Comprehensive future state situation
]
== Techniques:
- *Interviews:* structured, semi-structured, unstructured
- *Preparation:* Define a goal, invite people, speak participants language, align interviews incase of multiple interviewers
- *Execution:* Explain goal, ask questions, focus on subject, sum up and _thank participants_ (positive feedback)
- *Followup:* Summarize, send summary, ask for feedback
- *Critical success factors:* communication skills, no leading questions, active listening, etc.
- *Questionnaires:* open, closed, Likert scale
- *Critical success factors:* clear questions, clear instructions, stakeholders need to be motivated, etc.
- *Workshops:* brainstorming, prototyping, etc.
- *Critical success factors:* participants need to understand goal, invite the right people, motivate, avoid groupthink, etc.
- *Observation:* observing the stakeholders in their natural environment, either watching or participating.
- *Critical success factors:* willingness to cooperate, objectivity, etc.
- *Perspective based reading:* reading the requirements from different perspectives
- *Critical success factors:* selecting the right perspectives.
#pagebreak()
*Assistance techniques:*
- *Mind mapping:* visual representation of ideas
- *Prototyping:* creating a model of the system
- *Brainstorming:* generating ideas
- *Checklist*
- *KJ method:* grouping ideas
== Understanding the real problem:
Understanding the real problem is important because it helps to ensure that the system meets the needs of the stakeholders. It also helps to reduce the risk of project failure. It provides focus and gives justification for the requirements.
= What is a requirement?
#quote("A condition or capability needed by a user to solve a problem or achieve an objective that must be met or possessed by a system or system component to satisfy a contract, standard, specification, or other formally imposed document", attribution: "IEEE")
== Types of requirements:
+ *Functional requirements:* What the system should do
+ *Constraints:* What the system should not do, constraints on the functional requirements that restrict the way in which the product or system should be developed
+ *Non-functional (Quality) requirements:* How the system should do it, quality attributes of the system, such as _performance, usability, reliability_, etc. They are important primarily to users or developers. They should not be hidden inside the functional requirements. They must have a *business justification*
== Fit criteria:
Fit criteria are used to determine whether a requirement has been met. They are used to test the requirements. They should be clear, unambiguous, and measurable. You need to understand the *rationale* to understand the fit criteria.
Fit criteria can be derived in a few different ways:
- *Scale measurement:* using a scale to measure the requirement
- *Quality requirements:* max 1 incident per 1000 hours, always available, etc.
- *Study:* study existing practices and new practices and see if there is a change
- *What is considered failure:* what is considered a failure of the requirement
- *Completed*
- *Create tests*
*Forms of fit criteria:*
- Text and numbers
- Graphics: diagrams, sketches, etc.
== Completeness:
Determine whether requirements are missing, prioritize requirements, and determine whether requirements are consistent and without conflicts.
Steps:
+ *Review specification*
+ *Inspections $->$ Fagan inspections:* a formal review process that involves a team of people who review the requirements document and identify any errors or omissions.
+ *Find missing & conflicting requirements*
+ *Prioritize requirements*
= Data driven RE:
take profit of the existence of large amounts of data in the form of feedback to guide requirement engineers in their decisions about what requirements to include in subsequent system releases.
Feedback can be analyzed using NLP and ML. Feedback can be gathered implicitly thru usage data or explicitly thru surveys. Context is important.
/ FAME: Framework for Adaptive Process Modeling and Execution. It is a framework that allows for the modeling and execution of adaptive processes. It is based on the idea that processes can be modeled as a set of activities that are executed in a specific order. The framework allows for the modeling of processes that are adaptive, meaning that they can change based on the context in which they are executed.
*Crowdbased RE:* is an umbrella term for automated or semi-automated approaches to gather and analyse information from a crowd to derive validated user requirements.
== Decision making:
Two key dimensions of decision making:
- Visualize data in an actionable manner
- Arrange decisions in the form of a software release plan
== Challenges:
- Integration with Data-oriented Analysis Cycles.
- Integration with Other Software Engineering Approaches.
- User Motivation and Trust.
- Context-Driven Feedback Gathering.
- Analysis of Implicit Feedback.
- Use of Domain Knowledge.
- Adoption by Companies
== Lessons learned:
Data-driven RE is promising but not free. It is different for every company, requires expertise and needs to be implemented in a incremental way. It also requires full transparency.
#pagebreak()
= Scrum & Agile:
== Product management vs project management:
- *Product management:* continuous, success when customer profitability, managed on customer adding value
- *Project management:* temporary, success when project is on time, on budget, on scope, managed on time, money and scope.
/ VUCA: #text[
Volatile, Uncertain, Complex, Ambiguous:
+ *Volatile:* The nature and dynamics of change, and the nature and speed of change forces and change catalysts.
+ *Uncertain:* The lack of predictability, the prospects for surprise, and the sense of awareness and understanding of issues and events.
+ *Complex:* The multiplex of forces, the confounding of issues, no cause-and-effect chain and confusion that surrounds organization.
+ *Ambiguous:* The haziness of reality, the potential for misreads, and the mixed meanings of conditions; cause-and-effect confusion.
]
The answer to VUCA is VUCA: Vision, Understanding, Courage, Adaptability.
== Agile:
A focus on the 3 V's: Value, Vision, Validation. The agile mindset is about delivering value to the customer. Agile frameworks embody this mindset into practical tools and techniques.
== Scrum:
Scrum Artifacts:
- *Product Backlog:* a prioritized list of all the work that needs to be done on the project.
- Feature requests
- Bug fixes
- Quality requirements
- *Sprint Backlog:* a list of tasks that need to be completed during the sprint. selected on:
- Value (ROI, customer satisfaction)
- Risk (dependencies, market trends, feature)
- Size (smaller)
- *Increment:* the sum of all the product backlog items completed during a sprint.
/ DOVE: Description, Order, Value, Effort. This is a way to prioritize the product backlog.
/ Technical debt: is the cost of additional rework caused by choosing an easy solution now instead of using a better approach that would take longer. It is a metaphor referring to the eventual consequences of poor system design, software architecture or software development within a code base.
*Scrum events:*
- *The sprint:* a time-boxed period of development, typically 2-4 weeks.
- *Sprint planning:* a meeting at the beginning of the sprint where the team decides what work they will complete during the sprint.
- *Daily stand-up:* a short meeting where the team discusses what they did yesterday, what they will do today, and any obstacles they are facing.
- *Sprint review:* a meeting at the end of the sprint where the team demonstrates the work they completed during the sprint.
- *Sprint Retrospective:* a meeting at the end of the sprint where the team discusses what went well, what could be improved, and what actions they will take to improve.
*Roles:*
- *Product Owner:* responsible for the product backlog and for maximizing the value of the product. Closer to the team than a product manager.
- *Scrum Master:* responsible for ensuring that the team is following the scrum process and removing any obstacles that are preventing the team from being successful.
- *Development Team:* responsible for delivering the product increment.
*User story:*
*As a [role], I want [goal], so that [reason].* A good user story should can be written by listening. You can use the snow card to write user stories.
= RE management:
As a RE manager, you manage requirements engineering artifacts, system context (changes in environment, like new tech) and the requirements engineering process (choose approach).
/ Traceability: is the ability to trace requirements from their origin to their implementation. It is important because it validates, avoids gold plating, and helps to manage change. It also makes sure someone is accountable for the requirement.
== RE prioritization:
Resources are limited, you need to prioritize. You can use the MoSCoW method: Must have, Should have, Could have, Won't have. The should be classified into different priority classes for each of the five RE activities:
- *Elicitation*
- *Documentation*
- *Agreement*
- *Validation*
- *Management*
Preparation activities:
+ *Determine which stakeholders to involve:* based on project goals
+ *Select the artifacts which are subject to prioritization:* goals first
+ *Define the prioritization criteria:* importance, urgency, risk, cost, etc.
+ *Select the appropriate prioritization technique.:* ranking, top 10, MoSCoW, Kano model, etc.
== Configuration management:
CM applied over the life cycle of a system provides visibility and control of its performance, functional, and physical attributes. CM verifies that a system performs as intended, and is identified and documented in sufficient detail to support its projected life cycle. It's about the versions of the requirement artifacts and Consistency between them.
#pagebreak()
= Negotiation:
Negotiation is about finding a solution that satisfies all parties. It's about finding a win-win solution. It's not conflict resolution. Negotiation is aimed at agreement between stakeholders, so all stakeholders should be involved.
+ Identify
+ Analyse
+ Resolve
+ Document |
|
https://github.com/mem-courses/calculus | https://raw.githubusercontent.com/mem-courses/calculus/main/homework-1/calculus-homework1.typ | typst | #import "../template.typ": *
#show: project.with(
title: "Calculus Homework #1",
authors: ((
name: "<NAME> (#47)",
email: "<EMAIL>",
phone: "3230104585"
),),
date: "September 24, 2023",
)
= 习题1-1 5(1)
#prob[求函数的定义域 $y = (x-2) sqrt(display((1 + x) / (1 - x)))$.]
应满足:
- $1-x != 0 arrow.r.double x != 1$
- $d(1+x)(1-x) >= 0 arrow.r.double -1<=x<=1$
综上,$-1<=x<1$.
= 习题1-1 5(3)
#prob[求函数的定义域 $y = display(sqrt(x) / sin(pi x))$.]
应满足:
- $x >= 0$
- $sin(pi x) != 0 arrow.r.double x in.not ZZ$
综上,$x in {x | x > 0 and x in.not ZZ}$.
= 习题1-1 5(5)
#prob[求函数的定义域 $y = arcsin(1-x) + lg(lg x)$.]
应满足
- $x>0$
- $lg x > 0 arrow.r.double x>1$
- $1 - x arrow.r.double -1 <= 1-x <= 1 arrow.r.double 0 <= x <= 2$
综上,$1 < x <= 2$.
= 习题1-1 19(1)
#prob[求下列函数的反函数 $y=display((1-x)/(1+x))$.]
易证明原函数是 $(-oo, -1) union (-1, oo)$ 到 $(-oo, -1) union (-1, oo)$ 的单射,故反函数存在.
令 $x = y', y = x'$,则有
$
x' = (1 - y') / (1 + y')
arrow.r.double
x' (1 + y') = 1 - y'
arrow.r.double
x' + x' dot y' = 1 - y' \
arrow.r.double
(x' + 1) y' = 1 - x'
arrow.r.double
y' = (1 - x') / (1 + x')
$
故原函数的反函数为 $display(y = (1 - x) / (1 + x))$.
= 习题1-1 19(3)
#prob[求下列函数的反函数 $y=display(cases(
x\, quad& x<1,
x^2\, quad& 1<=x<=4,
2^x\, quad& x>4,
))$]
当 $x in (-oo, 1)$ 时,$y = x in (-oo, 1)$;故这一部分的反函数为 $y = x,space x in (-oo, 1)$.
当 $x in [1, 4]$ 时,$y = x^2 in [1, 16]$;故这一部分的反函数为 $y = sqrt(x),space x in [1, 16]$.
当 $x in (4, +oo)$ 时,$y = 2^x in (16, oo)$;故这一部分的反函数为 $y = log_2(x),space x in (16, oo)$.
综上,原函数是 $RR$ 到 $RR$ 的单射,故反函数存在,为 $ y = cases(
x\, quad& x<1,
sqrt(x)\, quad& 1<=x<=16,
log_2(x)\, quad& x>16
) $
= 习题1-1 20
#prob[设 $phi(x) = display(cases(
0\, quad& x<=0,
x\, quad& x>0,
))$ 及 $psi(x) = display(cases(
0\, quad& x<=0,
-x^2\, quad& x>0,
))$.求 $phi(phi(x))$,$psi(psi(x))$,$phi(psi(x))$,$psi(phi(x))$.]
$
phi(phi(x))
&= cases(phi(0)\, quad& x<=0, phi(x)\, quad& x>0) quad
&&= cases(0\, quad& x<=0, x\, quad& x>0) quad
&&= phi(x) \
psi(psi(x))
&= cases(psi(0)\, quad& x<=0, psi(-x^2)\, quad& x>0) quad
&&= cases(0\, quad& x<=0, 0\, quad& x>0) quad
&&= 0 \
phi(psi(x))
&= cases(phi(0)\, quad& x<=0, phi(-x^2)\, quad& x>0) quad
&&= cases(0\, quad& x<=0, 0\, quad& x>0) quad
&&= 0 \
psi(phi(x))
&= cases(psi(0)\, quad& x<=0, psi(x)\, quad& x>0) quad
&&= cases(0\, quad& x<=0, -x^2\, quad& x>0) quad
&&= psi(x) \
$
= 课堂例题 9/21 8:32
#prob[证明:$f(x) = display(1/x)$ 在 $(0,1)$ 上无界.]
$forall M_0 in R_(>0), quad exists x_1 = display(1 / (M_0 + 1)) in (0,1) > M_0$.
故 $f(x)$ 在 $(0,1)$ 上无界.
= 课堂例题 9/21 9:31
#prob[设 $f(0) = 0$ 且 $x != 0$ 时 $a f(x) + b f(display(1/x)) = display(c/x)$,其中 $a,b,c$ 为常数,且 $a != b$,证明 $f(x)$ 是奇函数.]
TBD
= 习题1-1 22
#prob[设 $f_n (x)$ 为连续 $n$ 个 $f(x)$ 的复合,若 $f(x) = display(x/sqrt(1+x^2))$,求 $f_n (x)$.]
下归纳证明 $f_n (x) = display(x / sqrt(1 + n x^2))$:
- 当 $n = 1$ 时显然成立;
- 假设 $n = k$ 时成立,下证明 $n=k+1$ 时也成立:
$
f_(k+1)(x) = (f_k (x)) / sqrt(1 + f_k^2 (x)) = display(x / sqrt(1 + k x^2)) / display(sqrt(1 + display(x^2 / (1 + k x^2)))) = display(x / sqrt(1 + k x^2)) / display(sqrt(display((1 + (k+1)x^2) / (1 + k x^2)))) = x / sqrt(1 + (k+1)x^2)
$
故原命题得证.
= 习题1-1 24
#prob[证明定义于对称区间 $(-tau, tau)$ 内的任何函数 $f(x)$ 可以表示成一个偶函数与一个奇函数之和的形式.]
构造偶函数 $g_(x)$ 和奇函数 $h_(x)$ 满足:
$
forall x>0\, &quad f(x) = g(x) + h(x) \
forall x<0\, &quad f(x) = g(-x) - h(-x) \
$
可以得到,$forall x>0$,
$
f(x) &= g(x) + h(x) \
f(-x) &= g(x) - h(x) \
$
解得
$
cases(
g(x) &= 1/2 (f(x) + f(-x)),
h(x) &= 1/2 (f(x) - f(-x)),
)\, quad quad x>0
$
根据奇偶函数的定义,可以得到 $g$ 和 $h$
$
g(x) &= cases(
1/2 (f(x) + f(-x))\,quad&0<x<tau,
0\,quad&x=0,
1/2 (f(x) + f(-x))\,quad&-tau<x<0,
)\
h(x) &= cases(
1/2 (f(x) - f(-x))\,quad&0<x<tau,
f(0)\,quad&x=0,
1/2 (f(x) - f(-x))\,quad&-tau<x<0,
)\
$
故原命题得证.
= 习题1-1 27 (2)
#prob[判断函数的有界性:$f(x) = display(x/(1+x^2))$]
下证明:$|f(x)|<=1/2$ 对 $x in RR$ 均成立.
$
|f(x)| = |x|/(1+x^2) <= 1/2
arrow.r.double
x^2 - 2|x| + 1 >= 0
arrow.r.double
(|x| - 1)^2 >= 0
$
对于 $x in RR$ 显然成立.故 $f$ 为有界函数.
= 习题1-1 27 (4)
#prob[判断函数的有界性:$f(x) = e^(1/x)$]
对于任意正常数 $M$,取 $display(x_0 = 1/display(ln(M) + 1))$,则有
$
f(x_0) = e^display(ln(M)+1) = e dot M > M
$
故 $f$ 为无界函数. |
|
https://github.com/coljac/typst-mnras | https://raw.githubusercontent.com/coljac/typst-mnras/main/README.md | markdown | MIT License | # Typst template for MNRAS
This is a draft of a Typst template for the Monthly Notices of the Royal Astronomical Society journal. [Typst](https://github.com/typst) is an amazingly awesome successor to Latex.
There are a few main outstanding issues:
1. The ability to have a figure float outside of the two-column format (so tables and images can span the page). See: https://github.com/typst/typst/issues/553
2. The citations need some tweaking. Currently, `#cite("jacobs2023paper", brackets: false)` results in "Jacobs 2023" not "Jacobs (2023)" as you'd expect. The `cite` function needs a bit more work. See: https://github.com/typst/typst/issues/658
3. ~~Footnotes~~ Done!
|
https://github.com/TeddyHuang-00/typpuccino | https://raw.githubusercontent.com/TeddyHuang-00/typpuccino/main/README.md | markdown | MIT License | # Catypuccin
User everyone's favorite [Catppuccin color palettes](https://github.com/catppuccin/catppuccin) in your Typst projects.
## Usage
To use the Catppuccin color palette in your Typst project, add the following import statement to your Typst file, and then you can use all the colors from the Catppuccin color palette.
```typst
#import "@preview/catypuccin:0.1.0": latte, frappe, macchiato, mocha
#square(fill: mocha.red)
```
For more information on available colors, see the [this example](./example.pdf).
|
https://github.com/yaoyuanArtemis/resume | https://raw.githubusercontent.com/yaoyuanArtemis/resume/main/cv_2-zh.typ | typst | Do What The F*ck You Want To Public License | #import "template.typ": *
#import "data.typ": *
#show: project.with(
title: namezh,
author: authorzh,
)
#chiline()
#selfzh
#group((
leftsection(edutitlezh),
eduzh,
leftsection(techtitlezh),
techzh,
leftsection(projecttitlezh),
projectexperiencezh,
leftsection(activitytitlezh),
activityzh,
leftsection(hobbiestitlezh),
hobbieszh,
))
|
https://github.com/AliothCancer/AppuntiUniversity | https://raw.githubusercontent.com/AliothCancer/AppuntiUniversity/main/FormularioFisicaPresentazione.typ | typst | #import "latest_style.typ": presentation_style
//#import "@preview/plotst:0.2.0": *
#presentation_style(title: "Formulario di Fisica Tecnica ITPS")[
#include "capitoli_fisica/grandezze_termodinamiche.typ"
#include "/capitoli_fisica/trasformazioni.typ"
#include "/capitoli_fisica/macchine.typ"
#include "/capitoli_fisica/cicli.typ"
#include "capitoli_fisica/acqua_vapore.typ"
#include "capitoli_fisica/aria_umida.typ"
#include "capitoli_fisica/trasmissione_stazionaria.typ"
#include "capitoli_fisica/trasmissione_non_stazionaria.typ"
#include "capitoli_fisica/scambiatori_calore.typ"
// ESERCIZI
#include "capitoli_fisica/esercizi/esercitazione1p2.typ"
#include "capitoli_fisica/esercizi/esercitazione3.typ"
#include "capitoli_fisica/esercizi/esercitazione4.typ"
#include "capitoli_fisica/esercizi/esercitazione5.typ"
#include "capitoli_fisica/esercizi/esercitazione6.typ"
#include "capitoli_fisica/esercizi/esercitazione7.typ"
#include "capitoli_fisica/esercizi/esercitazione8.typ"
]
|
|
https://github.com/ralphmb/My-Dissertation | https://raw.githubusercontent.com/ralphmb/My-Dissertation/main/sections/datacollection.typ | typst | Creative Commons Zero v1.0 Universal | The bulk of our data were obtained from FootyStats for a fee, selecting the 2022/23 season option and downloading the .csv called Match H2H CSV. Data on the locations of each team's stadium were compiled ourselves using google maps. Data on the standings and scores of each team from the previous EPL season were obtained from TNTSports, who allow for non-commercial use.\
We will use information on the distances that an away team has to travel to attend a match. These distances were computed using the co-ordinate data mentioned above, and the `distVincentyEllipsoid` function in the `geosphere` package in R. We could have taken travel distance data directly from google maps, which would also calculate actual distance rather than as-the-crow-flies, but this would require either manually collecting 190 distances or automation using the API.\
The previous seasons standings data were copied into a spreadsheet and cleaned up, changing team names to follow the same standard as the FootyStats data, before being exported to a .csv file.\
The relevant data from FootyStats were extracted, some processed, and saved in a new file. Processing included reading the first goal time out of a string containing a list of all goal times, for instance taking the string "10,27,64" into the numeric value 10.\
For a 3rd party source on what exactly to count as a derby game we used an article by The Mirror @derbygames. This was processed using a python script (see appendices) and included in the data preparation R script.\
We will use data on the number of league points attained by a team in the previous Premier League season, for a short discussion on why we use this variable in particular please see the 'Testing correlations' section under exploratory analysis.
/*The first step we wanted to carry out after data collection was filtering out matches in which red cards were awarded to one or more teams. Due to the absence of one or more players it was assumed that the results of any analysis based on these matches would be unsuitable for predictive purposes. At least one red card was awarded to the home team on 18 occasions, to the away team on 10, leaving a total of 353 / 380 games of the season with none handed out. Most analysis will be performed on data of red-card-free matches, any analysis with these matches included will be noted as such.*/ |
https://github.com/Shuenhoy/modern-zju-thesis | https://raw.githubusercontent.com/Shuenhoy/modern-zju-thesis/master/utils/header.typ | typst | MIT License | #import "./fonts.typ": 字号, 字体
#let header(
stroke: 0.5pt,
spacing: 0.5em,
font: 字体.宋体,
size: 字号.小五,
left: none,
right: none,
center: none,
) = {
set text(font: font, size: size)
locate(loc => {
if not (query(<mzt:no-header-footer>, loc).filter(el => el.location().page() == loc.page()) != ()) {
stack(
spacing: spacing,
grid(
columns: (1fr, 1fr, 1fr),
align: (alignment.left, alignment.center, alignment.right),
left, center, right,
),
line(length: 100%, stroke: stroke),
)
}
})
}
#let footer(left: none, right: none, center: none) = locate(loc => {
if not (query(<mzt:no-header-footer>, loc).filter(el => el.location().page() == loc.page()) != ()) {
let fleft(numbering) = {
if type(left) == function {
left(numbering)
} else {
left
}
}
let fcenter(numbering) = {
if type(center) == function {
center(numbering)
} else {
center
}
}
let fright(numbering) = {
if type(right) == function {
right(numbering)
} else {
right
}
}
context [
#set text(字号.小五)
#let page-numbering = page.numbering
#if page-numbering == none {
page-numbering = "1"
}
#let numbering = counter(page).display(page-numbering)
#grid(
columns: (1fr, 1fr, 1fr),
align: (alignment.left, alignment.center, alignment.right),
fleft(numbering), fcenter(numbering), fright(numbering),
)
]
}
}) |
https://github.com/Myriad-Dreamin/typst.ts | https://raw.githubusercontent.com/Myriad-Dreamin/typst.ts/main/fuzzers/corpora/text/linebreak_04.typ | typst | Apache License 2.0 |
#import "/contrib/templates/std-tests/preset.typ": *
#show: test-page
// Test hard break directly after normal break.
Hard break directly after \ normal break.
|
https://github.com/jgm/typst-hs | https://raw.githubusercontent.com/jgm/typst-hs/main/test/typ/layout/page-04.typ | typst | Other | // Just page followed by pagebreak.
// Should result in one red-colored A11 page and one auto-sized page.
#page("a11", flipped: true, fill: red)[]
#pagebreak()
|
https://github.com/Skimmeroni/Appunti | https://raw.githubusercontent.com/Skimmeroni/Appunti/main/Metodi%20Algebrici/Interi/Induzione.typ | typst | Creative Commons Zero v1.0 Universal | #import "../Metodi_defs.typ": *
#principle("Principio del buon ordinamento")[
Sia $S$ un sottoinsieme non vuoto di $ZZ$ limitato inferiormente
(esiste un $n_(0) in ZZ$ tale che $s gt.eq n_(0)$, $forall s in S$).
Allora $S$ ha minimo, ovvero esiste un $m in S$ tale che $s gt.eq m$,
$forall s in S$.
]
#principle("Principio di induzione")[
Dato un numero fissato $n_(0) in ZZ$, sia $P(n)$ una proposizione
dipendente da $n in ZZ$, con $n gt.eq n_(0)$. Si supponga che siano
verificate le seguenti ipotesi:
- $P(n_(0))$ é vera;
- $forall n$, supponendo che sia vera $P(n)$ é possibile dimostrare che
lo sia anche $P(n + 1)$.
Allora $P(n)$ é vera $forall n in ZZ$
]
#example[
Si consideri la seguente proposizione, dipendente da $n$:
$ sum_(i = 1)^(n) (2i - 1) = n^(2), forall n gt.eq 1 $
É possibile applicarvi il principio di induzione ponendo
$n_(0) = 1$. Nello specifico:
- $P(1)$ é vera. Infatti, $sum_(i = 1)^(1) (2i - 1) = (2 dot 1)
- 1 = 2 - 1 = 1$ e $1^(2) = 1$;
- Supponendo che sia vera $P(n)$, si dimostri che é vera $P(n + 1)$,
ovvero che sia vera $sum_(i = 1)^(n + 1) (2i - 1) = (n + 1)^(2)$.
Si ha:
$ sum_(i = 1)^(n + 1) (2i - 1) = (2(n + 1) - 1) + sum_(i = 1)^(n) (2i - 1) =
2n + 1 + sum_(i = 1)^(n) (2i - 1) = 2n + 1 + n^(2) $
Che é peró proprio la formula per il calcolo del quadrato di binomio.
Pertanto $n^(2) + 1 + 2n = (n + 1)^(2) = sum_(i = 1)^(n + 1) (2i - 1)$
Essendo verificate entrambe le ipotesi del principio di induzione, si ha
che $P(n)$ é vera $forall n gt.eq 1$
]
Il principio di induzione puó essere riespresso in termini diversi.
#principle("Principio di induzione forte")[
Dato un numero fissato $n_(0) in ZZ$, sia $P(n)$ una proposizione
dipendente da $n in ZZ$, con $n gt.eq n_(0)$. Si supponga che siano
verificate le seguenti ipotesi:
- $P(n_(0))$ é vera;
- $forall m$ tale che $n_(0) lt.eq m < n$, supponendo che sia vera $P(m)$
é possibile dimostrare che lo sia anche $P(n)$.
Allora $P(n)$ é vera $forall n in ZZ$
]
L'aggettivo _forte_ non sta ad indicare che il principio di induzione forte
abbia un maggior potere espressivo del principio di induzione "standard";
indica semplicemente che si basa su una ipotesi (la seconda) piú forte di
quella usata dalla formulazione precedente. Infatti, una dimostrazione
compiuta mediante una delle due forme del principio di induzione puó essere
convertita in una dimostrazione analoga compiuta nell'altra forma.
#theorem[
Il principio di induzione, il principio di induzione forte
ed il principio del buon ordinamento sono equivalenti.
]
#proof[
La dimostrazione si compone di tre parti.
+ Assumendo come vero il principio di induzione, si dimostri la
validitá del principio di induzione forte. Sia pertanto $P(n)$
una proposizione dipendente da $n$ e sia $n_(0) in ZZ$ un
valore fissato. Si supponga che siano verificate le seguenti
ipotesi:
- $P(n_(0))$ é vera;
- $forall m$ tale che $n_(0) lt.eq m < n$, supponendo che sia
vera $P(m)$ é possibile dimostrare che lo sia anche $P(n)$.
In particolare, dunque, se $P(n - 1)$ é vera allora $P(n)$ é vera.
Il principio di induzione implica quindi che $P(n)$ é vera per ogni
$n gt.eq n_(0)$;
+ Assumendo come vero il principio di induzione forte, si dimostri
la validitá del principio del buon ordinamento. Sia pertanto $S
subset.eq ZZ$ un sottoinsieme non nullo dei numeri interi
inferiormente limitato da $n_(0)$. Si supponga per assurdo il
principio del buon ordinamento non sia valido, ovvero che $S$ non
ammetta minimo. Si consideri la proposizione $P(n)$ dipendente da $n$:
#v(1em)
#align(center)[
$P(n) =$ _Non esiste alcun numero intero minore o uguale ad_ $n$ _che appartenga ad_ $S$
]
#v(1em)
É possibile applicare a $P(n)$ il principio di induzione forte. La
prima ipotesi é verificata, perché se $n_(0)$ appartenesse ad $S$,
essendone il limite inferiore, allora ne sarebbe necessariamente
anche il minimo.
Sia dunque $n$ un intero maggiore di $n_(0)$. Si assuma allora
che $forall m$ tale che $n_(0) lt.eq m < n$, supponendo che sia
vera $P(m)$ é possibile dimostrare che lo sia anche $P(n)$. Si
supponga che $P(n)$ sia falsa: esiste allora qualche $t lt.eq n,
t in S$. Ma questo non é possibile, perché $forall t in ZZ,
n_(0) lt.eq t lt.eq n$ si suppone $P(t)$ vera, e quindi $t in.not
S$. Occorre allora dedurre che $S$ ammetta minimo, e quindi se si
assume come valido il principio di induzione forte allora é valido
il principio del buon ordinamento.
+ Assumendo come vero il principio del buon ordinamento, si dimostri
la validitá del principio di induzione. Dato un numero fissato $n_(0)
in ZZ$, sia $P(n)$ una proposizione dipendente da $n in ZZ$,
con $n gt.eq n_(0)$. Si supponga che siano verificate le seguenti ipotesi:
- $P(n_(0))$ é vera;
- $forall n$, supponendo che sia vera $P(n)$ é possibile dimostrare
che lo sia anche $P(n + 1)$.
Si consideri l'insieme $S subset.eq ZZ$ costituito da tutti gli $n
gt.eq n_(0)$ per i quali $P(n)$ é falsa. Se il principio di induzione
fosse verificato, tale insieme dovrebbe essere l'insieme vuoto. Si
assuma per assurdo che tale insieme non sia vuoto: per il principio
del buon ordinamento tale insieme deve ammettere un minimo, sia questo
$m$, tale per cui $P(m)$ é falsa.
Dato che l'insieme contiene solo interi $n$ tali per cui $n gt.eq n_(0)$
(ma non tutti), dovrá aversi che $m > n_(0)$, ovvero che $m - 1 gt.eq
n_(0)$. Ma allora $P(m - 1)$ deve essere vera, perché altrimenti si avrebbe
$m - 1 in S$ ed $m$ non sarebbe il minimo di $S$. Applicando la seconda
ipotesi sopra definita, si ha che $P(m + 1 - 1) = P(m)$ é vera, ma questo
é in contraddizione con quanto evidenziato in precedenza. Occorre allora
dedurre che se si assume come valido il principio del buon ordinamento,
allora é valido il principio di induzione forte.
]
|
https://github.com/Myriad-Dreamin/typst.ts | https://raw.githubusercontent.com/Myriad-Dreamin/typst.ts/main/fuzzers/corpora/math/style_01.typ | typst | Apache License 2.0 |
#import "/contrib/templates/std-tests/preset.typ": *
#show: test-page
// Test forcing a specific style.
$A, italic(A), upright(A), bold(A), bold(upright(A)), \
serif(A), sans(A), cal(A), frak(A), mono(A), bb(A), \
italic(diff), upright(diff), \
bb("hello") + bold(cal("world")), \
mono("SQRT")(x) wreath mono(123 + 456)$
|
https://github.com/lucannez64/Notes | https://raw.githubusercontent.com/lucannez64/Notes/master/Klyt.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: "Klyt",
authors: (
"<NAME>",
),
date: "10 Août, 2024",
)
#set heading(numbering: "1.1.")
Current Address:
#link("https://klyt-git-master-lucannez64.vercel.app/")[Klyt]
|
|
https://github.com/kdog3682/mathematical | https://raw.githubusercontent.com/kdog3682/mathematical/main/0.1.0/src/fraction.typ | typst | #import "@local/typkit:0.1.0": *
#let fraction(a, b, align: false) = {
let a = mathup(a)
let b = mathup(b)
if align == true and false == true {
context {
let la = measure(a).width
let lb = measure(b).width
let p = la - lb
if p > 0pt {
// add padding to the bottom
// TODO: needs to not align
math.display(math.frac(a, h(p) + b))
} else {
// add padding to the top
math.display(math.frac(h(-1 * p) + a, b))
}
}
} else {
math.display(math.frac(a, b))
}
}
|
|
https://github.com/jassielof/cv | https://raw.githubusercontent.com/jassielof/cv/main/doc/typst/cv-chalup.typ | typst | #import "template.typ": *
#show: resume
#header(
name: "<NAME>",
phone: "+591 77610067",
email: "<EMAIL>",
linkedin: "juan-diego-chalup-roca-47a200218",
github: "jdiego00",
// gitlab: "jassiel",
// site: "jassielof",
location: "Santa Cruz, Bolivia",
)
#resume_heading[Educación]
#edu_item(
name: "Universidad Privada de Santa Cruz de la Sierra",
degree: "Ingenieria de Sistemas",
location: "Santa Cruz, Bolivia",
date: "Feb. 2021 -- Presente"
)
#edu_item(
name: "La Salle",
degree: "Bachiller",
location: "Santa Cruz, Bolivia",
date: "Feb. 2005 - Dic. 2020"
)
#resume_heading[Experiencia]
#exp_item(
role: "Pasante en la UPSA para ayuda en el proyecto MOISES",
name: "Universidad Privada de Santa Cruz de la Sierra",
location: "Santa Cruz, Bolivia",
date: "Feb. 2024 -- Presente",
[Ayude en el desarrollo y en la investigacion necesaria para la implementacion del proyecto MOISES],
)
#exp_item(
role: "Desarrollador FullStack (javaScript, typeScript)",
name: "gas energy latin america, mana y cartagena",
location: "Santa Cruz, Bolivia",
date: "Nov. 2023 -- Presente",
[Desarrollo]
)
#resume_heading("Proyectos")
#project_item(
name: "Desarrollo de Pagina Web",
skills: "NextJS, React, JavaScript",
date: "Ene. 2024 -- Presente",
[Desarrollo de un sistema Web para la presentacion de la pagina web de la empresa Gas Energy Latin America]
)
#project_item(
name: "Desarrollo de Pagina Web",
skills: "TypeScript, React",
date: "Nov. 2023 -- Ene. 2024",
[Desarrollé un sistema Web para la gestion de Cotizaciones de la empresa Mana y Cartagena]
)
#project_item(
name: "Gestión para Concecionaria de Automoviles",
skills: "C#, MySQL",
date: "Nov. 2023 -- Dic. 2023",
[Desarrollé un sistema para la gestión de una Concecionaria como proyecto final para la materia de Base de Datos en base a requerimientos, además de algunas funcionalidades adicionales como generación de reportes.],
[La modeloación de la base datos se realizó con sus tres faces (conceptual, lógica y física) y se implementó en MySQL.]
)
#resume_heading("Habilidades")
#skill_item(
category: "Lenguajes",
skills: "Python, C++, PostgreSQL, JavaScript, TypeScript, C#, Java"
)
#skill_item(
category: "Frameworks",
skills: "React, NextJS, Maven, Spring Boot"
)
#skill_item(
category: "Herramientas de Desarrollo",
skills: "Git, GitHub, Visual Studio Code, Visual Studio, CLion, PyCharm, Jupyter Notebook, Linux (Debian/Ubuntu, Ubuntu server), Windows"
)
#skill_item(
category: "Librerías",
skills: "NumPy, SciPy, Pandas, EnergiaPy, React"
) |
|
https://github.com/HellOwhatAs/whiledb-typ | https://raw.githubusercontent.com/HellOwhatAs/whiledb-typ/main/README.md | markdown | # whiledb-typ
[WhileDB](https://github.com/HellOwhatAs/While-DB)
## Example
Example: [example.typ](example.typ)

## Build
```sh
cargo build --release --target wasm32-unknown-unknown
cp ./target/wasm32-unknown-unknown/release/whiledb_typ.wasm ./typst-package
```
Copy files in `./typst-package` to typst [Local packages](https://github.com/typst/packages#local-packages) (with namespace `local`)
Then whiledb-typ could be imported via
```typ
#import "@local/whiledb:0.1.0": *;
``` |
|
https://github.com/mem-courses/calculus | https://raw.githubusercontent.com/mem-courses/calculus/main/homework-2/homework12.typ | typst | #import "../template.typ": *
#show: project.with(
course: "Calculus II",
course_fullname: "Calculus (A) II",
course_code: "821T0160",
title: "Homework #12: 第一类曲面积分 & 第二类曲线积分",
authors: (
(
name: "<NAME>",
email: "<EMAIL>",
id: "#198",
),
),
semester: "Spring-Summer 2024",
date: "May 7th, 2024",
)
#let iintd = iintb($D$)
#let iints = iintb($S$)
#let iintsg = iintb($sigma$)
#let iiintv = iiintb($V$)
#let iiintog = iiintb($Omega$)
= 习题9-4
== P178 3(1)
#prob[
计算第一类曲面积分:
$
iints (x+y+z) dif S
$
其中 $S$ 为曲面 $x^2 + y^2 + z^2 = a^2$,$z>=0$。
]
由题意得
$
z = sqrt(a^2 - x^2 - y^2),space (x,y) in sigma: x^2 + y^2 <= a^2
$
则
$
dz / dx = -x / sqrt(a^2 - x^2 - y^2); quad quad
dz / dy = -y / sqrt(a^2 - x^2 - y^2)
$
代入第一类曲面积分的公式得
$
iints (x+y+z) dif S
&= iintsg (x+y+sqrt(a^2 - x^2 - y^2)) sqrt(1+x^2/(a^2 - x^2 - y^2) + y^2/(a^2 - x^2 - y^2)) dif sigma\
&= iintsg (x+y+sqrt(a^2 - x^2 - y^2)) a / sqrt(a^2 - x^2 - y^2) dx dy\
&= int_(-a)^a dx int_(-sqrt(a^2 - x^2))^sqrt(a^2 - x^2) (x+y+sqrt(a^2 - x^2 - y^2)) a / sqrt(a^2 - x^2 - y^2) dy\
&= int_(-a)^a (pi a x + 2 a sqrt(a^2 - x^2)) dif x\
&= 4a int_0^a sqrt(a^2 - x^2) dx = pi a^3
$
== P178 3(3)
#prob[
计算第一类曲面积分:
$
iints abs(x y z) dif S
$
其中 $S$ 为曲面 $z=x^2 + y^2$ 被平面 $z=1$ 所割下的部分。
]
设 $sigma: x^2+y^2<=1, x>=0, y>=0$,由对称性可知
$
iints abs(x y z) dif S
= 4 iintsg abs(x y z) sqrt(1+4x^2 + 4y^2) dif sigma
$
作极坐标代换:
$
x = sqrt(z) cos theta; quad y = sqrt(z) sin theta quad (0<=theta<=pi / 2)
$
则
$
iints abs(x y z) dif S
&= 4 int_0^(pi / 2) dif theta int_0^1 abs(sqrt(z) sin theta dot sqrt(z) cos theta dot z) sqrt(1+4z) sqrt(z) dif sqrt(z)\
&= 2 int_0^(pi / 2) sin theta cos theta dif theta int_0^1 z^2 sqrt(1+4 z) dif z\
&= int_0^1 z^2 sqrt(1+4z) dif z
= (125sqrt(5) - 1) / 420
$
== P178 4
#prob[
求抛物面壳 $display(z = 1/2 (x^2 + y^2) space (0<=z<=1))$ 的质量。此壳的密度按规律 $rho = z$ 而变化。
]
$
M
= iints dif M
= iints z dif V
= iintsg (x^2+y^2) / 2 sqrt(1+x^2+y^2) dif sigma
$
其中,$sigma: x^2+y^2<=2$。作极坐标代换:
$
x = r cos theta; quad y = r sin theta quad (0<=theta<=2 pi,space 0<=r<=sqrt(2))
$
得
$
M
&= int_0^(2pi) dif theta int_0^sqrt(2) r^2 / 2 sqrt(1+r^2) dot r dif r\
&= 2 pi dot (6 sqrt(3) + 1) / 15
= (12 sqrt(3) + 2) / 15 pi
$
= 习题10-1
== P212 1(1)
#prob[
计算第二类曲线积分:
$
intb(C) (x^2 + y^2) dx + (x^2 - y^2) dy
$
其中 $C$ 为曲线 $y=1-abs(1-x) space (0<=x<=2)$ 沿参数增加的方向。
]
- 当 $0<=x<=1$ 时,$y = 1 - (1 - x) = x$,$dy = dx$;
- 当 $1<x<=2$ 时,$y = 1 - (x - 1) = -x + 2$,$dy = -dx$。
故:
$
intb(C) (x^2 + y^2) dx + (x^2 - y^2) dy
&= int_0^1 2x^2 dx + int_1^2 (x^2 + (2-x)^2) dx - (x^2 - (2-x)^2) dx = 4 / 3
$
== P212 1(3)
#prob[
计算第二类曲线积分:
$
intcb(C) ((x+y) dx - (x-y) dy) / (x^2 + y^2)
$
其中 $C$ 沿逆时针方向通过圆周 $x^2 + y^2 = a^2$。
]
作极坐标代换:
$
x = a cos theta; quad y = a sin theta quad (0<=theta<=2pi)
$
故
$
intcb(C) ((x+y) dx - (x-y) dy) / (x^2 + y^2)
&= int_0^(2 pi) ((a cos theta + a sin theta) dif (a cos theta) -
(a cos theta - a sin theta) dif (a sin theta)) / (a^2)\
&= int_0^(2 pi) ((cos theta + sin theta) dot (-sin theta) - (cos theta - sin theta) dot cos theta) dif theta\
&= int_0^(2 pi) -(cos^2 theta + sin^2 theta) dif theta\
&= - int_0^(2 pi) dif theta
= - 2pi
$
== P212 1(5)
#prob[
计算第二类曲线积分:
$
intcb(accent(O A B C O, paren.t)) arctan y / x dy - dx
$
其中 $accent(O A B, paren.t)$ 为抛物线段 $y=x^2$,$overline(B C O)$ 为直线段 $y=x$,$B$ 点坐标为 $(1,1)$。
]
$
intcb(accent(O A B C O, paren.t)) (arctan y / x dy - dx)
&= intb(accent(O A B, paren.t)) (arctan y / x dy - dx)
+ intb(overline(O B C)) (arctan y / x dy - dx)\
&=int_0^1 (arctan x^2 / x dif (x^2) - dx)
- int_0^1 (arctan x / x dif x - dx) \
&= int_0^1 2x arctan x dx - int_0^1 dx - int_0^1 (arctan 1 - 1) dx\
&= atpos(x^2 arctan x, 0, 1) - int_0^1 (x^2) / (1+x^2) dx - 1 - (pi / 4 - 1) \
&= pi / 4 - atpos((x - arctan x), 0, 1) - pi / 4\
&= arctan 1 - 1 = pi / 4 - 1
$
== P212 2(1)
#prob[
计算第二类曲线积分:
$
intb(C) (y^2 - z^2) dx + 2y z dy - x^2 dz
$
其中 $C$ 为曲线 $x=t,space y=t^2,space z=t^3 space(0<=t<=1)$ 依参数
增加的方向。
]
$
intb(C) (y^2 - z^2) dx + 2y z dy - x^2 dz
&= int_0^1 (t^4 - t^6) dt + 2 t^5 dot 2 t dt - t^2 dot 3 t^2 dt\
&= int_0^1 (3 t^6 - 2 t^4) dt = 1 / 35
$
== P212 2(3)
#prob[
计算第二类曲线积分:
$
intb(C) (y^2 - z^2) dx + (z^2 - x^2) dy + (x^2 - y^2) dz
$
其中 $C$ 为维维安尼曲线 $x^2+y^2+z^2=a^2, space x^2+y^2=a x space (z>=0, space a>0)$,从 $O x$ 轴的方向看去,此曲线是沿逆时针方向进行的。
]
根据
$
x^2 + y^2 = a x
==> (x-a / 2)^2 + y^2 = (a / 2)^2
$
作极坐标代换
$
x = a / 2 + a / 2 cos theta; quad y = a / 2 sin theta;
$
$
z
&= sqrt(a^2 - x^2 - y^2)
= a / 2 sqrt(4 - (1 + cos theta)^2 - sin^2 theta)
= a / 2 sqrt(2 - 2 cos theta) \
&= a / 2 sqrt(2 (1 - 1 + 2 sin^2 theta/2 ))
= a sin theta / 2
$
故
$
& intb(C) (y^2 - z^2) dx + (z^2 - x^2) dy + (x^2 - y^2) dz\
=& int_0^(2pi) ((a / 2 sin theta)^2 - (a sin theta / 2)^2) (-a / 2 sin theta) dif theta\
& quad quad + int_0^(2pi) ((a sin theta / 2)^2 - (a / 2 + a / 2 cos theta)^2) (a / 2 cos theta) dif theta\
& quad quad + int_0^(2pi) ((a / 2 + a / 2 cos theta)^2 - (a / 2 sin theta)^2) (a / 2 cos theta / 2) dif theta\
=& -pi / 4 a^3
$ |
|
https://github.com/mem-courses/discrete-mathmatics | https://raw.githubusercontent.com/mem-courses/discrete-mathmatics/main/homework/week14.typ | typst | MIT License | #import "../template.typ": *
#import "../functions.typ": *
#show: project.with(
course: "Discrete Mathmatics",
course_fullname: "Discrete Mathematics and Application",
course_code: "211B0010",
title: "Homework #14: Problems on Graphs",
authors: (
(
name: "<NAME>",
email: "<EMAIL>",
id: "A10",
),
),
semester: "Spring-Summer 2024",
date: "June 1, 2024",
)
== 10.6 Shortest-Path Problems
#hw("3")[
Find the length of a shortest path between $a$ and $z$ in the given weighted graph.
#align(center, image("images/2024-06-01-12-52-31.png", width: 50%))
][
The shortest path between $a$ and $z$ is $a->c->d->e->g->h$, with a length of $16$.
#align(center, image("images/2024-06-03-11-50-59.png", width: 54%))
]
#hw("17(a)")[
The weighted graphs in the figures here show some major roads in New Jersey. Part (a) shows the distances between cities on these roads; part (b) shows the tolls.
#align(center, image("images/2024-06-01-12-53-37.png", width: 50%))
Find a shortest route in distance between Newark and Camden, and between Newark and Cape May, using these roads.
][
The shortest route is Newark $->$ Woodbridge $->$ Trenton $->$ Camden $->$ Cape May with a total distance of 165.
#align(center, image("images/2024-06-03-11-52-35.png", width: 53%))
]
#hw("26")[
Solve the traveling salesperson problem for this graph by finding the total weight of all Hamilton circuits and determining a circuit with minimum total weight.
#align(center, image("images/2024-06-01-12-55-28.png", width: 25%))
][
All possible Hamilton circuits is listed as follows:
- ${a,b,c,d,e}$: $3 + 10 + 6 + 1 + 7 = 27$
- ${a,b,c,e,d}$: $3 + 10 + 5 + 1 + 4 = 23$
- ${a,b,d,c,e}$: $3 + 9 + 6 + 5 + 7 = 30$
- ${a,b,d,e,c}$: $3 + 9 + 1 + 5 + 8 = 26$
- ${a,b,e,c,d}$: $3 + 2 + 5 + 6 + 4 = 20$
- ${a,b,e,d,c}$: $3 + 2 + 1 + 6 + 8 = 20$
- ${a,c,b,d,e}$: $8 + 10 + 9 + 1 + 7 = 35$
- ${a,c,b,e,d}$: $8 + 10 + 2 + 1 + 4 = 25$
- ${a,c,d,b,e}$: $8 + 6 + 9 + 2 + 7 = 32$
- ${a,c,e,b,d}$: $8 + 5 + 2 + 9 + 4 = 28$
- ${a,d,b,c,e}$: $4 + 9 + 10 + 5 + 7 = 35$
- ${a,d,c,b,e}$: $4 + 6 + 10 + 2 + 7 = 29$
Thus we can find that circuits with minimum total weight $20$ are ${a,b,e,c,d}$ and ${a,b,e,d,c}$.
]
== 10.7 Planar Graphs
#hw("7")[
Determine whether the given graph is planar. If so, draw it so that no edges cross.
#align(center, image("images/2024-06-01-12-56-05.png", width: 25%))
][
The given graph is planar.
#align(center, image("images/2024-06-03-11-54-16.png", width: 20%))
]
#hw("20")[
Determine whether the given graph is homeomorphic to $K_(3,3)$.
#align(center, image("images/2024-06-01-12-56-46.png", width: 45%))
][
Remove vertices $c$ and $e$, and contract their edges. That is remove edges $(a,e)$, $(e,g)$, $(b,c)$, $(c,h)$ and add edges $(a,g)$, $(b,h)$. The resulting graph is exactly $K_(3,3)$. So the original graph is homeomorphic to $K_(3,3)$.
]
#hw("22")[
Determine whether the given graph is homeomorphic to $K_(3,3)$.
#align(center, image("images/2024-06-01-12-57-02.png", width: 28%))
][
The given graph is homeomorphic to $K_(3,3)$.
#align(center, image("images/2024-06-03-11-54-46.png", width: 30%))
]
#hw("23")[
Use Kuratowski’s theorem to determine whether the given graph is planar.
#align(center, image("images/2024-06-01-12-57-40.png", width: 45%))
][
We can't find a subgraph that is homeomorphic to $K_5$ or $K_(3,3)$, so the graph is planar.
#align(center, image("images/2024-06-03-11-54-59.png", width: 47%))
]
#hw("25")[
Use Kuratowski’s theorem to determine whether the given graph is planar.
#align(center, image("images/2024-06-01-12-58-03.png", width: 35%))
][
The subgraph with $V' = {a,b,c,d,g}$ is exactly $K_5$. Therefore, according to the Kuratowski’s theorem, the graph is not planar.
#align(center, image("images/2024-06-03-11-55-14.png", width: 42%))
]
== 10.8 Graph Coloring
#hw("3")[
Construct the dual graph for the map shown. Then find the number of colors needed to color the map so that no two adjacent regions have the same color.
#align(center, image("images/2024-06-01-13-01-35.png", width: 35%))
][
The chromatic number of the given graph is $3$. One of the constructions is shown above. Since there is a subgraph ${A,B,C}$ that is $K_3$, the minimum number of coloring is at least $3$.
#align(center, image("images/2024-06-03-11-55-33.png", width: 66%))
]
#hw("8")[
Find the chromatic number of the given graph.
#align(center, image("images/2024-06-01-13-02-03.png", width: 38%))
][
$x(G) = 3$.
#align(center, image("images/2024-06-03-11-56-03.png", width: 40%))
]
#hw("9")[
Find the chromatic number of the given graph.
#align(center, image("images/2024-06-01-13-02-37.png", width: 35%))
][
$x(G) = 2$.
#align(center, image("images/2024-06-03-11-56-20.png", width: 37%))
]
#hw("10")[
Find the chromatic number of the given graph.
#align(center, image("images/2024-06-01-13-02-52.png", width: 45%))
][
$x(G) = 4$.
#align(center, image("images/2024-06-03-11-56-37.png", width: 46%))
]
#hw("17")[
Schedule the final exams for Math 115, Math 116, Math 185, Math 195, CS 101, CS 102, CS 273, and CS 473, using the fewest number of different time slots, if there are no students taking both Math 115 and CS 473, both Math 116 and CS 473, both Math 195 and CS 101, both Math 195 and CS 102, both Math 115 and Math 116, both Math 115 and Math 185, and both Math 185 and Math 195, but there are students in every other pair of courses.
][
#table3(
columns: 8,
[Math 115],
[Math 116],
[Math 185],
[Math 195],
[CS 101],
[CS 102],
[CS 273],
[CS 473],
$a$,
$b$,
$c$,
$d$,
$e$,
$f$,
$g$,
$h$,
)
$
V &= {a, b, c, d, e, f, g, h}\
E &= {(a, h), (b, h), (d, e), (d, f), (a, b), (a, c), (c, d)}\
$
The minimum number of periods is $5$. A possible construction is as follows:
#table3(
columns: 5,
[Period 1],
[Period 2],
[Period 3],
[Period 4],
[Period 5],
${a,b,h}$,
${d,e}$,
${c}$,
${f}$,
${g}$,
)
]
|
https://github.com/RolfBremer/in-dexter | https://raw.githubusercontent.com/RolfBremer/in-dexter/main/tests/RangeTest.typ | typst | Apache License 2.0 | #import "../in-dexter.typ": *
#set page("a6", flipped: true, numbering: "1")
#show heading.where(level: 1): it => context{
pagebreak(weak: true)
it
}
_This is a test document for in-dexters range#index[Range] references.
It is used to demonstrate and test in-dexters range references._
// Define shortcuts for start and end
#let index-start = index.with(indexType: indexTypes.Start)
#let index-end = index.with(indexType: indexTypes.End)
= This is a StartEntry for the "Sample"-Entry Sample
#index-start[Sample]
#lorem(10)
= Another "Sample"-Entry, this time marked as main entry.
#index-main[Sample]
#lorem(10)
= This is the EndEntry for the "Sample"-Entry.
#index-end[Sample]
#lorem(10)
= A StartEntry for "Ipsum".
#index-start[Ipsum]
#lorem(10)
#index[Test]
= The EndEntry for "Ipsum".
#index-end[Ipsum]
#lorem(10)
= Another Page.
#lorem(10)
= Another StartEntry for "Ipsum".
#index-start[Ipsum]
#lorem(10)
= A normal entry for "Ipsum".
#index[Ipsum]
#lorem(10)
= A normal entry for "Ipsum".
#index[Ipsum]
#lorem(10)
= The EndEntry for "Ipsum".
#index-end[Ipsum]
#lorem(10)
= A StartEntry for Ipsum without a corresponding EndEntry.
#index-start[Ipsum]
= Another page.
#lorem(10)
= A cardinal entry with display.
#index(display: "BolloDisplay")[Bollo]
#index(display: "IpsumDisplay")[Ipsum]
== Index
_Here we render the Index for the document:_
#columns(2)[
#make-index(
use-bang-grouping: true,
use-page-counter: true,
sort-order: upper,
)
]
== Index without Continuation Symbols
_Here we render the Index for the document:_
#columns(2)[
#make-index(
use-bang-grouping: true,
use-page-counter: true,
sort-order: upper,
spc: none,
mpc: none
)
]
|
https://github.com/LilNick0101/Bachelor-thesis | https://raw.githubusercontent.com/LilNick0101/Bachelor-thesis/main/content/RA.typ | typst | #import "@preview/glossarium:0.2.0": gls
#v(10pt)
= Analisi dei Requisiti
I requisiti dell'applicazione sono stati individuati attraverso un'analisi dei casi d'uso e dei requisiti funzionali insieme al tutor aziendale e ad altri collaboratori durante il corso del progetto.
All'inizio è stato pianificato che l'applicazione doveva avere le seguenti funzionalità:
- *F1*: Lista dei luoghi (con funzione di ordinamento e filtraggio);
- *F2*: Mappa dei luoghi (con funzione di filtraggio);
- *F3*: Visualizzazione in dettaglio di un luogo;
- *F4*: Caricamento di un luogo;
- *F5*: Pagina di login;
- *F6*: Pagina del profilo utente, con lista dei luoghi caricati e dei luoghi salvati;
- *F7*: Registrazione di un nuovo account;
- *F8*: Lista delle recensioni di un luogo;
- *F9*: Caricamento di una nuova recensione di un luogo.
#pagebreak()
== Tipi di utenti
I tipi di utenti che utilizzano l'applicazione sono:
#figure(
image("../resources/images/utenti.svg", width: 50%),
caption: [Gerarchia dei tipi di utente.]
) <utenti>
- *Utente*: un utente generico, registrato o non che utilizza l'applicazione per visualizzare la lista dei luoghi, le informazioni in dettaglio dei luoghi, la mappa dei luoghi e la lista delle recensioni di un luogo;
- *Ospite*: un utente che non ha effettuato l'accesso al suo account e che oltre ad aver accesso alle funzionalità dell'utente generico, può accedere al proprio account o registrarsi;
- *Utente registrato*: un utente che ha effettuato l'accesso al suo account e che può quindi accedere alle funzionalità riservate agli utenti registrati, come caricare un nuovo luogo, salvare un luogo nei preferiti o caricare una nuova recensione.
/*
== Casi d'uso
I casi d'uso sono classificati con la seguente codifica:
#align(
center
)[
*SUC[Tipo]-numero*
]
- *SUC*: Acronimo di Smart Offices Use Case
- *Tipo*: Tipo di caso d'uso, può essere:
- *O*: Obbligatorio, ovvero un caso d'uso che è richiesto per raggiungere il #gls("MVP")
- *D*: Desiderabile, ovvero un caso d'uso che non è obbligatorio ma consente di dare valore aggiunto all'applicazione
- *F*: Facoltativo, ovvero un caso d'uso che non è importante per l'applicazione ma che può essere implementato se si ha tempo
=== Attori
Gli attori che utilizzano l'applicazione sono:
#figure(
image("../resources/images/utenti.svg", width: 80%),
caption: [Relazione tra utenti registrati e non registrati.]
) <Utenti>
- *Visitatore*: un utente generico, registrato o non che utilizza l'applicazione per visualizzare le informazioni sulle location (_vedi @Utenti _)
- *Ospite*: un utente che non ha effettuato l'accesso al suo account e che può quindi accedere solo alle funzionalità pubbliche dell'applicazione
- *Utente registrato*: un utente che ha effettuato l'accesso al suo account e che può quindi accedere alle funzionalità riservate agli utenti registrati
- *Google*: il servizio di autenticazione di Google che permette di effettuare il login con un account Google
#figure(
image("../resources/images/visualizzazione_location.svg", width: 80%),
caption: [Visualizzazione location.]
) <Visualizzazione_location>
=== SUCO-1: Visualizzazione della lista delle location
- *Descrizione*: L'utente vuole visualizzare la lista delle location
- *Attore principale*: Visitatore
- *Precondizioni*: L'utente ha aperto l'applicazione
- *Postcondizioni*: L'utente visualizza la lista delle location
- *Scenario principale*:
+ L'utente apre l'applicazione
+ L'utente visualizza la lista delle location
- *Scenario alternativo*:
- L'utente visualizza un messaggio di errore a causa di un errore nel caricamento della lista (@SUCO-4)
=== SUCO-2: Visualizzazione dei dettagli di una location <SUCO-2>
- *Descrizione*: L'utente vuole visualizzare i dettagli di una location
- *Attore principale*: Visitatore
- *Precondizioni*: L'utente ha aperto l'applicazione
- *Postcondizioni*: L'utente visualizza i dettagli di una location
- *Scenario principale*:
+ L'utente apre l'applicazione
+ L'utente seleziona una location o dalla lista o dalla mappa
+ L'utente visualizza i dettagli della location
- *Scenario alternativo*:
- L'utente visualizza un messaggio di errore a causa di un errore nel caricamento dei dettagli della location (@SUCO-4)
- L'utente visualizza un messaggio informativo che indica che la lista delle location è vuota
=== SUCO-3: Visualizzazione mappa delle location
- *Descrizione*: L'utente vuole visualizzare la mappa delle location
- *Attore principale*: Visitatore
- *Precondizioni*: L'utente ha aperto l'applicazione
- *Postcondizioni*: L'utente visualizza la mappa delle location
- *Scenario principale*:
+ L'utente apre l'applicazione
+ L'utente seleziona la mappa
+ L'utente visualizza la mappa delle location
- *Scenario alternativo*:
- L'utente visualizza un messaggio di errore a causa di un errore nel caricamento delle location (@SUCO-4)
=== SUCO-4: Visualizzazione di un errore durante il caricamento dati <SUCO-4>
- *Descrizione*: L'utente visualizza un messaggio d'errore a causa di un errore nel caricamento dei dati
- *Attore principale*: Visitatore
- *Precondizioni*: L'utente ha aperto l'applicazione
- *Postcondizioni*: L'utente visualizza un messaggio d'errore a causa di un problema nel caricamento dati
- *Scenario principale*:
+ L'utente apre l'applicazione
+ L'utente cerca di caricare dei dati
+ L'utente visualizza un messaggio d'errore
+ L'utente può riprovare a ricaricare i dati richiesti
=== SUCD-1: Visualizzazione messaggio lista vuota <SUCD-1>
- *Descrizione*: L'utente visualizza un messaggio che indica che la lista delle location è vuota
- *Attore principale*: Visitatore
- *Precondizioni*: L'utente ha aperto l'applicazione
- *Postcondizioni*: L'utente visualizza un messaggio che indica che la lista delle location è vuota
- *Scenario principale*:
+ L'utente apre l'applicazione
+ L'utente visualizza la lista delle location
+ La lista delle location è vuota
+ L'utente visualizza un messaggio che indica che la lista delle location è vuota
=== SUCO-5: Login utente registrato
- *Descrizione*: L'utente vuole effettuare il login all'suo profilo utente
- *Attore principale*: Opsite
- *Precondizioni*: L'utente ha aperto l'applicazione
- *Postcondizioni*: L'utente si è autenticato e visualizza la pagina profilo
- *Scenario principale*:
+ L'utente apre l'applicazione
+ L'utente seleziona il login
+ L'utente si autentica
+ L'utente viene reindirizzato alla pagina del profilo
- *Generalizzazioni*:
+ *SUCO-6*: Login con Google
=== SUCO-6: Login con Google <SUCO-6>
- *Descrizione*: Un utente non registra vuole effettuare il login all'suo profilo utente utilizzando un Account Google
- *Attore principale*: Utente non registrato
- *Attore secondario*: Google
- *Precondizioni*: L'utente ha aperto l'applicazione
- *Postcondizioni*: L'utente si è autenticato e visualizza la pagina profilo
- *Scenario principale*:
+ L'utente apre l'applicazione
+ L'utente seleziona il login con Google
+ L'utente si autentica con un Account Google
+ L'utente viene reindirizzato alla pagina del profilo
=== SUCD-2: Registrazione nuovo utente
- *Descrizione*: Un utente vuole creare un nuovo account per registrarsi sull'applicazione
- *Attore principale*: Utente non registrato
- *Precondizioni*: L'utente ha aperto l'applicazione
- *Postcondizioni*: L'utente si è registrato e visualizza la pagina profilo
- *Scenario principale*:
+ L'utente apre l'applicazione
+ L'utente sceglie di registrare un nuovo account
+ L'utente inserisce email e password
+ L'utente crea un nuovo account
=== SUCO-7: Logout utente registrato
- *Descrizione*: L'utente registrato vuole effettuare il logout dal suo profilo utente
- *Attore principale*: Utente registrato
- *Precondizioni*:
- *SUCO-5*: Login utente registrato
- *SUCO-6*: Login con Google
- *Postcondizioni*: L'utente si è disconnesso dal suo profilo utente
- *Scenario principale*:
+ L'utente è entrato con il suo profilo utente
+ L'utente seleziona il logout
+ L'utente viene reindirizzato alla pagina di login
=== SUCO-8: Visualizzazione profilo utente
- *Descrizione*: L'utente registrato vuole visualizzare il suo profilo utente
- *Attore principale*: Utente registrato
- *Precondizioni*:
- *SUCO-5*: Login utente registrato
- *SUCO-6*: Login con Google
- *Postcondizioni*: L'utente visualizza il suo profilo utente
- *Scenario principale*:
+ L'utente è entrato con il suo profilo utente
+ L'utente seleziona il suo profilo
+ L'utente visualizza il suo profilo
=== SUCO-9: Caricamento nuova location
- *Descrizione*: L'utente registrato vuole caricare una nuova location
- *Attore principale*: Utente registrato
- *Precondizioni*:
- *SUCO-5*: Login utente registrato
- *SUCO-6*: Login con Google
- *Postcondizioni*: L'utente ha caricato una nuova location con i dati imessi
- *Scenario principale*:
+ L'utente seleziona il caricamento di una nuova location
+ L'utente inserisce i dati richiesti per inserire la location, tra i quali: nome, indirizzo, descrizione, orari di apertura e chiusura, contatti, prezzo e una o più immagini
+ L'utente conferma il caricamento della nuova location
- *Scenari alternativi*:
- L'utente visualizza un messaggio a causa della mancanza delle informazioni richieste
- L'utente visualizza un messaggio di errore a causa di un errore nel caricamento della nuova location
=== SUCO-10: Visualizzazione messaggio mancanza informazioni
- *Descrizione*: L'utente visualizza un messaggio che indica che non ha inserito tutte le informazioni richieste della location da caricare
- *Attore principale*: Utente registrato
- *Precondizioni*:
- *SUCO-5*: Login utente registrato
- *SUCO-6*: Login con Google
- *Postcondizioni*: L'utente visualizza un messaggio che indica che non ha inserito tutte le informazioni richieste della location da caricare
- *Scenario principale*:
+ L'utente seleziona il caricamento di una nuova location
+ L'utente non inserisce tutte le informazioni richieste per inserire la location
+ L'utente visualizza un messaggio che indica che non ha inserito tutte le informazioni richieste della location da caricare, quindi l'utente può inserire le informazioni mancanti segnalate
=== SUCO-11: Visualizzazione errore nel caricamento della nuova location
- *Descrizione*: L'utente visualizza un messaggio a causa di un errore nel caricamento della nuova location
- *Attore principale*: Utente registrato
- *Precondizioni*:
- *SUCO-5*: Login utente registrato
- *SUCO-6*: Login con Google
- *Postcondizioni*: L'utente visualizza un messaggio di errore a causa di un errore nel caricamento della nuova location
- *Scenario principale*:
+ L'utente seleziona il caricamento di una nuova location
+ L'utente inserisce i dati richiesti per inserire la location
+ L'utente conferma il caricamento della nuova location
+ L'utente visualizza un messaggio a causa di un errore nel caricamento della nuova location, l'utente può riprovare a ricaricare la location
=== SUCO-12: Salvataggio location nei preferiti
- *Descrizione*: L'utente registrato vuole salvare una location nei preferiti
- *Attore principale*: Utente registrato
- *Precondizioni*:
- *SUCO-5*: Login utente registrato
- *SUCO-6*: Login con Google
- *Postcondizioni*: L'utente ha salvato una location nei preferiti
- *Scenario principale*:
+ L'utente seleziona una location
+ L'utente seleziona di salvare la location nei preferiti
+ L'utente salva la location nei preferiti
=== SUCO-13: Visualizzazione lista location preferite salvate
- *Descrizione*: L'utente registrato vuole visualizzare la lista delle location preferite salvate
- *Attore principale*: Utente registrato
- *Precondizioni*:
- *SUCO-5*: Login utente registrato
- *SUCO-6*: Login con Google
- *Postcondizioni*: L'utente visualizza la lista delle location preferite salvate
- *Scenario principale*:
+ L'utente entra nella pagina del profilo
+ L'utente seleziona la lista delle location preferite
+ L'utente visualizza la lista delle location preferite
- *Scenario alternativo*:
- L'utente visualizza un messaggio informativo che indica che la lista delle location preferite è vuota
=== SUCD-3: Visualizzazione lista location caricate
- *Descrizione*: L'utente registrato vuole visualizzare la lista delle location caricate
- *Attore principale*: Utente registrato
- *Precondizioni*:
- *SUCO-5*: Login utente registrato
- *SUCO-6*: Login con Google
- *Postcondizioni*: l'utente visualizza la lista delle location caricate
- *Scenario principale*:
+ L'utente entra nella pagina del profilo
+ L'utente seleziona la lista delle location caricate
+ L'utente visualizza la lista delle location caricate
- *Scenario alternativo*:
- L'utente visualizza un messaggio informativo che indica che la lista delle location caricate è vuota
=== SUCO-14: Visualizzazione recensioni location
- *Descrizione*: L'utente vuole visualizzare le recensioni di una location
- *Attore principale*: Visitatore
- *Precondizioni*: L'utente ha aperto l'applicazione e ha selezionato una location
- *Postcondizioni*: L'utente vede le recensioni caricate riguardante la location selezionata
- *Scenario principale*:
+ L'utente seleziona una location
+ L'utente seleziona di visualizzare le recensioni della location
+ L'utente visualizza le recensioni della location
=== SUCD-5: Caricamento nuova recensione
- *Descrizione*: L'utente vuole caricare una nuova recensione di una location
- *Attore principale*: Utente registrato
- *Precondizioni*:
- *SUCO-5*: Login utente registrato
- *SUCO-6*: Login con Google
- *Postcondizioni*: L'utente ha caricato una nuova recensione della location selezionata con il testo della recensione e una valutazione
- *Scenario principale*:
+ L'utente seleziona di caricare una nuova recensione
+ L'utente inserisce il testo della recensione e una valutazione
+ L'utente conferma il caricamento della nuova recensione
- *Scenario alternativo*:
- L'utente visualizza un messaggio a causa di un errore nel caricamento della nuova recensione (@SUCD-7)
=== SUCD-6: Visualizzazione errore nel caricamento della nuova recensione <SUCD-7>
- *Descrizione*: L'utente visualizza un messaggio a causa di un errore nel caricamento della nuova recensione
- *Attore principale*: Utente registrato
- *Precondizioni*:
- *SUCO-5*: Login utente registrato
- *SUCO-6*: Login con Google
- *Postcondizioni*: L'utente visualizza un messaggio a causa di un errore nel caricamento della nuova recensione
- *Scenario principale*:
+ L'utente seleziona di caricare una nuova recensione
+ L'utente inserisce il testo della recensione e una valutazione
+ L'utente conferma il caricamento della nuova recensione
+ L'utente visualizza un messaggio a causa di un errore nel caricamento della nuova recensione, l'utente può riprovare a ricaricare la recensione
=== SUCF-1: Visualizzazione lista recensioni caricate dall'utente
- *Descrizione*: L'utente vuole visualizzare la lista delle recensioni caricate da lui
- *Attore principale*: Utente registrato
- *Precondizioni*:
- *SUCO-5*: Login utente registrato
- *SUCO-6*: Login con Google
- *Postcondizioni*: L'utente visualizza la lista delle recensioni che ha caricato
- *Scenario principale*:
+ L'utente entra nella pagina del profilo
+ L'utente seleziona la lista delle recensioni caricate
+ L'utente visualizza la lista delle recensioni caricate
=== SUCO-15: Ordinamento lista delle location
- *Descrizione*: L'utente vuole ordinare la lista delle location
- *Attore principale*: Visitatore
- *Precondizioni*:
- *SUCO-1*: Visualizzazione della lista delle location
- *Postcondizioni*: L'utente visualizza la lista delle location ordinata secondo l'ordinamento selezionato
- *Scenario principale*:
+ L'utente visualizza la lista delle location
+ L'utente seleziona di ordinare la lista per distanza, valutazione o data d'inserimento
+ L'utente visualizza la lista delle location ordinata secondo l'ordinamento selezionato
=== SUCO-16: Filtraggio lista delle location
- *Descrizione*: L'utente vuole filtrare la lista delle location
- *Attore principale*: Visitatore
- *Precondizioni*:
- *SUCO-1*: Visualizzazione della lista delle location
- *Postcondizioni*: L'utente visualizza la lista delle location filtrata secondo i filtri selezionati
- *Scenario principale*:
+ L'utente visualizza la lista delle location
+ L'utente seleziona di filtrare la lista delle location
+ L'utente può filtrare la lista per nome, prezzo, caratteristiche o orario di apertura
+ L'utente visualizza la lista delle location filtrata secondo i filtri selezionati
*/
== Requisiti
Dalle funzionalità riportate sopra sono stati ricavati dei requisiti associati (per la lista completa dei requisiti, vedere #link(label("requirements-list"),[lista requisiti]) nell'appendice).
Alcuni requisiti sono:
- Per la *lista dei luoghi* l'utente selezionando un luogo viene portato alla pagina di dettaglio del luogo e un utente vuole ordinare la lista dei luoghi per distanza, valutazione o data d'inserimento;
- Per la *mappa dei luoghi*, l'utente selezionando un luogo viene portato alla pagina di dettaglio del luogo similmente alla lista dei luoghi;
- Per la *lista dei luoghi* e la *mappa dei luoghi* un utente può filtrare i luoghi per nome, prezzo, caratteristiche o orario di apertura;
- Per la *visualizzazione in dettaglio di un luogo* dovrebbero essere visualizzati i dettagli del luogo, tra cui nome, indirizzo, descrizione, orari di apertura e chiusura, contatti, prezzo e una o più immagini;
- Per la *lista dei luoghi*, la *mappa dei luoghi* e la *visualizzazione in dettaglio di un luogo* un utente registrato può salvare un luogo nei preferiti o rimuovere un luogo dai preferiti;
- Per il *caricamento di un luogo* l'utente registrato deve inserire i dati richiesti per inserire il luogo, tra i quali: nome, indirizzo, descrizione, orari di apertura e chiusura, contatti, prezzo e una o più immagini;
- Per la *pagina di login* un ospite può effettuare l'accesso con un account interno o con un account _Google_;
- Per la *pagina del profilo utente* l'utente registrato può visualizzare la lista dei luoghi caricati, la lista dei luoghi salvati o effettuare il logout;
- Per la *registrazione di un nuovo account* l'ospite deve inserire e-mail e password;
- Per il *caricamento di una recensione* l'utente registrato deve inserire il testo della recensione e una valutazione.
Nell'analisi dei requisiti sono stati individuati requisiti che sono condivisi tra più funzionalità, come per esempio il filtraggio dei luoghi che è presente sia nella lista che nella mappa e il salvataggio di un luogo nei preferiti che è presente nella lista, nella mappa e nel dettaglio del luogo.
Oltre ai requisiti funzionali, ci sono dei *requisiti di vincolo* che sono stati individuati durante l'analisi dei requisiti, come l'utilizzo del linguaggio di programmazione _Kotlin_ e del toolkit UI _Jetpack Compose_ per lo sviluppo dell'applicazione.
Per garantire la qualità del codice e dell'applicazione, sono stati individuati dei *requisiti di qualità*: il codice del progetto deve trovarsi sul repository aziendale, deve passare tutte le _Pull requests_ e l'applicazione deve essere funzionante anche in assenza di connessione ad Internet.
#figure(
table(
fill: (_, row) => if calc.odd(row) { luma(240) } else { white },
columns: (1fr, 1fr),
align: horizon,
[*Tipo di requisito*], [*Numero*],
[Funzionali],[49],
[Di vincolo],[4],
[Di qualità],[3],
[*Totali*],[56]
),
caption: [Conteggio requisiti dell'applicazione _Android_.]
)
|
|
https://github.com/ukihot/igonna | https://raw.githubusercontent.com/ukihot/igonna/main/articles/git/git.typ | typst | == 分散型バージョン管理システム
=== GitとGitHub
== Gitの仕組み
=== ワーキングディレクトリ
ワーキングディレクトリは、Gitリポジトリ内のファイルやディレクトリが実際に存在する場所である。
開発者は、このディレクトリ内でファイルを作成、編集、削除する。
ワーキングディレクトリ内の変更は、Gitがトラッキングし、コミットする前にステージングに追加する必要がある。
=== ステージング
ステージングは、ワーキングディレクトリからGitリポジトリに変更を追加するプロセスである。
開発者は、変更したファイルをステージングに追加し、次にコミットするための準備を整える。
これにより、コミットする変更を選択的に管理し、変更の内容やコミットの粒度を制御することができる。
=== リポジトリ
リポジトリは、Gitがバージョン管理されたファイルや履歴を保存するデータベースである。
プロジェクトの全ての変更履歴やメタデータが保存され、複数のブランチやコミットからなる完全な履歴が管理される。
ローカルリポジトリとリモートリポジトリの2つのタイプがあり、開発者はローカルで作業を行い、変更をリモートリポジトリにプッシュして共有する。
=== コミット
コミットは、Gitリポジトリに変更を永続化する操作である。
開発者は、ワーキングディレクトリ内で変更を行った後、変更をステージングしてコミットする。
変更内容の説明や作成者の情報などのメタデータが含まれ、プロジェクトの変更履歴に新しいスナップショットを追加し、過去の状態に戻るための参照ポイントを提供する。
=== プッシュ
プッシュは、ローカルリポジトリの変更をリモートリポジトリに送信する操作である。
開発者は、ローカルで行ったコミットをリモートに反映させるためにプッシュする。
これにより、チームメンバー間でのコードの共有や同期が可能になります。
=== プル
プルは、リモートリポジトリからローカルリポジトリに変更を取得する操作である。
開発者は、リモートで行われた変更をローカルに反映させるためにプルを実行する。
これにより、他のチームメンバーの変更を取得し、自分の作業と統合することができる。
=== ブランチ
ブランチは、プロジェクトの異なるバージョンや機能ごとに分岐するための機能である。
開発者は、新しいブランチを作成し、独立した作業を行うことができる。
これにより、複数の作業を同時に進行し、コードの変更を安全に管理することが可能になる。 |
|
https://github.com/tingerrr/typst-test | https://raw.githubusercontent.com/tingerrr/typst-test/main/CONTRIBUTING.md | markdown | MIT License | # Contributing
Thank you for considering to contribute to `typst-test`.
Any contributions are welcome, from implementing large features to fixing small typos.
**If you're contributing for the first time to `typst-test`, please familiarize yourself with the workflow below.**
1. When you open a PR as a draft, it can be as messy as you want.
1. Once you request review, make sure you have cleaned up the PR:
- It should have a linear history, rebase on main to update your branch instead of merging main into it.
- Each commit should be atomic, they should compile and pass tests on their own.
- Each commit should have a clear commit message with a short and long description (if applicable).
- It should not contain any `fix` or `review` commits, each commit should be a meaningful change to the code base.
Each commit is reviewed in isolation, which is why clear commit messages and atomic commits are important.
1. When a change is requested, address this change by rewriting the commits and force pushing the branch, od not add `fix` or `review` commits.
1. Once reviewed it is either squashed and merged, or rebased on main.
## Commit Messages
Each of the final commits should have a clear commit message starting with `a(b):`, where `a` is a general term like:
- `fix` for fixing bugs
- `docs` for changing, fixing or adding new documentation
- `feat` for a new feature of any kind
- `chore` for anything else like cleanups or refactors, these shold not have any externally observerable change in behavior (other than speed ups)
`b` is optional, but may be a term like:
- `cli` for change to the cli crate
- `lib` for changes to the library crate
- `book` for changes to the book
- `ci` for changes to ci workflows
- `vcs` for changes to features regarding VCS
- a path to a file for various other changes concerning specific things like scripts (rarely used)
- a path to module or type in the code base (`lib::test::Test`/`lib::Test`) for very specific refactors
This is generally optional, but helps developers filter out commits when bug hunting.
After this should follow a short summary of what the commit changes followed by a more elaborate description.
This can be left out for very small commits, no need to make something up.
Commit messages are is documentation for developers to understand reasoning behind changes, so don't be afraid to write an essay here, the more complicated a refactor or bug fix, the more elaborate the commit message should likely be.
Here's a commit message from the code base:
```
docs(book): Add installation chapter
Adds an installation chapter to the quick start part of the book, this section
outlines methods of installation, as well as system dependencies such as
openssl.
```
The short message (first line) is seen most often and clearly communicates what this does, a developer looking for bugs in the library code can ignore this commit entirely.
The long message (after the empty line) more closely describes the change, but since it is simple it's not very long.
## Atomic Commits
Each commit in a PR should be
- self contained,
- compilable,
- and able to pass all tests.
None of these restrictions can easily be enforced by CI, it is up to you as the contributor to uphold that.
A good way to ensure this is to think about the changes before writing them and rewriting your commit history by amending, splitting or reordering.
Here are some general guidelines:
- Keep refactors required for a feature separate to the feature itself.
- Code documentation, test adjustments or new test cases and features all belong in the same commit, do not split these up.
- If you find a bug while adding a new feature, add a bug fix in a separate commit.
## Linear History
`typst-test` imposes a linear history on its main branch, this means that PR's are not merged, but either squashed or rebased on top of main.
This means that the commits landing on main must likewise be a linear history, at least once added to main.
There are two was to add PRs to main:
1. The squash workflow: Squash all commits and add them to main.
It's fairly easy to get a single commit on main which is atomic, but such commits may get unecessarily large.
This is avoided where possible.
1. The rebase workflow: All commits are added individually on main.
This is done most often and the main reaons your commits should all individually be valid states of the repository.
## Adressing Reivew
Say you created a PR with this history:
```txt
◆ A fix(vcs): Avoid panic on UNC paths within escape check
│
◆ B feat(vcs): Add mercurial support
│
◆ C docs(book): Add mercurial chapter to cli reference
```
You open the PR and on review you agree to rename one of the Types introduced in `B`.
Instead of adding a new commit which does nothing substantial other than renaming a type, you amend the changes to the commit `B` and force push the branch.
It is up to you how you accomplish this, but one way to do it is to add a new commit and use `git rebae --interactive` to squash it into `B`.
I personally use [jj] for all my repos, which makes history rewriting and commit-fu very easy.
I can recommend it especially for this type of workflow.
If you prefer a GUI or TUI, there's also [gg] and [lazyjj].
[jj]: https://github.com/martinvonz/jj
[gg]: https://github.com/gulbanana/gg
[lazyjj]: https://github.com/Cretezy/lazyjj
|
https://github.com/spidersouris/touying-unistra-pristine | https://raw.githubusercontent.com/spidersouris/touying-unistra-pristine/main/src/unistra.typ | typst | MIT License | #import "@preview/touying:0.5.3": *
#import "colors.typ": *
#import "admonition.typ": *
#import "settings.typ" as settings
//todo (low prio): add material symbols
// ===================================
// ============ UTILITIES ============
// ===================================
/// Creates a custom rectangle cell
#let _cell(
body,
width: 100%,
height: 100%,
inset: 0mm,
outset: 0mm,
alignment: top + left,
fill: none,
debug: settings.DEBUG,
) = rect(
width: width,
height: height,
inset: inset,
outset: outset,
fill: fill,
radius: 2em,
stroke: if debug {
1mm + red
} else {
none
},
align(alignment, body),
)
/// Adds gradient to body (used for slide-focus)
#let _gradientize(
self,
body,
c1: nblue.E,
c2: nblue.E,
lighten-pct: 20%,
angle: 45deg,
) = {
rect(fill: gradient.linear(c1, c2.lighten(lighten-pct), angle: angle), body)
}
/// Creates a title and subtitle block
#let _title-and-sub(body, title, subtitle: none, heading-level: 1) = {
grid(
_cell(
heading(level: heading-level, title),
height: auto,
width: auto,
),
if subtitle != none {
_cell(
heading(level: heading-level + 1, subtitle),
height: auto,
width: auto,
)
},
columns: 1fr,
gutter: 0.6em,
body
)
}
/// Calculates page margin based on header and footer settings
#let _get-page-margin() = {
if settings.SHOW-HEADER and settings.SHOW-FOOTER {
(x: 2.8em, y: 2.5em)
} else if settings.SHOW-HEADER {
(x: 2.8em, bottom: 0em)
} else if settings.SHOW-FOOTER {
(x: 2em, left: 2.8em)
} else {
(x: 1em, y: 1em)
}
}
// Creates a custom quote element
#let _custom-quote(it) = {
v(1em)
box(
fill: luma(220),
outset: 1em,
width: 100%,
[
// smartquote() doesn't work properly here,
// probably because we're in a block
#settings.QUOTES.at("left") #it.body #settings.QUOTES.at("right")
#if it.attribution != none [
#set text(size: 0.8em)
#linebreak()
#h(1fr)
(#it.attribution)
]
],
)
}
#let smaller = it => {
text(size: 25pt, it)
}
#let smallest = it => {
text(size: 20pt, it)
}
#let unistra-nav-bar(self) = {
show: block.with(inset: (x: 5em))
set text(size: 1.4em)
grid(
components.mini-slides(display-section: true, display-subsection: false),
)
}
/// Creates a normal slide with a title and body
#let slide(
config: (:),
repeat: auto,
setting: body => body,
composer: auto,
..bodies,
) = touying-slide-wrapper(self => {
let footer(self) = {
let cell(body) = rect(
width: 100%,
height: 100%,
inset: 0mm,
outset: 0mm,
fill: none,
stroke: none,
text(size: 0.5em, fill: self.colors.black, body),
)
set align(center + horizon)
let has-title-and-subtitle = (
self.info.title,
self.info.subtitle,
).all(x => x not in ("", none))
block(
width: 100%,
height: 100%,
stroke: (top: 0.5pt + self.colors.black),
{
set text(size: 1.5em)
grid(
columns: (20%, 60%, 20%),
rows: 1.5em,
cell(box(self.info.logo, height: 100%, fill: none)),
cell(
box(
text(
self.info.title,
weight: "bold",
) + if has-title-and-subtitle and settings.FOOTER-SHOW-SUBTITLE {
settings.FOOTER-UPPER-SEP
} else {
""
} + if settings.FOOTER-SHOW-SUBTITLE {
self.info.subtitle
} + "\n" + utils.call-or-display(
self,
[#self.info.author | #self.info.date],
),
width: 100%,
),
),
cell(
utils.call-or-display(
self,
context utils
.slide-counter
.display() + " / " + utils.last-slide-number,
),
),
)
},
)
}
let self = utils.merge-dicts(
self,
config-page(
header: if settings.SHOW-HEADER {
unistra-nav-bar(self)
} else {
none
},
footer: if settings.SHOW-FOOTER {
footer
} else {
none
},
),
)
touying-slide(
self: self,
config: config,
repeat: repeat,
setting: setting,
composer: composer,
..bodies,
)
})
/// Creates a title slide with a logo, title, subtitle, author, and date.
///
/// Example:
///
/// ```typst
/// #title-slide(title: "Override Title", logo: image("../assets/unistra.svg", width: 60%))
/// ```
///
/// If no title or subtitle is provided, will use the info object.
///
/// - `title` (str): The title of the slide. Default: "".
///
/// - `subtitle` (str): The subtitle of the slide. Default: "".
///
/// - `logo` (content): Path to the logo shown in the upper left corner of the slide. Default: "".
/// - `..args`: Additional arguments to pass to the slide.
#let title-slide(
title: "",
subtitle: "",
logo: "",
..args,
) = touying-slide-wrapper(self => {
let info = self.info + args.named()
let body = {
set text(fill: white)
set block(inset: 0mm, outset: 0mm, spacing: 0em)
set align(top + left)
_gradientize(
self,
block(
fill: none,
width: 100%,
height: 100%,
inset: (left: 2em, top: 1em),
grid(
columns: (1fr),
rows: (6em, 6em, 4em, 4em),
_cell([
#align(
left,
logo,
)
]),
_cell([
#text(
size: 2em,
weight: "bold",
if (title != "") {
title
} else {
info.title
},
)
#linebreak()
#text(
size: 1.7em,
weight: "regular",
if (subtitle != "") {
subtitle
} else {
info.subtitle
},
)
]),
_cell([
#if ((none, "").all(x => x != info.subtitle)) {
linebreak()
}
#set text(size: 1.5em, fill: self.colors.white)
#text(weight: "bold", info.author)
]),
_cell([
#set text(fill: self.colors.white.transparentize(25%))
#utils.display-info-date(self)
]),
),
),
c1: self.colors.nblue.E,
c2: self.colors.cyan.E,
)
}
self = utils.merge-dicts(
self,
config-common(freeze-slide-counter: true),
config-page(margin: 0em),
config-common(subslide-preamble: none),
)
touying-slide(
self: self,
body,
)
})
/// Creates a focus slide with a gradient background.
///
/// If no colors are provided, will use the theme.
///
/// Examples:
///
/// ```typst
/// #focus-slide(c1: blue, c2: cyan)[Title]
/// ```
///
/// ```typst
/// #focus-slide(theme: "smoke")[Title]
/// ```
///
/// - `c1` (color): The first color of the gradient. Default: none.
///
/// - `c2` (color): The second color of the gradient. Default: none.
///
/// - `text-color` (color): The color of the text. Default: none.
///
/// - `theme` (str): The color theme to use. Themes are defined in src/colors.typ. Possible values: "lblue", "blue", "dblue", "yellow", "pink", "neon", "mandarine", "hazy", "smoke". Default: none.
///
/// - `text-alignment` (str): The text alignment.
///
/// - `counter` (counter): The counter to use for titles. Will show a count-label before the title. Default: counter("focus-slide").
///
/// - `show-counter` (bool): Whether to show the counter. Default: true.
///
/// - `body` (content): Content of the slide.
#let focus-slide(
c1: none,
c2: none,
text-color: none,
theme: none,
text-alignment: center + horizon,
counter: counter("focus-slide"),
show-counter: true,
body,
) = touying-slide-wrapper(self => {
assert(
(c1 != none and c2 != none) or theme != none,
message: "Please provide a color theme or two colors for the focus slide.",
)
let new-text-color = text-color
let new-c1 = c1
let new-c2 = c2
if (theme != none) {
assert(
theme in self.store.colorthemes,
message: "The theme " + theme + " is not defined. Available themes are: " + self
.store
.colorthemes
.keys()
.join(", "),
)
assert(
self.store.colorthemes.at(theme).len() != 2 or self
.store
.colorthemes
.at(theme)
.len() != 3,
message: "The theme " + theme + " is not a valid color theme. A valid color theme should have 2 or 3 colors.",
)
let theme-has-text-color = self.store.colorthemes.at(theme).len() == 3
if (text-color == none and not theme-has-text-color) {
new-text-color = self.colors.white
} else {
new-text-color = self.store.colorthemes.at(theme).at(2)
}
new-c1 = self.store.colorthemes.at(theme).at(0)
new-c2 = self.store.colorthemes.at(theme).at(1)
}
let padding = auto
if text-alignment == left + horizon {
padding = 2em
}
let body = {
set text(fill: new-text-color, size: 2em, weight: "bold", tracking: 0.8pt)
if (show-counter) {
counter.step()
}
context {
let count-label = none
if (show-counter) {
count-label = counter.display("I") + ". "
}
_gradientize(
self,
block(
width: 100%,
height: 100%,
grid.cell(
if (count-label != none) {
count-label
} + body,
align: text-alignment,
inset: padding,
),
),
c1: new-c1,
c2: new-c2,
)
}
}
self = utils.merge-dicts(
self,
config-common(freeze-slide-counter: true),
config-page(margin: 0em),
config-common(subslide-preamble: none),
)
touying-slide(self: self, body)
})
/// Creates a hero slide with a high width image, and optional title, subtitle, caption and text. The image can take all the space, or be on the left or right side.
///
/// Examples:
///
/// ```typst
/// #hero(
/// image("../assets/unistra.svg", height: 70%),
/// title: "Hero",
/// subtitle: "Subtitle",
/// )
/// ```
///
/// ```typst
/// #let custom-enhance = txt => text(size: 2em, weight: 900, fill: orange, txt)
/// #hero(
/// image("../assets/cat1.jpg", height: 100%, width: 100%),
/// txt: (text: "Some text next to the image", enhanced: custom-enhance),
/// direction: "rtl",
/// )
///
/// - `title` (str): The title of the slide. Default: none.
///
/// - `heading-level` (int): The heading level of the title. Default: 1.
///
/// - `subtitle` (str): The subtitle of the slide. Default: none.
///
/// - `caption` (str): The caption of the image. Default: none.
///
/// - `bold-caption` (bool): Whether to make the caption bold. Default: false.
///
/// - `numbering` (str): The numbering of the caption (figure). Default: none.
///
/// - `rows` (list): The rows of the grid. Default: (1fr).
///
/// - `txt` (dict): The text to display next to the image, along with its style. Contains the following keys: text, enhanced, fill, align.
/// - `text` (content): The text to display. Default: none.
/// - `enhanced` (bool | function): Whether to enhance the text. Can pass a custom function that will act as a callback to enhance the text. Default: true.
/// - `fill` (color): The fill color of the text. Default: none.
/// - `align` (alignment): The alignment of the text. Default: horizon + center.
///
/// - `direction` (str): The direction of the image and text. Possible values: "ltr", "rtl", "utd", "dtu". Default: "ltr".
///
/// - `gap` (str): The gap between the image and text. Default: auto.
///
/// - `hide-footer` (bool): Whether to hide the footer. Default: true.
///
/// - `fill` (color): The fill color of the slide. Only works when `hide-footer` is true. Default: none.
///
/// - `inset` (length): How much negative inset should be applied to the slide to make the image take all the space. Only works when `hide-footer` is true and there is no title, subtitle or caption. Default: -25mm.
///
/// - `footnote` (bool): Whether to leave some width to accomodate for a footnote. Default: false.
#let hero(
title: none,
heading-level: 1,
subtitle: none,
caption: none,
bold-caption: false,
numbering: none,
rows: (1fr),
txt: (:),
direction: "ltr",
gap: auto,
hide-footer: true,
fill: none,
inset: -25mm,
footnote: false,
..args,
) = touying-slide-wrapper(self => {
let fig = args.pos().at(0)
if (txt != (:) and "text" not in txt) {
panic("The txt argument value must contain a text key")
}
// merge with default values
let merged-txt = utils.merge-dicts(
(
text: none,
enhanced: true,
fill: none,
align: horizon + center,
),
txt,
)
if (fig == none) {
panic("A hero slide requires an inline image such as image('path/to/image.jpg')")
}
let create-figure() = {
if (bold-caption) {
caption = text(weight: "bold", caption)
}
figure(
fig,
caption: caption,
numbering: numbering,
)
}
let create-image-cell() = {
_cell(
create-figure(),
)
}
let create-text-cell() = {
let new-txt = merged-txt.text
if type(merged-txt.enhanced) == "boolean" and merged-txt.enhanced {
new-txt = text(size: 2em, weight: 900, merged-txt.text)
} else if type(merged-txt.enhanced) == "boolean" and not merged-txt.enhanced {
new-txt = merged-txt.text
} else if type(merged-txt.enhanced) == "function" {
new-txt = (merged-txt.enhanced)(merged-txt.text)
} else {
panic("Value of enhanced key must be a boolean or a function")
}
_cell(
new-txt,
height: 100%,
width: 100%,
inset: 20mm,
alignment: merged-txt.align,
fill: merged-txt.fill,
)
}
let create-grid(
first-cell,
second-cell,
columns: (1fr, 2fr),
rows: rows,
column-gutter: auto,
row-gutter: auto,
) = {
grid(
columns: columns,
rows: rows,
column-gutter: column-gutter,
row-gutter: row-gutter,
first-cell, second-cell,
)
}
let create-body() = {
if (merged-txt.text == none) {
align(
center,
create-figure(),
)
} else {
if direction == "ltr" {
create-grid(
create-text-cell(),
create-image-cell(),
column-gutter: gap,
)
} else if direction == "rtl" {
create-grid(
create-image-cell(),
create-text-cell(),
column-gutter: gap,
// columns are reversed in this direction
columns: (2fr, 1fr),
)
} else if direction == "utd" {
create-grid(
create-image-cell(),
create-text-cell(),
columns: (1fr),
rows: (1fr, 1fr),
row-gutter: gap,
)
} else if direction == "dtu" {
create-grid(
create-text-cell(),
create-image-cell(),
columns: (1fr),
rows: (1fr, 1fr),
row-gutter: if gap != auto {
gap
} else {
-2em
},
)
}
}
}
let body = create-body()
if (title != none) {
body = _title-and-sub(
body,
title,
subtitle: subtitle,
heading-level: heading-level,
)
}
if hide-footer or footnote {
body = block(
body,
fill: fill,
height: if (footnote) {
80%
} else {
100%
},
width: 100%,
)
}
if (title, subtitle, caption).all(x => x == none) {
body = block(
body,
// expand image as much as possible
// as it is the only content
// todo: calculate this automatically
inset: inset,
)
}
let self = utils.merge-dicts(
self,
config-common(subslide-preamble: none),
)
touying-slide(self: self, body)
})
/// Creates a gallery slide with a title and images.
///
/// Example:
///
/// ```typst
/// #gallery(
/// image("../assets/cat1.jpg"),
/// image("../assets/cat2.jpg"),
/// title: "Gallery",
/// captions: (
/// "Cat 1",
/// "Cat 2",
/// ),
/// columns: 2
/// ```
///
/// - `title` (str): The title of the gallery. Default: none.
///
/// - `heading-level` (int): The heading level of the title. Default: 2.
///
/// - `subtitle` (str): The subtitle of the gallery. Default: none.
///
/// - `columns` (int): The number of columns. Default: auto.
///
/// - `captions` (list[str]): The list of captions. Default: ().
///
/// - `bold-caption` (bool): Whether to make the captions bold. Default: true.
///
/// - `height` (str): The height of the images. Default: auto.
///
/// - `width` (str): The width of the images. Default: auto.
///
/// - `fit` (str): The fit of the images. Can be "cover", "stretch" or "contain". Default: "cover".
///
/// - `gutter` (str): The gutter between the images. Default: 0.5em.
///
/// - `gap` (str): The gap between the images. Default: 0.65em.
#let gallery(
title: none,
heading-level: 2,
subtitle: none,
images: (),
columns: auto,
captions: (),
bold-caption: true,
height: auto,
width: auto,
fit: "cover",
gutter: 0.5em,
gap: 0.65em,
..args,
) = touying-slide-wrapper(self => {
let figs = args.pos()
if (figs == none) {
panic("A hero slide requires at least one inline image such as image('path/to/image.jpg')")
}
let rows = (figs.len() / columns)
let body = {
set align(center + horizon)
grid(
..figs.enumerate().map(((i, fig)) => {
let caption = if i < captions.len() {
let cap = captions.at(i)
if cap != "" {
cap
} else {
none
}
} else {
none
}
if (bold-caption) {
caption = text(weight: "bold", caption)
}
figure(
fig,
caption: caption,
gap: gap,
numbering: none,
)
}),
columns: columns,
rows: (1fr) * rows,
gutter: gutter,
)
}
body = _title-and-sub(
body,
title,
subtitle: subtitle,
heading-level: heading-level,
)
let self = utils.merge-dicts(
self,
config-common(subslide-preamble: none),
)
touying-slide(self: self, body)
})
/// Registers the Unistra theme.
#let unistra-theme(
aspect-ratio: "16-9",
header: [],
footer: [],
footer-info-2: self => {
[
#self.info.author | #utils.info-date(self)]
},
..args,
body,
) = {
set text(size: 20pt)
show: touying-slides.with(
config-colors(
white: white,
black: black,
grey: grey,
maroon: maroon,
brown: brown,
orange: orange,
red: red,
pink: pink,
purple: purple,
violet: violet,
nblue: nblue,
blue: blue,
cyan: cyan,
ngreen: ngreen,
green: green,
camo: camo,
yellow: yellow,
primary: nblue.E,
),
config-page(
paper: "presentation-" + aspect-ratio,
margin: _get-page-margin(),
footer-descent: if (_get-page-margin().at("x")) != 1em {
0em
} else {
0.6em
},
header-ascent: 1em,
),
config-common(
slide-fn: slide,
title-slide: title-slide,
focus-slide: focus-slide,
gallery: gallery,
hero: hero,
subslide-preamble: self => text(
1.5em,
weight: "bold",
utils.display-current-heading(depth: self.slide-level) + "\n",
),
),
config-methods(
alert: utils.alert-with-primary-color,
smaller: smaller,
smallest: smallest,
// init
init: (self: none, body) => {
// sets
set text(
fill: black,
font: settings.FONT,
size: 25pt,
lang: settings.LANGUAGE,
)
set outline(target: heading.where(level: 1), title: none, fill: none)
set enum(numbering: n => [*#n;.*])
set highlight(extent: 1pt)
// shows
show strong: self.methods.alert.with(self: self)
show footnote.entry: set text(size: 18pt)
show heading.where(level: 1): set text(size: 1.5em, weight: "bold")
show heading.where(level: 2): set block(below: 1.5em)
// color links
show link: it => text(
link-color,
underline.with(offset: 3pt, extent: -1pt)(it),
)
// custom quote
show quote: it => _custom-quote(it)
show outline.entry: it => it.body
show outline: it => block(inset: (x: 1em), it)
body
},
),
config-store(
colorthemes: colorthemes,
slide-title: [],
auto-heading: true,
),
..args,
)
body
} |
https://github.com/patrick-kidger/typst_pyimage | https://raw.githubusercontent.com/patrick-kidger/typst_pyimage/main/CONTRIBUTING.md | markdown | Apache License 2.0 | # Contributing
Contributions (pull requests) are very welcome!
1. Fork the library on GitHub. Then clone and install the library in development mode:
```bash
git clone https://github.com/your-username-here/typst_pyimage.git
cd typst_pyimage
pip install -e .
```
2. Install the pre-commit hooks, which are used to autoformat and lint the code:
```bash
pip install pre-commit
pre-commit install
```
3. Make your changes. Include additional tests if necessary.
4. Verify the tests all pass:
```bash
pip install -r tests/requirements.txt
pytest
```
5. Push your changes back to your fork of the repository:
```bash
git push
```
Finally, open a pull request on GitHub!
|
https://github.com/polarkac/MTG-Stories | https://raw.githubusercontent.com/polarkac/MTG-Stories/master/stories/017%20-%20Dragons%20of%20Tarkir/007_Unbroken%20and%20Unbowed.typ | typst | #import "@local/mtgstory:0.2.0": conf
#show: doc => conf(
"Unbroken and Unbowed",
set_name: "Dragons of Tarkir",
story_date: datetime(day: 22, month: 04, year: 2015),
author: "<NAME>",
doc
)
#emph[Sarkhan Vol has been on a strange journey, and his search for understanding is almost at an end. He traveled back through time, changed the past, and returned to a present transformed by his action. He has ] encountered old enemies and old friends#emph[, and none of them remember him. He has searched for Narset, whose sacrifice enabled him to change the past, and found her nowhere on Tarkir.]
#emph[Now, he must find the only other being in existence who may be able to help him understand: Ugin, the Spirit Dragon, whom he left slumbering in a hedron cocoon over a thousand years ago.]
#v(0.35em)
#line(length: 100%, stroke: rgb(90%, 90%, 90%))
#v(0.35em)
Sarkhan's wings stretched in glorious flight, soaring high above the scrub and steppe of Tarkir. In dragon form he could smell every dragon within miles, pick out details invisible to his human eyes, and sense the presence of thermal updrafts that carried him higher into the sky. In dragon form he sometimes wondered whether he had ever been human at all, and why he would ever want to be.
Zurgo was alive, but changed. Sarkhan's hated enemy was dead—more than dead, better and worse, beyond redemption or revenge. That Zurgo was erased, replaced by a stooped creature who followed a dragon and rang a bell. Ankle Shanker was alive, but with a different name, a different life. She had lived instead of died, but she did not know him.
Ugin was alive, but dormant, locked away by Sarkhan's own actions. His life force still pulsed at the heart of a hedron prison, sustaining the storms that birthed the dragons. The magnificent dragon elders of the old era seemed to have lived as well, risen from glorious beasts to holders of the reins of power.
#figure(image("007_Unbroken and Unbowed/01.jpg", width: 100%), caption: [Plains | Art by <NAME>incourt], supplement: none, numbering: none)
Everyone lived, it seemed, save two. Sarkhan. And Narset. Where was she? Where was he? #emph[What] was he now, here on the other side of time's great river?
Ugin would know. Ugin had to know.
Ahead of him, many miles ahead—near the canyon where Ugin lay, he thought—a bolt of blue-white light careened upward into the sky. It soared gleefully, shining like a second sun, before descending again, and Sarkhan could not see where it landed. Could it be? Ugin…awake? Had someone freed him? Had he freed himself?
An ape's instincts, deeply buried, urged him to hurry forward toward Ugin's canyon, to rush, to #emph[run] . But in the sky, a straight line wasn't the shortest route, and the intervening air was far from empty. Dragon-mind knew, and he had finally learned to listen to it. He wheeled around, letting the thermal take him higher.
From that height, one long glide would take him to the canyon, and the truth.
#v(0.35em)
#line(length: 100%, stroke: rgb(90%, 90%, 90%))
#v(0.35em)
The canyon came into view as the sun reached its zenith. Blind to the sky above him, Sarkhan didn't see his attacker until it was upon him.
A ghostly dragon, trailing blue-white mist, dove toward him from above, veering off at the last moment. A wave of heat washed over him, fire without flame. Ugin! The blast of heat hardly singed his scaled skin and the ghost-dragon never touched him physically. It hovered a few body-lengths away, serene but menacing. It had no scent at all.
#figure(image("007_Unbroken and Unbowed/02.jpg", width: 100%), caption: [Scion of Ugin | Art by Cliff Childs], supplement: none, numbering: none)
Sarkhan growled, somewhere between the noise an angry tiger makes and a clipped Draconic "Get out of my way." He breathed a bright blast of flame to punctuate his point and kept flying.
Soon the spirit was joined by others. Sarkhan sped toward the canyon, harried by half a dozen of the ghostly creatures, outracing the sheer fire of their breath. Then, just as suddenly, they turned away, plunging into cloud banks, their translucent bodies disappearing into the mist. Within moments he could see no trace of them.
He flew out over the canyon, looking for any sign of the ghostly dragons. The great hedron structure he had seen when he arrived had crumbled in on itself, reduced to pieces no larger than the one he had brought with him from the Eye. The base of the canyon was filled with fine dust and rune-etched rubble. No corpse, no bones. His draconic heart beat harder. #emph[Ugin lives] .
Sarkhan transformed as he dropped, landing lightly on the field of hedron rubble with human feet as his wings shrank and folded away.
#figure(image("007_Unbroken and Unbowed/03.png", width: 100%), caption: [Sarkhan Unbroken | Art by Aleksi Briclot], supplement: none, numbering: none)
There, at the end of the canyon, a luminous shape towered, wings outstretched. Ugin was facing away from Sarkhan, toward the canyon wall, ringed by more spirit guardians. Projected on the rock wall before him were images from all over Tarkir. The sleek, graceful shapes of Ojutai's dragons soared among the towering monasteries of his clan. A horde of savage warriors rode across the steppe, following the lightning-blur of the dragon Kolaghan. A thick-bodied dragon lounged in a dank palace, covered in jewelry and waited on by attendants. The antlered dragons Sarkhan had seen in Tarkir's past swooped low over bare and steaming mountains. Armored humanoids marched to war beneath the watchful gaze of regal, barrel-chested dragons. There was even an image of Sarkhan himself, standing in the canyon.
Ugin turned, and his ranks of spirit guardians parted. He was radiant, luminous, the idea of a dragon cast in flesh and mist.
"Forgive my sentries," said Ugin. "They are overzealous. I called them off as soon as I became aware of you."
"Do you…know me?"
Ugin smiled.
"Yes and no," he said. "I know what you did. I owe you thanks. And you owe me an explanation."
Sarkhan's eyes widened.
"Great Ugin…" he said, "I came here hoping you could explain all this to me. What could I know that you do not? What questions can I possibly answer?"
"I've been asleep for a thousand years," said Ugin. "You may be the only one who truly understands what's happened here. Who are you? What has happened to my world? How did this—" He opened his hand, and a shard of hedron-stone rose from the rubble to float above his palm. Not a shard—#emph[the] shard, the one Sarkhan had taken from the Eye of Ugin, intact after all this time. "—travel backward through time, to arrive here over a thousand years ago?"
Sarkhan gaped.
"Then you already know what happened."
"Not at all," replied Ugin. "I'm applying logic." The shard pulsed. "This came from the Eye of Ugin on Zendikar. This particular stone came from the inner chamber of the Eye, and could only be removed if the Eye had opened. And if that had happened prior to my…defeat, I would have known about it instantly. I know of no force in the Multiverse that could have prevented that. Thus, it must have happened later."
Ugin drew himself up to his full height and glared forty feet down at Sarkhan.
#figure(image("007_Unbroken and Unbowed/04.jpg", width: 100%), caption: [Ugin, the Spirit Dragon | Art by Raymond Swanland], supplement: none, numbering: none)
"Yet my questions remain," he said. "Who are you, Planeswalker? And how did this stone come into your possession?"
"My name is Sarkhan Vol."
Vol was forgotten, Sarkhan forbidden, but there could be no question, not now. That was his name.
"Sarkhan," said Ugin, with a hint of amusement. #emph[Great khan] . He gestured to the images on the canyon wall, encompassing all of Tarkir. "They bow to you?"
"…No," said Sarkhan. "But I bow to no one."
"Go on."
"I am from Tarkir," said Sarkhan, "but my Tarkir was a tomb—a graveyard for dragons, hunted and killed by the ancient khans. You were dead, Ugin. I saw your bones, in this very canyon."
Ugin was impassive.
"You spoke to me," said Sarkhan. "Your spirit…spoke to me. Whispered to me of the glory of dragons. Told me that everything I suspected of this world—the decadence, the wrongness, the #emph[lack] —was real. I did not know then that you were a Planeswalker. I knew only that you were a ghost. My own Planeswalker spark ignited in a rush of flame. I left Tarkir, and your voice fell silent. I found dragons, great beasts deserving of my reverence—not least because they did not know or care that they had it. Then…then I found one who welcomed it, and I foolishly gave myself to his cause. He sent me to the Eye."
"Who?" said Ugin.
"You must understand," said Sarkhan, "I was not in my right mind. He was not what I thought he was, and it broke me, bent me to his will."
"#emph[Who?] "
"…<NAME>," said Sarkhan miserably.
#figure(image("007_Unbroken and Unbowed/05.jpg", width: 100%), caption: [Cruel Ultimatum | Art by Todd Lockwood], supplement: none, numbering: none)
Ugin raised a hand, and a sphere of glittering force sprang into being around Sarkhan. He pushed against it, but it was smooth and warm and utterly unyielding. The runes on Ugin's neck glowed brightly.
"#emph[Bolas] sent you to the Eye?" said Ugin. "Why?"
"He wanted…" Sarkhan faltered, sorting through memories twisted by madness. "He wanted it opened, the devourers released. He never told me why."
Ugin's neck frills flared.
"If he engineered the Eldrazi's release, he is far less cautious than I remember him."
"He is obsessed with power," said Sarkhan. "He was once like a god, so he told me—but no longer. He wants that power back."
"And you?" asked Ugin. "What do you want, Sarkhan Vol?"
"To be free of him forever," said Sarkhan. "To make him pay, someday, for what he did to me. And to you."
Ugin waved one clawed hand, and the sphere of force vanished.
"So you journeyed to the Eye. There were others?"
"Yes," said Sarkhan. "A pyromancer, and a mind mage. Both Planeswalkers. We fought. The pyromancer bested me with…" Understanding dawned. "With your own fire, Ugin. Somehow she knew."
"Interesting," said Ugin. "Yet you lived."
"They had no great desire to fight me. As soon as I was incapacitated, they fled. When I awoke, I heard your voice again. The Eye was open. I took the hedron shard back to Bolas, and told him you had spoken to me. He told me he had killed you, said something about a…a failsafe. And then he dismissed me."
"And you came here?"
"Here, but not here," said Sarkhan. "I returned to my Tarkir, a Tarkir of khans and dragon bones. Your voice grew all the stronger, urging me to come to this canyon. I arrived at the canyon…with the help of a friend. Your death created some kind of…vortex in time, linking that moment to the present. When I stepped through I traveled back, before the dragons died, and tipped the scales of history. Then I found myself here, truly here, in a world transformed by my own actions."
"Do you know what happened after I fell? I have had no time to study history."
"Some," said Sarkhan. "The dragon tempests never ceased. Dragon-kind never died out. The khans fell. And in their place rose five elder dragons. The dragonlords claimed their rightful place in command of the world. Where once the clans fought dragons, now the dragons and the clans are one."
Ugin turned to the canyon wall, watching the scenes of dragons and humanoids fighting together. Sarkhan scowled. Ugin had been his guide, his confidant…the only person who believed he could change the world. Ugin had #emph[known] . But this Ugin seemed anything but all-knowing.
"I have answered your questions," said Sarkhan. "Will you answer mine?"
Ugin turned back to Sarkhan and nodded.
"Dying, speaking to me, sending me back…" said Sarkhan. "You truly remember none of these things?"
#figure(image("007_Unbroken and Unbowed/06.jpg", width: 100%), caption: [Tormenting Voice | Art by Volkan Baga], supplement: none, numbering: none)
"The last thing I remember," said Ugin, "is you and your hedron shard, after Bolas cast me down. Then I slumbered. Time passed, but how much I could not say. I slept…and I healed. An ally of mine, a vampire and a Planeswalker, woke me up and spoke to me of 'foolishness at the Eye.' He meant you and the other two, though I'm not sure he knew that. <NAME>—do you know him?"
Sarkhan shook his head. Confusion reigned; the companion in his head had not been Ugin…or not this Ugin.
"Who spoke to me, if not you?" asked Sarkhan. "The friend who helped me get here—she died in the helping. Where is she now? Who was she? Who is she? A whole world has gone missing on my account, Ugin. And though I had no love for it, it was my home. What of that Tarkir?"
"It is gone," said Ugin. "She is gone. Not only gone—the world you remember never existed and its people met very different fates. And what spoke to you at the Eye was the ghost of someone who never died. A ghost you brought there with you, most likely. Or perhaps only a voice."
"Different fates…" said Sarkhan. "I have met people who looked like those I knew, both friends and enemies. But they did not know me. As though I were never born. But how can that be? If I was never born, then where did I come from? Who went to the Eye? Who saved you?"
"You did," said Ugin. "The Eye is in your past, in this hedron shard's past. You went there, traveled to Tarkir's past, and used the shard to save me. It must have happened, or the change itself would not have been possible. Whatever circumstance arose when I died—whatever my spirit did that allowed you to travel back through time—it only affected Tarkir. Which means that you, Sarkhan Vol, stepped fully formed out of a shadow, a place that never existed."
"Then in this world's history, I was never born," said Sarkhan. Understanding dawned. "I sprang from the sky one day…like a dragon."
#figure(image("007_Unbroken and Unbowed/07.jpg", width: 100%), caption: [Dragon Tempest | Art by Willian Murai], supplement: none, numbering: none)
"I suppose so," said Ugin.
"So I'm a curiosity now," said Sarkhan, smiling. "An orphan of time. Whether I was haunted or only mad, the voice that guided me has fallen silent. My mind is my own, and Tarkir is the world I always longed for."
He stepped back.
"You say my friend is gone. Ojutai's monks said the same. I say she lives again, and I will find her."
He focused, drawing mana to himself and awakening the dragon within. It was easier now. It grew easier every time. A dragon's shape spilled forth.
"Thank you," he said, before his human mouth slipped away, and launched himself into the sky.
The canyon fell away and the icy wastes spread out beneath him. The Narset he knew had sought knowledge above all else. And that quest had brought her, ultimately, here—to Ugin's canyon. If this world's Narset was exiled, branded a heretic…where else would she be?
He ranged over the valley at top speed—riding thermals up, gliding down—sharp eyes watching for any sign of movement. At last, as the sun dipped low in the sky, he saw her walking resolutely through knee-deep snow. He dropped to the ground on a bare patch of rock and shed his scales for human flesh. He stood, staff in hand, and waited.
Her progress was slow, but she saw him and turned to meet him. She looked different. He supposed he did too. Her eyes pulsed with power. This Narset had touched something the other Narset had only glimpsed.
She stopped a few yards away from him, but said nothing.
"Narset!" he said. "You're alive!"
She looked him up and down, her eyes eventually settling on his face. She blinked.
"I don't know you," she said, looking away. "Do I?"
"I am Sarkhan," he said.
"#emph[You] are the sar-khan?" she said, eyes narrowing. "Or do you claim his mantle?"
"You've heard of me?" asked Sarkhan. He laughed. "That's wonderful! On all Tarkir, you are the only one who knows me. But how?"
She moved to walk around him.
"I need to find Ugin," she said, shaking her head.
"He is in the canyon," said Sarkhan, "though I fear you'll find he has more questions than answers. Narset, how do you know me?"
She stopped.
"You're not…some enforcer for the dragonlord, here to punish my heresy?"
"I am no one's servant," said Sarkhan. "I am your friend—or was, and hope to be again."
"My friend," said Narset. "Yet I've never met you. How is that possible?"
Sarkhan weighed his options…and decided on the truth, no matter that it sounded more implausible than any lie he might concoct.
"The Narset I knew was from Tarkir, but not this Tarkir. A Tarkir without dragons—of khans, and clans. My home. She died so I could travel to the past…and rewrite history. She died so that Ugin—and you—could live. She was my friend."
"Then the histories are true," said Narset. Her eyes flicked back and forth, as though reading.
"What histories?"
"Secret histories," she said. "About a dragon-man, a sar-khan, who came from something called the Unwritten—a spiritual vision of the future that an ancient clan called the Temur wrote about. They say the sar-khan raved about a world with no dragons. He saved Ugin, then vanished back into the Unwritten. I didn't credit the story, not in its details. But…it's true, then? The Unwritten, the khans, all of it?"
#figure(image("007_Unbroken and Unbowed/08.jpg", width: 100%), caption: [Learn from the Past | Art by Chase Stone], supplement: none, numbering: none)
"I don't know what you've read," said Sarkhan, smiling. "But everything you just said is true. Even the raving, I suppose."
"That is how I know you," said Narset. "But you do not truly know me, do you? You know…some Unwritten Narset. A phantom."
"I suppose not," said Sarkhan. "Yes. I knew Narset. But I do not know you."
Narset frowned, as though searching for words.
"Were you…close?"
"We might have been, given time," said Sarkhan. "But she is twice gone, now—dead and never born. You are here, now. But where were you? I looked for you among the Ojutai. The man I spoke to called you a heretic, told me you were 'gone.' Was it exile he spoke of?"
Narset shook her head.
"No," she said. "Something…far greater. It will sound mad, but I traveled beyond Tarkir, written or Unwritten, to…"
"…to another world?" said Sarkhan.
Narset's eyes widened.
"How do you know about that?"
"Planeswalker," said Sarkhan. "That's what we're called. There are very few of us. But between you, me, and Ugin, there are three in this valley right now."
#figure(image("007_Unbroken and Unbowed/09.jpg", width: 100%), caption: [Narset Transcendent | Art by Magali Villeneuve], supplement: none, numbering: none)
"Ugin," said Narset. "I need to speak to him."
She began to walk again, away from him, through the snow.
"Perhaps you should," said Sarkhan. "I hope he has more answers for you than he did for me. And after that?"
"To Atarka lands," said Narset, still walking. "Rumor has it they have ancient stories, carved in mammoth ivory, that go all the way back to the Khanfall."
"You're not planning to leave Tarkir again?" asked Sarkhan. "There are multitudes of worlds to explore, and you cannot have seen them all."
"Someday I will," said Narset, looking back over her shoulder. "But this world has secrets enough. For right now…I'm right where I want to be."
Sarkhan smiled and looked out over the tundra. In the distance, dragons soared.
"I know exactly what you mean."
|
|
https://github.com/fenjalien/metro | https://raw.githubusercontent.com/fenjalien/metro/main/tests/num/exponent/exponent-thresholds/test.typ | typst | Apache License 2.0 | #import "/src/lib.typ": unit, metro-setup, num, qty
#set page(width: auto, height: auto)
#let inputs = (
"0.001",
"0.012",
"0.123",
"1",
"12",
"123",
"1234"
)
#table(
columns: (auto,)*3,
[Input], [Threshold $-3:3$], [Threshold $-2:2$],
..for i in inputs {(
num(i),
num(i, exponent-mode: "threshold"),
num(i, exponent-mode: "threshold", exponent-thresholds: (-2, 2)),
)}
) |
https://github.com/soul667/typst | https://raw.githubusercontent.com/soul667/typst/main/PPT/MATLAB/touying/docs/i18n/zh/docusaurus-plugin-content-docs/current/external/typst-preview.md | markdown | ---
sidebar_position: 2
---
# Typst Preview
VS Code 的 Typst Preview 插件提供了优秀的 slide mode,我们可以用其预览和放映 slides。
按下 `Ctrl/Cmd + Shift + P`,并输入 `Typst Preview: Preview current file in slide mode`,就可以打开 slide mode 的预览。
按下 `Ctrl/Cmd + Shift + P`,并输入 `Typst Preview: Preview current file in browser and slide mode`,就可以在浏览器打开 slide mode。
这时候你可以按下 `F11` 之类的键,进入浏览器的全屏模式,就可以用于 slides 放映了。
由于 Typst Preview 是基于 SVG 的,因此可以播放 GIF 动图,这对于动态 slides 很有帮助。
|
|
https://github.com/isaacadams/typst-template | https://raw.githubusercontent.com/isaacadams/typst-template/main/example.typ | typst | #emph[Hello] \
#emoji.face \
#"hello".len()
#let (x, y) = (1, 2)
The coordinates are #x, #y.
#let (a, .., b) = (1, 2, 3, 4)
The first element is #a.
The last element is #b.
#let books = (
Shakespeare: "Hamlet",
Homer: "The Odyssey",
Austen: "Persuasion",
)
#let (Austen,) = books
Austen wrote #Austen.
#let (Homer: h) = books
Homer wrote #h.
#let (Homer, ..other) = books
#for (author, title) in other [
#author wrote #title.
]
|
|
https://github.com/r8vnhill/apunte-bibliotecas-de-software | https://raw.githubusercontent.com/r8vnhill/apunte-bibliotecas-de-software/main/Unit3/Compilation.typ | typst | == Compilación de bibliotecas
Creemos un proyecto simple que se compone de dos servicios:
- *EchoLib*: Una librería con una función `id` que recibe un string de `texto` y retorna el mismo `texto` sin transformaciones.
- *EchoApp*: Una aplicación que pide palabras a un usuario y las imprime sin realizar modificación.
Recordemos que queremos que nuestras APIs:
- Estén versionadas, por lo que necesitamos almacenar el número de versión.
- Sigan un estándar de formato, por lo que es conveniente configurar una herramienta de análisis estático como Detekt.
=== Configuración de Propiedades
```properties
# gradle.properties
kotlin.code.style=official
kotlin.version=2.0.0
echo.version=1.0.0
detekt.version=1.23.1
```
=== Configuración de Proyectos
```kotlin
// settings.gradle.kts
rootProject.name = "echo"
include("echoLib", "echoApp")
pluginManagement {
repositories {
gradlePluginPortal()
}
plugins {
kotlin("jvm") version extra["kotlin.version"] as String
id("io.gitlab.arturbosch.detekt") version extra["detekt.version"] as String
}
}
```
=== Configuración del Proyecto Raíz
```kotlin
// build.gradle.kts
plugins {
kotlin("jvm")
id("io.gitlab.arturbosch.detekt")
}
allprojects {
group = "cl.ravenhill.echo"
version = extra["echo.version"] as String
}
subprojects {
repositories {
mavenCentral()
}
}
```
=== Configuración del Proyecto EchoApp
```kotlin
// echoApp/build.gradle.kts
plugins {
id("io.gitlab.arturbosch.detekt")
kotlin("jvm")
}
kotlin {
jvmToolchain(17)
}
```
=== Configuración del Proyecto EchoLib
```kotlin
// echoLib/build.gradle.kts
plugins {
id("io.gitlab.arturbosch.detekt")
kotlin("jvm")
}
kotlin {
jvmToolchain(17)
}
```
=== Implementación de la Librería
Supongamos que nuestra librería se compone de una función `id(String): String`.
Esta función recibe un parámetro y lo retorna sin modificaciones.
```kotlin
// echoLib/src/main/kotlin/cl/ravenhill/echo/util/Id.kt
package cl.ravenhill.echo.util
fun id(text: String): String = text
```
=== Creando una biblioteca .jar
Un archivo JAR (Java ARchive) es un formato de archivo de paquete utilizado para agrupar múltiples archivos de clase Java, metadatos y recursos (como textos, imágenes, etc.) en un solo archivo para distribución y despliegue. Los archivos JAR se basan en el formato de archivo ZIP y tienen una estructura similar.
Dentro del archivo JAR, hay un directorio especial llamado META-INF que contiene un archivo llamado MANIFEST.MF. El archivo de manifiesto contiene metadatos sobre el archivo JAR, como la versión, la clase principal (para JARs ejecutables), y otra información del paquete. Para los JARs ejecutables, el archivo de manifiesto especifica el punto de entrada de la aplicación utilizando el atributo Main-Class.
==== Configuración del Archivo JAR en echoLib
```kotlin
// echoLib/build.gradle.kts
/* ... */
tasks.jar {
manifest {
attributes["Implementation-Title"] = "echoLib"
attributes["Implementation-Version"] = project.version
}
from(sourceSets.main.get().output)
}
```
==== Copia del Archivo JAR en echoApp
```kotlin
// build.gradle.kts
/* ... */
tasks.register<Copy>("copyLib") {
group = "build"
description = "Copia el archivo JAR de la biblioteca a la aplicación"
dependsOn(":echoLib:jar")
from("echoLib/build/libs")
into("echoApp/libs")
}
```
==== Configuración de Dependencias en echoApp
```kotlin
// echoApp/build.gradle.kts
/* ... */
repositories {
flatDir {
dirs("libs")
}
}
dependencies {
implementation(fileTree("libs") { include("*.jar") })
}
```
==== Explicación del Código
- *Configuración del Archivo JAR en echoLib*:
- Configura la tarea `jar` para incluir un manifiesto con los atributos `Implementation-Title` y `Implementation-Version`.
- Incluye los archivos de salida del conjunto de fuentes principal en el archivo JAR.
- *Copia del Archivo JAR en echoApp*:
- Registra una tarea `copyLib` que copia el archivo JAR generado en `echoLib` al directorio `libs` de `echoApp`.
- La tarea `copyLib` depende de la tarea `jar` en `echoLib`, asegurando que el archivo JAR se genere antes de copiarlo.
- *Configuración de Dependencias en echoApp*:
- Configura el repositorio `flatDir` para incluir el directorio `libs`.
- Define una dependencia de implementación que incluye todos los archivos JAR en el directorio `libs`.
=== Creando un Ejecutable
Supongamos que tenemos un archivo `Echo.kt` en el paquete `cl.ravenhill.echo` con el siguiente código:
```kotlin
// echoApp/src/main/kotlin/cl/ravenhill/echo/Echo.kt
package cl.ravenhill.echo
import cl.ravenhill.echo.util.id
fun main(args: Array<String>) {
for (arg in args) {
println(id(arg))
}
}
```
=== Configuración del Proyecto EchoApp
```kotlin
// echoApp/build.gradle.kts
plugins {
id("io.gitlab.arturbosch.detekt")
kotlin("jvm")
// Declaramos que nuestro programa es una aplicación
application
}
/* ... */
application {
mainClass.set("cl.ravenhill.echo.EchoKt")
}
```
En esta configuración, declaramos el punto de entrada de la aplicación. Si la función `main` está definida en el archivo `cl.ravenhill.echo.Echo.kt`, entonces el punto de entrada es `cl.ravenhill.echo.EchoKt`.
=== Ejecución de la Aplicación
```powershell
.\gradlew.bat run
```
```bash
./gradlew run
```
Esta configuración es útil para probar la aplicación, pero no es ideal para “publicarla”. Nos gustaría que nuestro “cliente” pueda ejecutar la aplicación sin necesidad de Gradle.
Aquí tienes la versión mejorada y desarrollada usando la sintaxis de Typst:
=== Creación de un JAR Ejecutable
Podemos crear JAR ejecutables con Gradle. Un fat JAR (también conocido como uber JAR) es un archivo JAR que contiene no solo las clases y recursos de tu propia aplicación, sino también todas las dependencias necesarias para ejecutarla.
```kotlin
tasks.register<Jar>("fatJar") { // 1
archiveClassifier.set("fat") // 2
duplicatesStrategy = DuplicatesStrategy.EXCLUDE // 3
manifest { // 4
attributes["Main-Class"] = application.mainClass.get()
attributes["Implementation-Title"] = "Echo"
attributes["Implementation-Version"] = "1.0"
}
from(sourceSets.main.get().output) // 5
dependsOn(configurations.runtimeClasspath) // 6
from({ // 7
configurations.runtimeClasspath
.get()
.filter { it.name.endsWith("jar") }
.map { project.zipTree(it) }
})
}
```
1. Registramos una tarea `fatJar` para empaquetar la aplicación.
2. Configura el nombre del archivo JAR resultante con el sufijo "fat".
3. Establece la estrategia de manejo de duplicados a `EXCLUDE` (excluir archivos duplicados).
4. Configura el manifiesto del JAR.
5. Añade el código fuente de la aplicación al JAR.
6. Establece que esta tarea depende de las clases en el classpath de tiempo de ejecución.
7. Añade las dependencias del classpath de tiempo de ejecución al JAR.
Con la tarea creada podemos compilar el JAR:
```powershell
# Windows
.\gradlew.bat fatJar
```
```bash
# Unix
./gradlew fatJar
```
Para ejecutar un JAR necesitamos Java:
```bash
java -jar echoApp/build/libs/echoApp-1.0.0-fat.jar Hello world
```
|
|
https://github.com/kaarmu/splash | https://raw.githubusercontent.com/kaarmu/splash/main/src/palettes/google-workspace.typ | typst | MIT License | /* The color palette in Google Workspace (GSuite family of applications)
*
* Source: https://spreadsheet.dev/how-to-get-the-hexadecimal-codes-of-colors-in-google-sheets
* Accessed: 2023-03-29
*/
#let google = (
black : rgb("#000000"),
white : rgb("#ffffff"),
red-berry : rgb("#980000"),
red : rgb("#ff0000"),
orange : rgb("#ff9900"),
yellow : rgb("#ffff00"),
green : rgb("#00ff00"),
cyan : rgb("#00ffff"),
cornflower-blue : rgb("#4a86e8"),
blue : rgb("#0000ff"),
purple : rgb("#9900ff"),
magenta : rgb("#ff00ff"),
light-red-berry-3 : rgb("#e6b8af"),
light-red-3 : rgb("#f4cccc"),
light-orange-3 : rgb("#fce5cd"),
light-yellow-3 : rgb("#fff2cc"),
light-green-3 : rgb("#d9ead3"),
light-cyan-3 : rgb("#d0e0e3"),
light-cornflower-blue-3 : rgb("#c9daf8"),
light-blue-3 : rgb("#cfe2f3"),
light-purple-3 : rgb("#d9d2e9"),
light-magenta-3 : rgb("#ead1dc"),
light-red-berry-2 : rgb("#dd7e6b"),
light-red-2 : rgb("#ea9999"),
light-orange-2 : rgb("#f9cb9c"),
light-yellow-2 : rgb("#ffe599"),
light-green-2 : rgb("#b6d7a8"),
light-cyan-2 : rgb("#a2c4c9"),
light-cornflower-blue-2 : rgb("#a4c2f4"),
light-blue-2 : rgb("#9fc5e8"),
light-purple-2 : rgb("#b4a7d6"),
light-magenta-2 : rgb("#d5a6bd"),
light-red-berry-1 : rgb("#cc4125"),
light-red-1 : rgb("#e06666"),
light-orange-1 : rgb("#f6b26b"),
light-yellow-1 : rgb("#ffd966"),
light-green-1 : rgb("#93c47d"),
light-cyan-1 : rgb("#76a5af"),
light-cornflower-blue-1 : rgb("#6d9eeb"),
light-blue-1 : rgb("#6fa8dc"),
light-purple-1 : rgb("#8e7cc3"),
light-magenta-1 : rgb("#c27ba0"),
dark-red-berry-1 : rgb("#a61c00"),
dark-red-1 : rgb("#cc0000"),
dark-orange-1 : rgb("#e69138"),
dark-yellow-1 : rgb("#f1c232"),
dark-green-1 : rgb("#6aa84f"),
dark-cyan-1 : rgb("#45818e"),
dark-cornflower-blue-1 : rgb("#3c78d8"),
dark-blue-1 : rgb("#3d85c6"),
dark-purple-1 : rgb("#674ea7"),
dark-magenta-1 : rgb("#a64d79"),
dark-red-berry-2 : rgb("#85200c"),
dark-red-2 : rgb("#990000"),
dark-orange-2 : rgb("#b45f06"),
dark-yellow-2 : rgb("#bf9000"),
dark-green-2 : rgb("#38761d"),
dark-cyan-2 : rgb("#134f5c"),
dark-cornflower-blue-2 : rgb("#1155cc"),
dark-blue-2 : rgb("#0b5394"),
dark-purple-2 : rgb("#351c75"),
dark-magenta-2 : rgb("#741b47"),
dark-red-berry-3 : rgb("#5b0f00"),
dark-red-3 : rgb("#660000"),
dark-orange-3 : rgb("#783f04"),
dark-yellow-3 : rgb("#7f6000"),
dark-green-3 : rgb("#274e13"),
dark-cyan-3 : rgb("#0c343d"),
dark-cornflower-blue-3 : rgb("#1c4587"),
dark-blue-3 : rgb("#073763"),
dark-purple-3 : rgb("#20124d"),
dark-magenta-3 : rgb("#4c1130"),
)
#let google-simple-light = (
text-1 : rgb("#000000"),
text-2 : rgb("#595959"),
background-1 : rgb("#ffffff"),
background-2 : rgb("#eeeeee"),
accent-1 : rgb("#4285f4"),
accent-2 : rgb("#212121"),
accent-3 : rgb("#78909c"),
accent-4 : rgb("#ffab40"),
accent-5 : rgb("#0097a7"),
accent-6 : rgb("#eeff41"),
)
#let google-simple-dark = (
text-1 : rgb("#ffffff"),
text-2 : rgb("#adadad"),
background-1 : rgb("#212121"),
background-2 : rgb("#303030"),
accent-1 : rgb("#009688"),
accent-2 : rgb("#eeeeee"),
accent-3 : rgb("#78909c"),
accent-4 : rgb("#ffab40"),
accent-5 : rgb("#4dd0e1"),
accent-6 : rgb("#eeff41"),
)
|
https://github.com/ljgago/typst-chords | https://raw.githubusercontent.com/ljgago/typst-chords/main/examples/piano-chords.typ | typst | MIT License | #import "../lib.typ": *
#set document(date: none)
#set page(width: auto, height: auto, margin: 0pt)
#let piano-chord-sharp = piano-chord.with(layout: "F", size: 18pt)
#let piano-chord-round = piano-chord.with(layout: "F", size: 1.5em, design: "round")
#rect(
stroke: none,
radius: 3pt,
inset: (x: 10pt, y: 10pt),
fill: white, [
#piano-chord-sharp(keys: "<KEY>", fill-key: blue)[B]
#h(2em)
#piano-chord-round(keys: "<KEY>", fill-key: yellow, position: "bottom")[B]
#h(2em)
#piano-chord-round(keys: "<KEY>", fill-key: red, background: silver)[B]
]
)
|
https://github.com/eliapasquali/typst-thesis-template | https://raw.githubusercontent.com/eliapasquali/typst-thesis-template/main/chapters/stage-description.typ | typst | Other | #pagebreak(to:"odd")
= Descrizione dello stage
<cap:descrizione-stage>
#v(1em)
#text(style: "italic", [
Breve introduzione al capitolo
])
#v(1em)
== Analisi preventiva dei rischi
Durante la fase di analisi iniziale sono stati individuati alcuni possibili rischi a cui si potrà andare incontro.
Si è quindi proceduto a elaborare delle possibili soluzioni per far fronte a tali rischi.
#set par(first-line-indent: 0pt)
1. Performance del simulatore hardware
/ Descrizione: le performance del simulatore hardware e la comunicazione con questo potrebbero risultare lenti o non abbastanza buoni da causare il fallimento dei test
/ Soluzione: coinvolgimento del responsabile a capo del progetto relativo il simulatore hardware
<risk:hardware-simulator>
== Requisiti e obiettivi
== Pianificazione
|
https://github.com/typst-doc-cn/tutorial | https://raw.githubusercontent.com/typst-doc-cn/tutorial/main/src/introduction.typ | typst | Apache License 2.0 | #import "mod.typ": *
#show: book.page.with(title: [导引])
本教程面向所有Typst用户,循序渐进,供以中文为母语的Typst语言初学者和爱好者查阅和参考。本教程希望弥补Typst相关资料的缺失,作为官方文档的补充,帮助大家入门和学习Typst。
本教程的首要定位是,即便你没有学习过任何编程语言,也能通过在本教程中学到的知识上手使用Typst,在日常生活中使用Typst编写各式各样的文档。同时,本教程也会总结在使用Typst编写文档的过程中遇到的一系列问题。
== 为什么学习Typst?
在开始之前,让我们考虑一下 Typst 到底是什么,以及我们在什么时候应该使用它。 Typst 是一种用于排版文档的标记语言,它旨在易于学习、快速且用途广泛。 Typst 输入带有标记的文本文件,并将其输出为 PDF 格式。
Typst 是撰写长篇文本(如论文、文章、书籍、报告和作业)的极佳选择。 并且,Typst 非常适合书写包含数学公式的文档,例如数学、物理和工程领域的论文。 此外,由于其强大的样式和自动化功能,它是编写具有相同样式的一系列文档(例如丛书)的绝佳选择。
== 阅读本教程前,您需要了解的知识
你不需要了解任何前置知识,所需的仅仅是安装Typst,并跟着本教程的在线示例一步步学习。
== 其他参考资料
- #link("https://typst-doc-cn.github.io/docs/tutorial/")[官方文档翻译 - 入门教程]
- #link("https://typst-doc-cn.github.io/docs/chinese/")[非官方中文用户指南]
- #link("https://typst-doc-cn.github.io/docs/reference/")[官方文档翻译 - 参考]
- #link("https://sitandr.github.io/typst-examples-book/book/about.html")[Typst Example Books]
= 配置Typst运行环境
== 使用官方的webapp(推荐)
官方提供了*在线且免费*的多人协作编辑器。该编辑器会从远程下载WASM编译器,并在你的浏览器内运行编辑器,为你提供预览服务。
#figure(image("/assets/files/editor-webapp.png"), caption: [本书作者在网页中打开webapp的瞬间])
该编辑器的速度相比许多LaTeX编辑器都有显著优势。这是因为:
- 你的大部分编辑操作不会导致阻塞的网络请求。
- 所有计算都在本地浏览器中运行。
- 编译器本身性能极其优越。
你可以注册一个账户并开箱即用该编辑器。
*注意:你需要检测你的网络环境,如有必要请使用科学上网工具(VPN等)。*
== 使用VSCode编辑(推荐)
打开扩展界面,搜索并安装 tinymist 插件。它会为你提供语法高亮,代码补全,代码格式化,即时预览等功能。
#figure(image("/assets/files/editor-vscode.png"), caption: [本书作者在VSCode中预览并编辑本文的瞬间])
该编辑器的速度相比webapp略慢。这是因为:
- 编译器与预览程序是两个不同的进程,有通信开销。
- 用户事件和文件IO有可能增加E2E延时。
但是:
- 大部分时间下,你感受不到和webapp之间的性能差异。Typst真的非常快。
- 你可以离线编辑Typst文档,无需任何网络连接,例如本书的部分章节是在飞机上完成的。
- 你可以在文件系统中管理你所有的源代码,实施包括但不限于使用git等源码管理软件等操作。
== 使用neovim编辑
细节可以问群友。
自去年年底,该编辑器与VSCode一样,已经可以有很好的Typst编辑体验。
== 使用Emacs编辑
可以问群友。
自今年年初,该编辑器与VSCode一样,已经可以有很好的Typst编辑体验。
== 使用typst-cli与PDF阅读器
Typst 的 CLI 可从不同的来源获得:
- 你可以获得最新版本的 Typst 的源代码和预构建的二进制文件来自#link("https://github.com/typst/typst/releases/")[发布页面]。下载适合你平台的存档并将其放在“ PATH ” 中的目录中。及时了解未来发布后,你只需运行```bash typst update```即可。
- 你可以通过不同的包管理器安装Typst。请注意,包管理器中的版本可能落后于最新版本。
- Linux:查看#link("https://repology.org/project/typst/versions")[Typst on Repology]。
- macOS:```bash brew install typst```。
- Windows:```bash winget install --id Typst.Typst ```。
- 如果您安装了#link("https://rustup.rs/")[Rust]工具链,您还可以安装最新开发版本```bash cargo --git https://github.com/typst/typst --locked typst-cli```。请注意,这将是一个“夜间”版本,可能已损坏或尚未正确记录。
- Nix用户可以将`typst`包与```bash nix-shell -p typst```一起使用,或者构建并使用```bash nix run github:typst/typst -- --version```运行前沿版本。
- Docker用户可以运行预构建的镜像```bash docker run -it ghcr.io/typst/typst:latest ```.
安装好CLI之后,你就可以在命令行里运行Typst编译器了:
```bash
# Creates `file.pdf` in working directory.
typst compile file.typ
# Creates PDF file at the desired path.
typst compile path/to/source.typ path/to/output.pdf
```
为了提供预览服务,你需要让Typst编译器运行在监视模式(watch)下:
```bash
# Watches source files and recompiles on changes.
typst watch file.typ
```
当你启动Typst编译器后,你可以使用你喜欢的编辑器编辑Typst文档,并使用你喜欢的PDF阅读器打开编译好的PDF文件。PDF阅读器推荐使用:
- 在Windows下使用#link("https://www.sumatrapdfreader.org/free-pdf-reader")[Sumatra PDF]。
== 各Typst运行环境的比较
#{
set align(center)
table(
columns: (1fr, 1fr, 1fr, 1fr, 48pt, 48pt, 1fr),
[名称], [编辑器], [编译器环境], [预览方案], [是否支持即时编译], [语言服务], [备注],
[WebAPP], [Code Mirror], [wasm], [渲染图片], [是], [优秀], align(left)[开箱即用,需要科学上网,无法git],
[VSCode], [VSCode], [native], [webview], [是], [良好], align(left)[简单上手,定制性差],
[neovim], [neovim], [native], [webview], [是], [良好], align(left)[不易安装,定制性好],
[Emacs], [Emacs], [native], [webview], [是], [良好], align(left)[难以安装],
[typst-cli], [任意编辑器], [native], [任意PDF阅读器], [否], [无], align(left)[简单上手,灵活组合],
)
}
= 如何阅读本书
本书主要分为三个部分:
+ 教程:介绍Typst的语法、原理和理念,以助你深度理解Typst。
+ 参考:完整介绍Typst中内置的函数和各种外部库,以助你广泛了解Typst的能力,用Typst实现各种排版需求。
+ 专题等:与参考等章节的区别是,每个专题都专注解决一类问题,而不会讲解函数的用法。
每个部分都包含大量例子,它们各有侧重:
- 教程中的例子希望切中要点,而避免冗长的全面的展示特性。
- 参考中的例子希望讲透元素和函数的使用,例子多选自过去的一年中大家常问的问题。
- 专题中的例子往往有连贯性,从前往后带你完成一系列专门的问题。专题中的例子假设你已经掌握了相关知识,只以最专业的代码解决该问题。
#pro-tip[
本书会随时夹带一些“Pro Tip”。这些“Pro Tip”由蓝色框包裹。它们告诉你一些较难理解的知识点。
你可以选择在初次阅读时*跳过*这些框,而不影响对正文的理解。但建议你在阅读完整本书后回头观看所不理解的那些“Pro Tip”。
]
以下是推荐的阅读方法:
+ 首先阅读《编写一篇基本文档 -- 标记篇》和《编写一篇基本文档 -- 脚本篇》。
经过这一步,你应该可以像使用Markdown那样,编写一篇基本不设置样式的文档。同时,这一步的学习难度也与学习完整Markdown语法相当。
+ 接着,阅读《基本教程》剩余两篇内容。
经过这一步,你应该已经基本入门了Typst的标记和脚本。此时,你和进阶用户的唯一区别是,你还不太会使用高级的样式配置。推荐:
- 如果你熟练阅读英语,推荐主要参考#link("https://typst.app/docs/")[官方文档]的内容。
- 否则,推荐继续阅读本书剩下的内容,并参考#link("https://typst-doc-cn.github.io/docs/")[非官方中文文档]的内容。
有什么问题?
- 本书只有《基本教程》完成了校对和润色,后续部分还非常不完善。甚至《基本教程》部分还有待改进。
- #link("https://typst-doc-cn.github.io/docs/")[非官方中文文档]是GPT机翻后润色的的结果,有可能错翻、漏翻,内容也可能有些许迟滞。
+ 接着,同时阅读《基本参考》和《进阶教程》。你可以根据你的需求挑选《基本参考》的部分章节阅读。即便不阅读任何《基本参考》中的内容,你也可以继续阅读《进阶教程》。
经过这一步,你应该已经完全学会了目前Typst的所有理念与内容。
= 许可证
*typst-tutorial-cn* 所有的源码和文档都在#link("https://www.apache.org/licenses/LICENSE-2.0")[Apache License v2.0]许可证下发布.
|
https://github.com/Myriad-Dreamin/typst.ts | https://raw.githubusercontent.com/Myriad-Dreamin/typst.ts/main/fuzzers/corpora/layout/pagebreak_03.typ | typst | Apache License 2.0 |
#import "/contrib/templates/std-tests/preset.typ": *
#show: test-page
// Test a combination of pagebreaks, styled pages and pages with bodies.
// Should result in three five pages, with the fourth one being forest-colored.
#set page(width: 80pt, height: 30pt)
#[#set page(width: 60pt); First]
#pagebreak()
#pagebreak()
Third
#page(height: 20pt, fill: forest)[]
Fif#[#set page();th]
|
https://github.com/mriganksagar/cv | https://raw.githubusercontent.com/mriganksagar/cv/main/brilliant-CV/README.md | markdown | Apache License 2.0 | <h1 align="center">
<img src='https://github.com/mintyfrankie/mintyfrankie/assets/77310871/64861d2d-971c-47cd-a5e8-5ad8659f2c2b'>
<br><br>
Brilliant CV Submodule
</h1>
Please refer to the [example repository](https://github.com/mintyfrankie/brilliant-CV) for more information.
Any issue or PR is welcomed!
### Requirements
* [typst](https://github.com/typst/typst)
* [pre-commit](https://pre-commit.com/) |
https://github.com/dead-summer/math-notes | https://raw.githubusercontent.com/dead-summer/math-notes/main/notes/Analysis/ch1-measures/sigma-algebras.typ | typst | #import "/book.typ": book-page
#import "../../../templates/conf.typ": *
#show: thmrules.with(qed-symbol: $square$)
#show: book-page.with(title: "Sigma Algebra")
= $sigma$-algebra
#def[
Let $X eq.not diameter$ be a set.
1. $cal(A) subset cal(P) (X)$ is an algebra if it is closed under finite unions and complement; in others words, if $E_1 , dots.h , E_n in cal(A)$ , then $union.big_1^n E_j in cal(A)$ ; and if $E in cal(A)$, then $E^c in cal(A)$ .
2. An algebra is a $sigma$-algebra if it is also closed under countable unions.
]
In 2 one can replace "countable unions" by disjoint countable unions, since
$ sum_(k = 1)^oo E_k = union.sq.big_(k = 1)^oo tilde(E_k) , $
where $tilde(E_1) = E_1 , tilde(E_2) = E_2 \\ E_1 , tilde(E_n) = E_n \\ (E_1 union E_2 dots.h union E_(n - 1))$ .
#exm[
0. $cal(P) (X)$, and ${ diameter , X }$ are $sigma$-algebra.
1. If $X$ is uncountable, $ cal(F) := { E subset X : E thin upright("or") thin E^c thin upright("is countable") } $ (The point here is that if ${ E_j }_1^n in cal(F)$ , then $union.big_1^oo E_j$ is countable if all $E_j$ are countable and is co-countable otherwise.)
2. ${ cal(F)_i }_(i in I)$ are $sigma$-algebra, $I$ is any indexing set, then $sect.big_(i in I) cal(F)_i$ is $sigma$-algebra.
3. Let $cal(E) subset cal(P) (X)$ be arbitrary, then $ sigma (cal(E)) := sect.big { cal(F) subset cal(P) (X) : cal(F) supset cal(E) }, $ is the smallest $sigma$-algebra on $X$ containing $cal(E)$ , where $cal(F)$ is a $sigma$-algebra.
]
#def[
$sigma (cal(E))$ is called the $sigma$-algebra generated by $cal(E)$ .
]
#prp[
Let $cal(E)_1 subset cal(P) (X)$ be arbitrary and let $cal(E)_2 subset sigma (cal(E)_1)$ , then $sigma (cal(E)_2) subset sigma (cal(E))_1$ .
]
#prf[
Since $sigma (cal(E)_1)$ is a $sigma$-algebra containing $cal(E)_2$ , it therefore contains $sigma (cal(E)_2)$ .
]
Recall: $cal(T) = { O in cal(P) (X) : O thin upright("is open") }$ .
#def[
Let $(X , cal(T))$ be a topological space, then $sigma (cal(T)) equiv cal(B)_X$ is the Bozel $sigma$-algebra on $(X , cal(T))$ .
]
#prp[
On $bb(R) = bb(R)^1$ equipped with the Euclidean topology,
$ cal(B)_(bb(R)) = sigma (cal(A)_i) $ for any $i in { 1 , dots.h , 5 }$
1. open finite intervals: $cal(A)_1 = { (a , b) : a < b }$ ,
2. closed finite intervals: $cal(A)_2 = { [a , b] : a < b }$ ,
3. half- open finite intervals: $cal(A)_3 = { \( a , b \] : a < b }$ , or $cal(A)_3 = { \[ a , b \) : a < b }$ ,
4. open, semi-infinite intervals: $cal(A)_4 = { (a , + oo) }$ , or $cal(A)_4 = { (- oo , a) }$ ,
5. closed, semi-infinite intervals: $cal(A)_5 = { \[ a , + oo \) }$ , or $cal(A)_5 = { \( - oo , a \] }$ .
]
$cal(B)_(bb(R)^n) = cal(B)_(bb(R)) times dots.h times cal(B)_(bb(R))$ ?
Here we follow: G Folland, Real Analysis.
#def[
Let ${ X_i }_(i in I)$ be nonempty sets, $I$ is arbitrary. Let
$X := product_(i in I) X_i$ be the Cartesian product. Let $cal(F)_i$ be
a $sigma$-algebra on $X_i$ for each $i in I$ . Donate the coordinate map
$pi_j : X arrow.r X_j , { x_j }_(i in I) arrow.r x_j$ , then the product
of $sigma$-algebra on $X$ is
$ times.circle.big cal(F)_i := sigma ({ pi_i^(- 1) (E_i) : E_i subset cal(F)_i , i in I }) $
]
Note: for countable $I$ , $pi_i^(- 1) (E_i) = X times X times dots.h times E_i times X times dots.h$ , where $E_i$ is the i-th.
#rmk[
For countable $I$ , $times.circle.big_(i = 1)^oo cal(F)_i = sigma {product_(i = 1)^oo E_i : E_i in cal(F)_i}$
]
#prp[
Consider ${ cal(F)_i }_(i in I)$ , where $cal(F)_i = sigma (cal(E)_i)$ ,
then
$ times.circle.big_(i in I) cal(F) = sigma (hat(cal(E))) , hat(cal(E)) = { pi_i^(- 1) (E_i) : E_i in cal(E)_i , i in I } . $
]
#prf[
By the def of product on $sigma$-algebra,
$ sigma (hat(cal(E))) subset times.circle.big_(i in I) cal(F)_i , $
Conversely, for each $i in I$, consider
$ cal(G)_i := { A subset X_i : pi_i^(- 1) (A) in sigma (hat(cal(E))) } . $
Clearly, $cal(G)_i$ is a $sigma$-algebra on $X_i$ , and
$cal(G)_i supset cal(E)_i$ :
indead, for any $A in cal(E)_i$ , we have
$ pi_i^(- 1) (A) in hat(cal(E))_i subset sigma (hat(cal(E))) . $
Hence,
$cal(G)_i supset sigma (cal(E)_i) = cal(F)_i$ . That is ,
$pi_i^(- 1) (E) in sigma (hat(cal(E)))$ for each
$i in I , E in cal(F)_i$ . Thus,
$times.circle.big cal(F)_i subset sigma (hat(cal(E)))$ .
]
#prp[
Let $X_1 , dots.h , X_n$ be metric spaces. Let
$X = X_1 times dots.h times X_n$, then
$
cal(B)_X supset.eq times.circle.big_(j = 1)^n cal(B)_(X_j) .
$
Equality holds whenever $X_j$ are seperable.
]
#prf[
By the previous proposition,
$ times.circle.big_(j = 1)^n cal(B)_(X_j) = sigma ({ pi_j^(- 1) (U_j) , U_j subset X_j thin upright("is open") , j = 1 , dots.h , n }) . $
But $pi_j^(- 1) (U_j)$ is open in $X$ , so
$times.circle.big cal(B)_(X_j) subset.eq cal(B)_X$ .
Suppose now that
$X_j$ is separable. Say $cal(D)_j subset X_j$ is countable & dense. Then
$ cal(B)_(X_j) = sigma ({ B^(X_j) (x_j , q) : x in cal(D)_j , q in bb(Q) > 0 }) , $
where $B^(X_j) (x_j , q)$ is open metric #emph[Ball] in $X_j$ and $x$ is
the center, $q$ is the radius.
$ cal(B)_X = sigma ({product_(j = 1)^n B^(X_j) (x_j , q) : x_j in cal(D)_j , q in bb(Q) > 0}) , $
so $cal(B)_X = times.circle.big_(j = 1)^n cal(B)_(X_j)$ .
]
#cor[
$ cal(B)_(bb(R)^n) = times.circle.big_(j = 1)^n cal(B)_(bb(R)) . $
]
|
|
https://github.com/Alkon-2024-contest-editorial/hello-alkon | https://raw.githubusercontent.com/Alkon-2024-contest-editorial/hello-alkon/main/description.typ | typst | #import "colors.typ" : KUPC_GREEN, PALE_RED
#import "problems.typ" : contest_problems
#import "abstractions.typ" : pick_color
#let mono(s, color: black) = {text(font: "Inconsolata", fill: color)[#s]}
#let bf(s) = {text(weight: "bold")[#s]}
// 줄바꿈은 #linebreak()를 중간에 넣으면 됩니다.
// 페이지 넘김은 문제 내부에서 ()를 새로 만들어 주세요.
// monospace 문자열은 #mono("abc")와 같이 쓸 수 있습니다.
// 미리 정의되지 않은 operation의 경우에는 #math.op("MEX")와 같이 쓰면 됩니다. 대부분은 정의돼 있으니 그냥 $cos$ 와 같이 쓰면 됩니다.
// 시간복잡도는 $cal(O)(N log N)$ 와 같이 써주세요. log가 자체적으로 함수가 있습니다.
// 이모지는 그냥 넣으면 됩니다. 지원하지 않는 이모지는 깨집니다. 이모지는 https://github.com/polazarus/typst-svg-emoji 를 사용했습니다.
// 그래프도 작성 가능합니다. https://www.graphviz.org/docs/graph/ 를 참고해서 ```render <여기에 그래프를 작성하세요>```
#let cell(num, color: black, fill: none, stroke: none) = {
rect(
height: 50pt, width: 50pt,
stroke: stroke,
fill: fill,
)[#align(center + horizon)[#text(fill: color)[#num]]];
}
#let descriptions = (
// 2A
(
(
[- n은 가장 아랫부분 정사각형 개수이기도 하지만, 높이이기도 합니다. ],
[- 양옆을 보면 높이 만큼 변이 있습니다. $2 dot n$],
[- 밑변은 문제 정의에 따라 n만큼 변이 있습니다. $2 dot n + n$],
[- 남은 윗부분도 결국 다 합치면 길이가 n일 것입니다. $2 dot n + n + n$]
),
),
// 2B
(
(
[- 나머지 연산자는 %입니다.],
[- 거의 모든 언어에서 중복을 허용하지 않는 자료형인 set을 지원합니다.],
[- set의 길이를 구해줍니다. c++의 경우 .size()]
),
(
[- set없이 길이 42 bool 배열로도 풀 수 있습니다.],
[- 42로 나눈 나머지를 인덱스로 생각합니다. ],
[- 해당 인덱스를 True로 바꿔줍니다. ],
[- True인 것의 갯수를 구합니다.]
),
),
// 2C
(
(
[- 대소문자를 구별하지 않을 때 주어진 문자열을 모두 대문자(취향에 따라 소문자)로 바꾸면 편해집니다.],
[- c++ map, python dict와 같은 자료형으로 각 문자가 몇개 나오는지 셉니다.],
[- 26크기의 배열에서 계산해도 됩니다. 아스키코드를 통해 인덱스를 정합니다.(나중에 이런 문제를 만난다면, 이게 더 빠를 것입니다.)],
),
),
// 2D
(
(
[- 우린 $n$보다 큰 값 중 최솟값과 $n$보다 작은 값중 최댓값이 궁금합니다.],
[- 따라서 $S$를 정렬하고 $S$에서 $n$이 어디 사이에 위치하는지 봅니다. 만약에 $S$의 최소보다 작다면 $0$과 $min(S)$ 사이에 있다고 생각하면 됩니다.],
[- $n$이 $a$와 $b$ ($a,b in S, a < b$) 사이에 있는 상황입니다. ],
[- $a+1, a+2, +...+b-2, b-1, b$ 각각을 기준점으로 잡고 구간의 개수를 계산해줍니다.],
[- S의 원소는 1이상 1000이하이므로 $cal(O)((b-a+1)^2)$ 복잡도로 풀 수 있습니다.]
),
),
// 2E/1A
(
(
[- 어떤 의상 종류를 아예 안입거나, 그 중 하나를 입는 경우의 수는 그 종류의 의상갯수 $+ 1$],
[- 모든 종류에 대해 다 곱해줍니다.],
[- 옷을 아무것도 안입는 것은 용납이 안되므로 1을 빼줍니다.]
),
),
// 1B
(
(
[- 우린 각 위치에 도달하는 최소 시간이 궁금하므로 BFS를 이용해 최단거리를 구할 수 있습니다.],
[- $N = 50001, K = 100000$과 같은 인풋을 주의합시다. 과정 중간에 위치가 $100000$이 넘어갈 수 있습니다. 여유롭게 설정합시다.]
),
(
[- BFS],
[1. 처음에 큐에 수빈이의 위치($N$)를 넣어줍시다.],
[2. 큐에서 위치($p$)를 꺼냅니다. ],
[3. $p+1, p-1, p dot 2$를 보면서 만약 방문하지 않았다면 방문 처리를 한 뒤 큐에 넣어줍니다.],
[- 방문 처리는 배열을 만들고 위치를 인덱스로 해서 이동시간을 넣어줍니다.],
),
),
// 1C
(
(
[- 원판이 $x$개 있는 하노이탑은 다음 과정을 거칩니다.],
[- 가장 작은 원판부터 1번이라고 합시다.],
[1. $1~x-1$번 원판을 1번에서 2번 막대로 옮긴다.],
[2. $x$번 원판을 1번에서 3번으로 옮긴다.],
[3. $1~x-1$번 원판을 2번에서 3번으로 옮긴다.],
[- $F(x)$를 원판이 x개인 하노이탑을 다른 막대로 옮기는데 필요한 이동 횟수라고 합시다.],
[- 1,2,3번을 그대로 나타내면 $F(x) = F(x-1) + 1 + F(x-1)$ 이 성립합니다.]
),
(
[- $K$번째 이동이 1, 2, 3번 과정중 어떤 과정에 속하는지가 중요합니다. 과정에 속하지 않는 이동은 의미 없습니다.],
[- $K$번째 이동이 속하는 과정에 대해 재귀적으로 수행합니다.],
[- $cal(O)(log F(N))$ 의 복잡도로 해결 가능합니다.],
),
),
// 1D
(
(
[- 정답이 $A$라면, $A$이상의 공정라인을 가지고 있다면 $X$시간 내에 작업을 끝낼 수 있습니다.],[- $A$미만의 공정라인을 가지고 있다면 $X$시간 내에 작업을 끝낼 수 없습니다,],[- 공정라인이 정해져 있을때 $X$시간 내에 작업을 마칠 수 있는지 없는지 체크하는 것은 우선순위 큐를 이용해 풀 수 있습니다.],[- 따라서 매개변수탐색을 통해 $A$를 찾습니다.]
),
),
// 1E
(
(
[- 왼쪽 방향에 대해서만 생각해봅시다.],[- $0$번째부터 $i$번째 버튼의 색을 같게 만들 때 눌러야 하는 횟수$F(i)$는],
[- $F(i) = F(i-1) + cases(X_(i-1) - X_i "if" X_(i-1) >= X_i, X_(i-1) + C - X_i "else")$],
[- 누적합을 이용해 모든 인덱스에 대해 위 식의 값을 $cal(O)(N)$ 복잡도로 구할 수 있습니다.],
[- 오른쪽 방향에 대해서도 구해준 뒤 최솟값을 구해줍니다. ]
),
),
)
#let isDiv1(problem) = {
return problem.d1.trim().len() != 0
}
#let isDiv2(problem) = {
return problem.d2.trim().len() != 0
}
#let constructTitle(problem, size: 2.5em) = {
let title = "";
if (isDiv2(problem)) {title += "2" + problem.d2}
if (isDiv2(problem) and isDiv1(problem)) {title += "/"}
if (isDiv1(problem)) {title += "1" + problem.d1}
set text(size: size)
text(title, weight: 600, fill:KUPC_GREEN)
text(". " + problem.title, weight: 400, fill:KUPC_GREEN)
}
#let create_page(index) = {
set list(marker: text(fill:KUPC_GREEN)[✓])
for pg in descriptions.at(index) {
[#constructTitle(contest_problems.at(index), size: 2em) #v(5em)]
for desc in pg {
set text(size: 2em)
pad(left: -1.5em)[#desc]
v(0em);
}
pagebreak(weak: true)
}
}
|
|
https://github.com/Otto-AA/definitely-not-tuw-thesis | https://raw.githubusercontent.com/Otto-AA/definitely-not-tuw-thesis/main/src/styles/flex-captions.typ | typst | MIT No Attribution | #let in-outline = state("in-outline", false)
#let flex-caption-styles = rest => {
show outline: it => {
in-outline.update(true)
it
in-outline.update(false)
}
rest
}
#let flex-caption(long, short) = (
context (
if in-outline.get() {
short
} else {
long
}
)
) |
https://github.com/tingerrr/typst-test | https://raw.githubusercontent.com/tingerrr/typst-test/main/.github/ISSUE_TEMPLATE/bug_report.md | markdown | MIT License | ---
name: Bug report
about: Report a bug or incorrect documentation
title: 'BUG: '
labels: 'C-bug'
assignees: ''
---
<!--
Thank you for your report! Please describe your problem here. For questions,
use the Typst community discord: https://discord.gg/2uDybryKPe. Feel free to
remove any of the sections below if they don't seem useful.
-->
## Description
## Steps to Reproduce the Problem
1.
1.
1.
## Expected Behavior
## Actual Behavior
## Context
- Platform:
- Version:
|
https://github.com/L364CY-FM/typst-thesis | https://raw.githubusercontent.com/L364CY-FM/typst-thesis/main/README.md | markdown | MIT License | # typst-template
Dieses Repository enthält eine Vorlage für das Verfassen einer Projektarbeit oder einer Bachelorarbeit. Es kann an spezifische Anforderungen angepasst und erweitert werden.
---
## Installation
- Linux: View [Typst on Repology][repology]
- macOS: `brew install typst`
- Windows: `winget install --id Typst.Typst`
Weitere Infos gibt es unter [Typst][typst-in]
## Nutzung
### Aufbau
- `metadata.typ`: Wichtigen Daten der Arbeit (automatisch eingesetzt)
- `abstract.typ`: Abstract
- `acknowledgement.typ`: Danksagung
- `appendix.typ`: Anhang
- `thesis.typ`: Hauptabschnitt
### Bauen der PDF
Wenn Typst installiert ist:
```sh
# Creates `thesis.pdf` in working directory.
typst compile thesis.typ
# Creates PDF file at the desired path.
typst compile thesis.typ path/to/output.pdf
```
Das bauen nach abspeichern der Datei:
```sh
# Watches source files and recompiles on changes.
typst watch thesis.typ
```
### Typst
Die Dokumentation von [Typst][typst]
[repology]: https://repology.org/project/typst/versions
[typst]: https://typst.app/docs/
[typst-in]: https://github.com/typst/typst
|
https://github.com/rabotaem-incorporated/probability-theory-notes | https://raw.githubusercontent.com/rabotaem-incorporated/probability-theory-notes/master/sections/01-elementary/01-experiment-probability-model.typ | typst | #import "../../utils/core.typ": *
== Вероятностная модель эксперимента
#ticket[Конечное вероятностное пространство. Свойства вероятности. Классическое определение вероятности.]
#def[
$Omega = {omega_1, omega_2, ..., omega_n}$ --- _пространство_ (или _множество_) _элементарных исходов_, причем неформально:
1. $omega_i$ --- несовместны (то есть если элементарные исходы --- грани кубика, то исходы $omega_i$ и $omega_j$ не могут реализоваться одновременно при $i != j$).
2. $omega_j$ --- равновозможны.
3. Один элементраный исход всегда реализуется.
_Случайное событие_ $A$ --- произвольное подмножество в $Omega$.
]
#example[
Если $Omega = {1, 2, ..., 6}$ --- множество граней кубика, и $i$ --- элементраный исход "выпала грань с числом $i$", то событие "выпало четное число" есть ${2, 4, 6}$.
]
#def[
_Вероятность события $P(A)$_:
$
P(A) := (\#A) / (\#Omega).
$
]
#props[
1. $0 <= P(A) <= 1$, причем $P(empty) = 0$, и $P(Omega) = 1$.
2. Если $A sect B = empty$ (говорят, что _события несовместны_), то $P(A union B) = P(A) + P(B)$.
3. $P(A union B) = P(A) + P(B) - P(A sect B)$.
В частности, всегда есть $P(A union B) <= P(A) + P(B)$.
4. _Формула включений-исключений_: $
P(A_1 union A_2 union ... union A_m) &=
sum_(i = 1)^m P(A_i) - \
&- sum_(i < j) P(A_i sect A_j) + \
&+ sum_(i < j < k) P(A_i sect A_j sect A_k) - ... \
... &+ (-1)^(m - 1) P(A_1 sect A_2 sect ... sect A_m). $
5. $P(neg(A)) = 1 - P(A)$, где $neg(A)$ --- отрицание события $A$, то есть $Omega without A$.
]
#proof[
1. Очевидно.
2. Очевидно.
3. $ A union B = A union.sq (B without A) = A union.sq (B without (A sect B)) $
4. По индукции. База есть: при $m = 2$ это свойство 3. Переход $m ~~> m + 1$ доказывается. Вопросы?
5. $1 = P(Omega) = P(A union neg(A)) = P(A) + P(neg(A))$
]
#ticket[Условная вероятность. Мотивировка, определение и свойства. Пример.]
#def[
Пусть $A != nothing$. Вероятность того, что случилось событие $B$ при условии того, что случилось событие $A$ называется _yсловной вероятностью_ события $B$ при условии события $A$, и
$
P(B | A) = (\#(A sect B))/(\#A) = (\#(A sect B)/(\#Omega))/((\#A)/(\#Omega)) = P(A sect B) / P(A).
$
]
#props[
1. $P(A | A) = 1$ и если $B supset A$, то $P(B | A) = 1$.
2. $P(nothing | A) = 0$.
3. Если $B_1 sect B_2 = nothing$, то $P(B_1 | A) + P(B_2 | A) = P(B_1 union B_2 | A)$. В частности, $P(B | A) + P(neg(B) | A) = 1$.
]
#notice[
$P(B | A) + P(B | neg(A))$ не обязательно $1$. Например, в примере с кубиком, если $A = {2, 4, 6}$, а $B = {3, 6}$, то $P(B | A) = 1/3$, и $P(B | neg(A)) = 1/3$. Если взять вместо $B$ событие $neg(B)$, то сумма вероятностей будет больше 1.
]
#ticket[Формула полной вероятности. Формула и теорема Байеса. Примеры.]
#th(name: "формула полной вероятности")[
Пусть $Omega = usb_(k = 1)^m A_k$, где $P(A_k) > 0$. В нашем случае пока $P(A) > 0 <==> A != empty$, но скоро это будет не всегда так. Мы будем пытаться сразу писать правильные формулы.
Тогда
$
P(B) = sum_(k = 1)^m P(B | A_k) dot P(A_k).
$
В частности, $P(B) = P(B | A) P(A) + P(B | neg(A)) P(neg(A))$, если $0 < P(A) < 1$.
]
#proof[
Знаем, что $B = (B sect A_1) union.sq (B sect A_2) union.sq (B sect A_m)$. Тогда
$
P(B) = sum_(k = 1)^m P(B sect A_k) = sum_(k = 1)^m P(B | A_k) dot P(A_k).
$
]
#example[
- I урна: 3 белых шара, и 5 черных шаров.
- II урна: 5 белых и 5 черных шаров.
Из первой урны берем наугад 2 шара, и перекладываем во вторую. Затем перемешиваем шары во второй урне, и вытаскиваем какой-то шар. Какова вероятность того, что он белый?
Воспользуемся формулой полной вероятности. Пусть $B$ --- событие "вытянутый шар белый", $A_k$ --- событие "мы переложили $k$ белых шаров" ($k = 0, 1, 2$). Посчитаем вероятности.
#table(columns: 3, inset: 0.3cm)[
#align(center)[5 белых, 7 черных]
$ P(B | A_0) = 5/12 $
][
#align(center)[6 белых, 6 черных]
$ P(B | A_1) = 1/2 $
][
#align(center)[7 белых, 5 черных]
$ P(B | A_2) = 7/12 $
][
$ P(A_0) = (C_5^2)/(C_8^2) = 5/14 $
][
$
P(A_1) = 1 - P(A_0) - P(A_2) newline(=)
1 - 5/14 - 3/38 = 15/28.
$
][
$ P(A_2) = (C_3^2)/(C_8^2) = 3/28 $
]
Тогда
$
P(B) &= P(B | A_0) P(A_0) + P(B | A_1) P(A_1) + P(B | A_2) P(A_2) =\
&= 5/12 dot 10/28 + 6/12 dot 15/28 + 7/12 dot 3/28 = 23/48.
$
]
#th(name: "<NAME>")[
Пусть $P(A) > 0$ и $P(B) > 0$. Тогда
$
P(B | A) = (P(A | B) P(B)) / P(A).
$
]
#proof[
$
P(B | A) = P(A sect B) / P(A) = P(A sect B) / P(B) dot P(B) / P(A) = P(A | B) P(B) / P(A).
$
]
#example[
Пусть у нас ковид. $A$ --- событие "тест положительный". $B$ --- событие "человек болен". Пусть $P(B) = 10^(-3)$ (вероятность того, что человек болен), $P(A | neg(B)) = 10^(-1)$ (вероятность того, что тесь оказался положительным, хотя человек не болен, то есть false positive), и $P(A) = 1/10$ (эмпирическая доля положительных тестов).
]
#exercise[
Найти $P(B | A)$ (вероятность того, что человек с положительным тестом и правда болен).
Решение: $P(B | A) = 1 - P(neg(B) | A) = 1 - (P(A | neg(B)) P(neg(B)))/P(A) = 1 - (10^(-1)(1 - 10^(-3)))/10^(-1) = 10^(-3)$
]
#th(name: "<NAME>")[
Пусть $P(A_k) > 0$, $P(B) > 0$ и $Omega = usb_(k = 1)^m A_k$. Тогда
$
P(A_k | B) = (P(B | A_k) P(A_k)) / (sum_(j = 1)^m P(B | A_j) P(A_j)).
$
]
#proof[
Первый переход --- просто формула Байеса, а второй --- формула полной вероятности:
$
P(A_k | B) = (P(B | A_k) P(A_k))/(P(B)) = (P(B | A_k) P(A_k)) / (sum_(j = 1)^m P(B | A_j) P(A_j)).
$
]
#notice[
В частности,
$
P(A | B) = (P(B | A) P(A)) / (P(B | A) P(A) + P(B | neg(A)) P(neg(A))),
$
если $0 < P(A) < 1$, и $P(B) > 0$.
]
#example[
Пусть есть 2 монеты: одна симметричная, а вторая кривая, и $P("орел") = 2/3$, а $P("решка") = 1/3$. Пусть мы взяли случайную монету, и выпал орел. Какова вероятность того, что монета кривая?
Пусть $A_1$ --- кинули первую монетку, $A_2$ --- кинули вторую, $B$ --- выпал орел. Тогда
$
P(A_2 | B) = (P(B | A_2) P(A_2)) / (P(B | A_1) P(A_1) + P(B | A_2) P(A_2)) = 4/7.
$
]
#ticket[Независимые события. Мотивировка и определение. Примеры.\ Попарная независимость и независимость в совокупности. Примеры.]
#def[
Событие $A$ _не зависит_ от события $B$ (где $P(B) > 0$), если
$
P(A) = P(A | B) = P(A sect B)/P(B).
$
Если домножить на знаменатель, исчезнет проблема с делением на $0$, да и формула станет симметричнее, поэтому так определение составляют редко.
]
#def[
События $A$ и $B$ _независимы_, если $P(A sect B) = P(A) P(B)$.
]
#def[
$A_1, A_2, ..., A_m$ _независимы в совокупности_, если для любых различных индексов $i_1$, $i_2$, ..., $i_k$
$
P(A_(i_1) sect A_(i_2) sect ... sect A_(i_k)) = P(A_(i_1)) P(A_(i_2)) ... P(A_(i_k)).
$
]
#notice[
Независимость попарная не влечет независимость в совокупности. Например, если есть два кубика, и $A$ --- на первом четное число, $B$ --- на втором четное число, и $C$ --- сумма четная, то эти события попарно независимы, но независимости в совокупности нет:
$
P(A) = P(B) = P(C) = 1/2,
$
а следующие события --- вообще одно и то же:
$
A sect B = A sect C = B sect C = A sect B sect C,\
$
Тогда
$
P(A sect B) = 1/4 = P(A) P(B), ...
$
Все события попарно независмы, но $P(A sect B sect C) != P(A) P(B) P(C) = 1/8$.
]
#exercise[
Доказать, что $A_1$, ..., $A_m$ независимы в совокупности тогда и только тогда, когда
$
P(B_1 sect B_2 sect ... sect B_m) = P(B_1) P(B_2) ... P(B_m),
$
где $B_j = A_j "или" neg(A_j)$.
]
#line(length: 100%)
Теперь будем говорить о модели, в которой элементарные исходы не равновероятны.
#def[
Небольшое обобщение модели.
Пусть $Omega = {omega_1, omega_2, ..., omega_n}$, и имеются $p_1, p_2, ..., p_n >= 0$, причем $p_1 + p_2 + ... + p_n = 1$.
$A subset Omega$ --- событие, и
$
P(A) := sum_(omega_i in A) p_i.
$
Если $A sect B = empty$, то $P(A union B) = P(A) + P(B)$. Остальные свойства тоже есть, потому что мы аккуратно выводили их из этого.
]
#ticket[Схема Бернулли. Полиномиальная схема. Теорема Эрдёша–Мозера.]
#def[
Пусть $omega = (x_1, x_2, ..., x_n)$, где $x_n in {0, 1}$. $Omega = {omega : omega = (x_1, x_2, ..., x_n)}$. $\#Omega = 2^n$. Пусть $p in (0, 1)$. Положим
$
P(omega) := p^(x_1 + x_2 + ... + x_n) (1 - p)^(n - x_1 - x_2 - ... - x_n) = p^(\#{i: x_i = 1}) (1 - p)^(\#{i: x_i = 0}).
$
Такая модель называется _схемой Бернулли_.
Можно думать об этом так: мы $n$ раз подбрасываем нечестную монетку (считаем орел успехом, или $1$, и решку неудачей, то есть $0$), причем так, что все броски независимы в совокупности.
В модели независимость получается из того, как мы определили вероятность элементарных исходов. Проверим по упражнению:
$
P(B_1 sect B_2 sect ... sect B_n) = P(B_1) P(B_2) ... P(B_n),
$
где $P(B_i) = p$ если на $i$-м броске выпал орел, и $P(B_i) = 1 - p$ если на $i$-м броске выпала решка. Тогда вероятность $B_1 sect ... sect B_n$ равна $p^(\#{i: x_i = 1}) (1 - p)^(\#{i: x_i = 0})$, что и есть $P(B_1) P(B_2) ... P(B_n)$.
В такой модели вероятность события "в серии из $n$ испытаний ровно $k$ успехов" равна $C_n^k p^k (1 - p)^(n - k)$.
]
#def[
Пусть $omega = (x_1, x_2, ..., x_n)$ где $x_i in {1, 2, ..., m}$. Имеются $p_1 + p_2 + ... + p_m = 1$, где $p_i >= 0$. $Omega = {omega : omega = (x_1, x_2, ..., x_n)}$. $\#Omega = m^n$. Положим
$
P(omega) := p_1^(\#{i: x_i = 1}) p_2^(\#{i: x_i = 2}) ... p_m^(\#{i: x_i = m}).
$
Такая модель называется _полиномиальной схемой_. Это тоже серия из $n$ независимых испытаний, но исходов теперь $m$ на каждом, а не $2$.
В такой модели вероятность события "в серии из $n$ испытаний ровно $k_1$ исходов $1$, $k_2$ исходов $2$, ..., $k_m$ исходов $m$" равна $binom(n, k_1, k_2, ..., k_m) p_1^k_1 p_2^k_2 ... p_m^k_m$.
]
#th(name: "Эрдеша-Мозера")[
Имеется $n$ волейбольных команд, и каждая команда играет с каждой ровно один раз. Пусть $k$ --- наибольшее число, для которого заведомо найдутся команды $A_1, A_2, ..., A_k$ такие, что $A_i$ выиграла у $A_j$ тогда и только тогда, когда $i < j$. Тогда $k <= 1 + floor(2 log_2 n)$.
]
#proof[
Рассмотрим случайный турнир, то есть проведем схему Бернулли с вероятностью успеха $1/2$ для $C_n^2$ матчей. Тогда
$
P(A "выиграла у" B) &= 1/2,\
P(A_1, A_2, ..., A_k "подходят") &= (1/2)^(C_k^2),\
P("Какие-то" k "команд подходят") &<= sum_(A_1, ..., A_k) P(A_1,...,A_k "подходят") = C_n^k dot k! dot (1/2)^(C_k^2).
$
Предположим, что $k >= 2 + floor(2 log_2 n)$. Тогда
$
C_n^k dot k! dot (1/2)^(C_k^2) = n dot (n - 1) dot ... (n - k + 1) dot (1/2)^((k (k - 1))/2) < n^k dot (1/2)^((k(k-1))/2) = (n dot (1/2)^((k - 1)/2))^k.
$
Но мы знаем, что $(k-1)/2 > log_2 n$, значит $2^((k - 1)/2) > n$ и в скобках стоит число меньше $1$. Имеем
$
P("Какие-то" k "команд подходят") < 1.
$
Значит вероятность того, что никакие $k$ команд не подходят, положительна, а значит найдется турнир, в котором $k$ команд не подходят. Что и требовалось доказать.
]
|
|
https://github.com/kalxd/morelull | https://raw.githubusercontent.com/kalxd/morelull/master/morelull.typ | typst | #import "@preview/a2c-nums:0.0.1": int-to-cn-simple-num
#let 颜色 = (
靛青: rgb(22, 97, 171),
海青: rgb(34, 162, 195),
蟹壳红: rgb(242, 118, 53),
品红: rgb(239, 52, 115),
清水蓝: rgb(147, 213, 220),
翠蓝: rgb(30, 158, 179),
孔雀蓝: rgb(14, 176, 201),
霁青: rgb(99, 187, 208)
)
#let 字体 = (
中文: "FZJuZhenXinFang-R-JF",
英文: "FiraCode Nerd Font Mono"
)
#let t = h(2em)
#let morelull(
标题: "标题",
作者: "荀洪道",
doc
) = {
let 设定标题(标题) = {
text(size: 2.6em)[
#sym.notes.down #标题 #sym.notes.up
]
}
let 设定作者(作者) = {
text(size: 1.4em, 作者)
}
let 显示中文日期(today) = {
let year = int-to-cn-simple-num(today.year());
let month = int-to-cn-simple-num(today.month());
let day = int-to-cn-simple-num(today.day());
year + "年" + month + "月" + day + "日"
}
let 设定眉头(loc) = {
set text(颜色.靛青)
let current-page = loc.page();
if current-page == 1 {
return none
}
current-page = current-page - 1;
let current-page = int-to-cn-simple-num(current-page)
let title-page = "第" + current-page + "页"
let last-header = query(heading.where(level: 1), loc)
.rev()
.find(h => h.location().page() <= loc.page());
let header-title = if not last-header == none {
last-header.body
}
header-title + h(1fr) + title-page
v(-.4em)
line(length: 100%, stroke: 颜色.靛青)
}
// 整体版面
set page(
paper: "a4",
margin: 4em,
header: locate(设定眉头)
)
set text(font: 字体.中文, fallback: true, lang: "zh")
// 封面
align(center + horizon)[
#设定标题(标题)
#v(1em)
#设定作者(作者)
#显示中文日期(datetime.today())
]
// 标题
show heading: set text(颜色.靛青)
show heading.where(level: 1): set align(center)
// 代码块
show raw.where(block: true): it => {
box(
stroke: 颜色.靛青,
inset: 1em,
width: 100%,
text(font: (字体.英文, 字体.中文), it)
)
}
// 内联代码
show raw.where(block: false): it => {
text(
font: 字体.英文,
fill: 颜色.靛青,
it
)
}
// 专名号
set underline(offset: 4pt)
// 行高
set par(leading: 1em)
show par: set block(below: 1em)
// 链接
show link: set text(fill: 颜色.品红)
// 表格居中
show table: it => align(center, it)
pagebreak()
doc
}
|
|
https://github.com/chamik/gympl-skripta | https://raw.githubusercontent.com/chamik/gympl-skripta/main/cj-dila/2-havran.typ | typst | Creative Commons Attribution Share Alike 4.0 International | #import "/helper.typ": dilo, poezie
#dilo("Havran", "havran", "<NAME>", "<NAME>", "1. p. 19. st; světový romantismus", "USA", "1845", "lyricko-epický", "baladická báseň")
#columns(2, gutter: 1em)[
*Téma*\
přemítání nad mrtvou láskou Autora
*Motivy*\
tajemno, žal nad ztrátou
*Časoprostor*\
prosincový večer, pokoj Autora
*Postavy* \
_Autor_ -- vypravěč, smutný že ztráty své lásky \
_Havran_ -- symbol zla/smrti \
Lenora - mrtvá milenka Autora
*Kompozice*\
chronologická; na začátku retrospektivní; 18 slok
*Vypravěč*\
ich-forma (souvisí s životem Poa)
*Jazykové prostředky*\
symbolika, refrén "nevermore"#footnote[Nezvalův překlad "víc#[]*krá*#[]t ne" zní jako havran! Překlad od _J. Vrchlického_ má "nikdy víc", což mě osobně přijde libozvučnější. Překladů jinak existují desítky.], přirovnání, personifikace, přímá řeč, gradace, volný verš (pro romantismus typický), skoro žádné tropy (významové básnické prostředky), epifory a anafory, asonance, aliterace
trochej:\
"*Zdá*#[]lo *se*#[], že *u*#[] stí#[]*ni*#[]dla *hou*#[]stne *svě*#[]tlo *od*#[] ka#[]*di*#[]dla"
V originále rým A B C B B B (s tím že A i C mají vnitřní rým, šestý verš je poloviční)
#colbreak()
*Obsah*\
Autor prosincový večer o půlnoci studuje své knihy, ale nemůže se soustředit, protože stále myslí na svoji mrtvou lásku, Lenoru. Do pokoje mu vletí Havran. Nejdřív vypravěče rozesměje, záhy ho začne iritovat. Pokládá otázky ptákovi, kterými sám sebe trýzní (protože odpověď na ně je "ne"). Autor se havrana snaží vyhnat, ale nedaří se mu to. Havran zůstává i v "autorově srdci" (symbol nekonečného trápení).
*Literárně historický kontext*\
Pozdní tvorba, velmi dobře přijata; ovšem moc na tom nevydělal. V době psaní mu umírala manželka. Později vydal text, kde popisoval své záměry a myšlenky o tomto díle. Jedná se o jednu z nejslavnějších amerických básní. Do teď se objevuje v populární kultuře.
]
#pagebreak()
#show: poezie
*Ukázka*
[...]
Zdálo se, že u stínidla houstne světlo od kadidla, \
že se bezpochyby anděl v zvoncích z nebe propadne. \
„Chudáku, tvůj Bůh ti v zpěvu posílá sem pro úlevu \
balzám na tvou starou něhu, po němž navždy vychladne, \
po němž láska k Lenoře v tvé mysli navždy zapadne“ – \
Však havran děl: „Už víckrát ne.“
„Proroku,“ dím, „mene tekel#footnote["<NAME>" jsou první dvě slova údajného tajemného varování biblického krále Belsazara (Belšasara). Přeneseně označuje naléhavé varování, výstrahu.], ať jsi pták a nebo z pekel, \
synu podsvětí, a přece proroku, pojď hádat mně – \
statečně, byť opuštěný, žiji zaklet v této zemi, \
dům mám hrůzou obklíčený, zda tvá věštba uhádne, \
zdali najdu balzám v smrti, zda tvá věštba uhádne“ – \
Havran dí: „Už víckrát ne.“
„Proroku,“ dím, „<NAME>, ať jsi pták a nebo z pekel, \
při nebi, jež nad námi je, při Bohu, jenž láká mne, \
rci té duši, jež žal tají, zdali aspoň jednou v ráji \
tu, již svatí nazývají Lenora, kdy přivine, \
jasnou dívku Lenoru kdy v náručí své přivine“ – \
Havran dí: „Už víckrát ne“
„Tos řek jistě na znamení, že se chystáš k rozloučení, \
táhni zpátky do bouře a do podsvětí, satane! - \
nenech mi tu, starý lháři, ani pírka na polštáři, \
neruš pokoj mého stáří, opusť sochu, havrane! \
Vyndej zobák z mého srdce, opusť sochu, havrane!“ \
Havran dí: „Už víckrát ne.“
Pak se klidně ulebedí, stále sedí, stále sedí \
jako ďábel na bělostných ňadrech Pallas Athéné#footnote[V řecké mytologii dcera nejvyššího boha Dia. Jde o bohyni moudrosti, války a strategie, ochránkyni statečnosti, práva, spravedlnosti a umění.]; \
oči v sněni přimhouřeny na pozadí bílé stěny, \
lampa vrhá beze změny jeho stín, jímž uhrane - \
a má duše z toho stínu, jímž mne navždy uhrane, \
nevzchopí se - víckrát ne."
#pagebreak() |
https://github.com/weeebdev/cv | https://raw.githubusercontent.com/weeebdev/cv/main/modules/certificates.typ | typst | Apache License 2.0 | #import "../brilliant-CV/template.typ": *
#cvSection("Certificates")
#cvHonor(
date: [Apr 2021],
title: [CCNA: Introduction to Networks],
issuer: [Cisco],
)
#cvHonor(
date: [Mar 2021],
title: [GitLab 101 Certification],
issuer: [GitLab]
)
#cvHonor(
date: [Feb 2021],
title: [Introduction to R],
issuer: [DataCamp]
)
#cvHonor(
date: [Feb 2021],
title: [Python Fundamentals Track],
issuer: [DataCamp]
)
#cvHonor(
date: [Dec 2020],
title: [Introduction to Imagemaking],
issuer: [Coursera]
)
#cvHonor(
date: [Dec 2020],
title: [JavaScript (Basic)],
issuer: [HackerRank]
)
#cvHonor(
date: [Sep 2020],
title: [Problem Solving (Basic)],
issuer: [HackerRank]
)
#cvHonor(
date: [Sep 2020],
title: [Python (Basic)],
issuer: [HackerRank]
)
#cvHonor(
date: [Sep 2020],
title: [SQL (Basic)],
issuer: [HackerRank]
)
#cvHonor(
date: [Aug 2020],
title: [Frontend (WEB)],
issuer: [IT- компания ONE Technologies]
)
#cvHonor(
date: [Aug 2020],
title: [Information Security Incident Handling],
issuer: [IT Masters (Charles Sturt University)]
)
#cvHonor(
date: [Aug 2020],
title: [Pen Testing],
issuer: [IT Masters (Charles Sturt University)]
)
#cvHonor(
date: [Apr 2020],
title: [Математика и Python для анализа данных],
issuer: [Coursera]
)
#cvHonor(
date: [Dec 2020],
title: [HCIA WLAN],
issuer: [Huawei]
)
|
https://github.com/Kasci/LiturgicalBooks | https://raw.githubusercontent.com/Kasci/LiturgicalBooks/master/_general/akatistnik.typ | typst | #import "/style.typ": *
#let bg = {
rect(width: 95%, height: 95%, inset: 10pt, radius: 5pt, stroke: (paint: primary, thickness: 2pt),
rect(width: 100%, height: 100%, outset: 0pt, radius: 5pt, stroke: (paint: primary, thickness: 2pt))
)
}
#let project(body) = {
set page(paper:"a5", numbering: "1", number-align: center, margin: (x: 35pt, top: 40pt, bottom: 55pt), background: bg)
set text(font: "Monomakh Unicode", lang: "cu")
// HEADINGS
show heading.where(level: 1): it => [
#align(center, text(0pt, rgb("ffffff"), upper(it)))
]
show heading.where(level: 2): it => [
#align(center, text(0pt, rgb("ffffff"), it))
]
show heading.where(level: 3): it => [
#align(center, text(0pt, rgb("ffffff"), it))
]
// Main body.
set par(justify: true)
body
}
#show: project
#include "/SK/akatisty/akatistJezisKristus.typ"
#pagebreak()
#include "/SK/akatisty/akatistBohorodicka.typ"
#include "/SK/akatisty/akatistMikulas.typ"
#include "/SK/akatisty/akatistMichalABeztelesni.typ"
#include "/RT/akatisty/akatistGojdic.typ" |
|
https://github.com/jgm/typst-hs | https://raw.githubusercontent.com/jgm/typst-hs/main/test/typ/compiler/ops-06.typ | typst | Other | // Error: 2-8 invalid hexadecimal number: 0x123z
#0x123z
|
https://github.com/OverflowCat/BUAA-Automatic-Control-Components-Sp2024 | https://raw.githubusercontent.com/OverflowCat/BUAA-Automatic-Control-Components-Sp2024/neko/实验/4.typ | typst | #set text(lang: "zh", font: "Noto Serif CJK SC")
#show "。": "."
= 实验四
== 1. 直流⽆刷电机的启动与停⽌、⽅向控制等操作设置实验
#figure(
caption: [电机状态表],
align(center)[#table(
columns: 4,
align: (auto, auto, auto, auto),
table.header([S2], [S3], [S1], [电机状态]),
table.hline(),
[禁止], [X], [X], [不转],
[X], [刹车], [X], [不转],
[使能], [运行], [正转], [正转,799.8],
[使能], [运行], [反转], [反转,783.8],
)],
)
== 2. 直流⽆刷电机外接模拟信号源实现的模拟调速实验
#figure(
caption: "直流刷电机外接模拟信号源实现的模拟调速实验",
align(center)[#table(
columns: (1fr, 1fr, 1fr, 11%, 11%, 11%, 11%, 11%, 11%),
table.header([S2], [S3], [S1], [0.5 V], [1 V], [2 V], [3 V], [4 V], [5 V]),
[使能], [运行], [正转], [198.8], [801.5], [1948], [2940], [3697], [3797],
[使能], [运行], [反转], [196.7], [786.2], [1907], [2897], [3718], [3885],
)],
)
== 3. 直流⽆刷电机 PWM 控制调速实验
#figure(
table(
columns: 10,
table.header([S2], [S3], [S1], [20%], [30%], [40%], [50%], [60%], [70%], [80%]),
[使能], [运行], [正转], [983.6], [1427], [1853], [2258], [2649], [3822], [3360],
[使能], [运行], [反转], [964.8], [1396], [1812], [2211], [2597], [2967], [3321],
),
)
== 4. 直流⽆刷电机开环与闭环控制参数测试实验
#figure(
table(
columns: (auto, auto, auto, auto, auto, auto, auto, auto, auto),
table.header([S2], [S3], [S1], [SW7], [0Nm], [0.05N·m], [0.1N·m], [0.15N·m], [0.2N·m]),
[使能], [运行], [正转], [OFF], [498.3], [501.3], [503.1], [505.6], [506.1],
[使能], [运行], [反转], [OFF], [506.5], [507.6], [507.2], [507.6], [508.8],
[使能], [运行], [正转], [ON], [528.1], [520.3], [509.7], [498.4], [486.8],
[使能], [运行], [反转], [ON], [507.5], [512.6], [504.3], [495.2], [482.5],
),
)
== 思考题
=== 1. 引起直流无刷电机电磁转矩波动的原因是什么?
当直流无刷电机定子铁心有齿槽时,由于定子齿糟的存在,气隙不均匀,使气隙磁导不是常数,转子位置引起转矩波动。
// 齿槽转矩是永磁电机的固有特性,在电机低速轻载运行时,齿槽转矩将引起明显的转速波动,并产生振动和噪声。
=== 2. 方向信号是如何影响直流无刷电机换相逻辑的?
方向信号决定了电机转动的方向,进而影响换相逻辑。直流无刷电机通过霍尔传感器检测转子位置,并根据转子位置和方向信号来决定何时切换定子绕组的通电方向。当方向信号改变时,换相逻辑会相应调整,使得定子绕组的电流反向,从而改变电机转动的方向。
=== 3. 尝试修改仿真模型,获得某一转速下 360°电角度周期内,转子位置信号、感应电动势、定子绕组电流以及换相信号的波形,并分析直流无刷电动机如何获得电动电磁转矩和制动电磁转矩。
=== 4. 直流无刷电机有几种换向方式?在本次实验中采用了哪种?
直流无刷电机用电子换向装置代替机械换向装置,有以下几种换向方式:
+ 改接位置传感器的输出电压信号
+ 改变电枢电流方向
在本次实验中采用的是控制⽅向控制端⼝ F/R 的信号,即改变位置传感器的输出电压信号。
==== 5. 结合实验对比分析闭环和开环的优缺点。
- #strong[开环控制];:
- #strong[优点]:系统结构简单,控制策略易于实现。
- #strong[缺点]:缺乏反馈机制,不能自动调节,容易受到外部扰动影响。
- #strong[闭环控制];:
- #strong[优点]:具有反馈机制,可以自动调节,控制精度高,抗扰动能力强。
- #strong[缺点]:系统结构复杂,控制策略实现难度较大,需要更多的传感器和控制器件。
|
|
https://github.com/NycRat/arduino-workshop | https://raw.githubusercontent.com/NycRat/arduino-workshop/main/qr.typ | typst | #import "@preview/cades:0.3.0": qr-code
#set text(font: "IBM Plex Mono")
#set page("us-letter")
#align(center + horizon)[
#qr-code("https://bit.ly/arduino-odyssey", width: 60%)
https://bit.ly/arduino-odyssey
]
|
|
https://github.com/JacentyI1/Interpersonal-Communication | https://raw.githubusercontent.com/JacentyI1/Interpersonal-Communication/main/Team_project_framework.typ | typst | The Unlicense | #set page(paper: "a4", margin: (x: 1cm, y: 1cm))
#grid(
columns: 3,
[#pad(x: 10pt, image("./assets/PP_znak_pełny_CMYK.svg", height: 90pt))],
[
#set text(
font: "SquareSlab711MdEU",
size: 14pt,
fill: rgb("#006288")
)
#set par(leading: 0.5em)
#line(length: 100%, stroke: rgb("#006288"))
#v(0.7em, weak: true)
*POZNAN UNIVERSITY OF TECHNOLOGY*
#v(0.7em, weak: true)
#line(length: 100%, stroke: rgb("#006288"))
#set text(font: "Liberation Sans", size: 9pt, stretch: 75%)
CENTRE OF LANGUAGES AND COMMUNICATION\
3A Piotrowo St., 60-965 Poznan, phone: + 61 665 24 91\
e-mail: #link("<EMAIL>"), #link("www.clc.put.poznan.pl")
],
[#pad(x: 10pt, image("./assets/CJK_logo.png", width: 150pt))]
)
#set text(font: "Liberation Sans", size: 12pt)
#show heading: set block(above: 1.4em, below: 2em)
#show par: set block(spacing: 2em)
#align(center)[
= TEAM PROJECT FRAMEWORK
]
*Group work recommended*
*Form*: oral presentation in teams\
(all team members present his/her part individually being a link in the chain)
*Time of presentation*: depending on the number of students in the group
*Topic*: Trends and challenges for interpersonal communication in the next decade.
*Possible aspects to consider*:
- ASPECT 1
- ASPECT 2
- ASPECT 3
- ASPECT 4
- ASPECT 5
- ASPECT 6
*Team members* (recommended up to 5 students in a group):
1. <NAME>,
2. <NAME>,
3. <NAME>,
4. <NAME>.
5. #strike[Boris Johnson]
*Date of team project presentation*: 10.04.2024
*Abstract* (250-300 words - to be delivered in advance) - the aim of the project and discussed aspects:
INSERT ABSTRACT HERE
*Results based on (questionnaire, professional literature, references)*:
INSERT RESULTS HERE
*Glossary*: |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.