repo
stringlengths
26
115
file
stringlengths
54
212
language
stringclasses
2 values
license
stringclasses
16 values
content
stringlengths
19
1.07M
https://github.com/typst-doc-cn/tutorial
https://raw.githubusercontent.com/typst-doc-cn/tutorial/main/src/basic/reference-type-builtin.typ
typst
Apache License 2.0
#import "mod.typ": * #show: book.ref-page.with(title: [参考:内置类型]) == 空类型 <reference-type-none> == type <reference-type-type> == content <reference-type-content> == function <reference-type-function> == arguments <reference-type-arguments> == module <reference-type-module> == plugin <reference-type-plugin> == regex <reference-type-regex> == label <reference-type-label> == reference <reference-type-reference> == selector <reference-type-selector> == version <reference-type-version>
https://github.com/benjamineeckh/kul-typst-template
https://raw.githubusercontent.com/benjamineeckh/kul-typst-template/main/src/core/component/copyright.typ
typst
MIT License
#let insert-copyright(copyright, lang:"nl") = { // set par(justify: true, first-line-indent: 1em, leading: 0.5em) // Copyright { set align(left + bottom) set page(numbering: none) par(first-line-indent: 0pt)[ #if lang == "en"{ text(size: 1em, )[#copyright.at(lang)] }else{ text(size: 1em, )[#copyright.at("en")] v(1.5em) text(size: 1em, )[#copyright.at(lang)] } ] v(7%) } pagebreak(weak: true) }
https://github.com/glocq/typst-forthright-cv
https://raw.githubusercontent.com/glocq/typst-forthright-cv/master/README.md
markdown
MIT License
# Forthright Typst CV template This is a Typst CV template visually based on the [Neat CV template](https://github.com/UntimelyCreation/typst-neat-cv), but completely rewritten with the aim of being tweak-friendly: - Many parameters can be fine-tuned by editing the `settings.typ` file in the `src` subdirectory. This can be handy if you need a little bit more room to make everything fit in one page 😇 - The template itself, `src/template.typ`, is fairly short and reasonably well-commented. A demo can be found [here](https://github.com/glocq/typst-forthright-cv/blob/master/output/cv.pdf). ## Usage You need [the Typst compiler](https://github.com/typst/typst/releases/tag/v0.10.0) installed. On MacOS/Linux, navigate to this directory and compile the document by executing the following command: ```bash typst compile src/cv.typ output/cv.pdf --font-path src/fonts/ ``` `cv.pdf` should then appear in `output/`. To have Typst recompile your document each time you edit something, replace the word `compile` in the above command by `watch`. ## License Distributed under the MIT License.
https://github.com/thanhdxuan/dacn-report
https://raw.githubusercontent.com/thanhdxuan/dacn-report/master/report-week-5/contents/04-system-requirements.typ
typst
= Xác định yêu cầu == Yêu cầu chức năng #let func_req = ( G01: ( id: "G01", feature: "Login", des: "User đăng nhập tài khoản vào hệ thống và được cấp tài nguyên theo vai trò. Ngoài ra còn có chức năng giúp người dùng đặt lại mật khẩu khi quên." ), G02: ( id: "G02", feature: "Logout", des: "Đăng xuất tài khoản khỏi hệ thống." ), G03: ( id: "G03", feature: "Manage profile", des: "Người dùng có thể xem/sửa các thông tin cơ bản của tài khoản như tên, email, ảnh đại diện, ..." ), AL01: ( id: "AL01", feature: "Create new loan", des: "Admin có thể tạo mới đơn vay, bằng cách nhập các thông tin của ứng viên/hồ sơ theo form có sẵn, ứng với các biến trong mô hình dự đoán. Hoặc import dữ liệu từ file csv, json, ..." ), AL03: ( id: "AL03", feature: "View loan detail", des: "Admin có thể xem thông tin chi tiết của các đơn vay đã tạo." ), AL04: ( id: "AL04", feature: "Choose model", des: "Admin có thể chọn mô hình dự đoán cho mỗi một đơn vay, các mô hình dự đoán có thể có như: Hồi quy logistic, Random forest, ..." ), AL05: ( id: "AL05", feature: "View processed loan", des: "Admin có thể xem lại các đơn hàng mình đã xử lý trong quá khứ. Các thông tin hiển thị bao gồm trạng thái (Accepted/Rejected), thời gian xử lý, kết quả dự đoán của mô hình." ), AL06: ( id: "AL06", feature: "Filter loan", des: "Admin có thể tìm, lọc các đơn dựa trên các tiêu chí khác nhau như: đã xử lý, chưa xử lý, model dự đoán, ..." ), AL07: ( id: "AL07", feature: "Manage loan", des: "Admin có thể xoá/sửa các thông tin của các đơn vay chưa được xử lý như chỉnh sửa thông tin của các biến, chỉnh sửa mô hình dự đoán." ), S01: ( id: "S01", feature: "Notification", des: "Hệ thống xử lý, hiển thị thông báo mới hoặc gửi email/sms cho người dùng mỗi khi có cập nhật về đơn vay hoặc các cập nhật khác." ), S02: ( id: "S02", feature: "Model selection", des: "Hệ thống phải có ít nhất 2 mô hình dự đoán cho người dùng lựa chọn." ) ) #let nonfunc_req = ( SE01: ( id: "SE01", feature: "Strong password", des: "Mật khẩu của mỗi tài khoản được yêu cầu phải ít nhất 8 ký tự, bao gồm chữ cái in hoa và in thường, số và ký tự đặc biệt." ), SE02: ( id: "SE02", feature: "Auto block", des: "Trong trường hợp người dùng đăng nhập thất bại 5 lần liên tiếp, hệ thống sẽ tự động khoá tài khoản, để mở khoá tài khoản, người dùng cần liên hệ với quản trị viên." ), SE03: ( id: "SE03", feature: "Secure website", des: "Trang web sử dụng một số giao thức bảo mật trên mạng như TSL, SSL, JWT (Json Web Token) để bảo mật cho website." ), ES01: ( id: "ES01", feature: "Provide clear interface", des: "Giao diện đẹp, rõ ràng, đảm bảo người dùng có thể tập trung vào những thông tin quan trọng, làm nổi bật những chỉ số, thông tin quan trọng bằng cách hightlight, ..." ), ES02: ( id: "ES02", feature: "Support multi platform", des: "Trang web hỗ trợ giao diện responsive (tự động thay đổi các thông số về giao diện để phù hợp với kích thước màn hình) và đảm bảo tương thích trên nhiều hệ điều hành (iOS, Android, ...), trình duyệt khác nhau (Firefox, Chrome, MS Edge, ...)" ), ES03: ( id: "ES03", feature: "Support multi language", des: "Trang web hỗ trợ 2 ngôn ngữ: tiếng Anh và tiếng Việt" ), ES04: ( id: "ES04", feature: "Provide clear feature", des: "Trang web cung cấp các tính năng đơn giản, dễ thao tác, đảm bảo người dùng có thể thực hiện thành thạo sau 1 lần hướng dẫn" ), PE01: ( id: "PE01", feature: "", des: "Các tác vụ xử lý dữ liệu (tính toán, dự đoán) yêu cầu trả kết quả trong vòng không quá 1 giây." ), RE01: ( id: "RE01", feature: "Auditing", des: "Hệ thống ghi lại logs khi có sự thay đổi tác động lên hệ thống hằng ngày." ) ) *YÊU CẦU CHUNG* #table( columns: (0.5fr, 1fr, 3fr), inset: 10pt, align: horizon, [*ID*], [*Feature*], [*Description*], func_req.G01.id, func_req.G01.feature, func_req.G01.des, func_req.G02.id, func_req.G02.feature, func_req.G02.des, func_req.G03.id, func_req.G03.feature, func_req.G03.des, ) *HỆ THỐNG* #table( columns: (0.5fr, 1fr, 3fr), inset: 10pt, align: horizon, [*ID*], [*Feature*], [*Description*], func_req.S01.id, func_req.S01.feature, func_req.S01.des, func_req.S02.id, func_req.S02.feature, func_req.S02.des ) *DỰ ĐOÁN ĐƠN VAY* #table( columns: (0.5fr, 1fr, 3fr), inset: 10pt, align: horizon, [*ID*], [*Feature*], [*Description*], func_req.AL01.id, func_req.AL01.feature, func_req.AL01.des, func_req.AL03.id, func_req.AL03.feature, func_req.AL03.des, func_req.AL04.id, func_req.AL04.feature, func_req.AL04.des, func_req.AL05.id, func_req.AL05.feature, func_req.AL05.des, func_req.AL06.id, func_req.AL06.feature, func_req.AL06.des, func_req.AL07.id, func_req.AL07.feature, func_req.AL07.des ) == Yêu cầu phi chức năng *HIỆU SUẤT* #table( columns: (0.5fr, 1fr, 3fr), inset: 10pt, align: horizon, [*ID*], [*Feature*], [*Description*], nonfunc_req.PE01.id, nonfunc_req.PE01.feature, nonfunc_req.PE01.des, ) *TÍNH TIN CẬY* #table( columns: (0.5fr, 1fr, 3fr), inset: 10pt, align: horizon, [*ID*], [*Feature*], [*Description*], nonfunc_req.RE01.id, nonfunc_req.RE01.feature, nonfunc_req.RE01.des, ) *THÂN THIỆN VỚI NGƯỜI DÙNG* #table( columns: (0.5fr, 1fr, 3fr), inset: 10pt, align: horizon, [*ID*], [*Feature*], [*Description*], nonfunc_req.ES01.id, nonfunc_req.ES01.feature, nonfunc_req.ES01.des, nonfunc_req.ES02.id, nonfunc_req.ES02.feature, nonfunc_req.ES02.des, nonfunc_req.ES03.id, nonfunc_req.ES03.feature, nonfunc_req.ES03.des, nonfunc_req.ES04.id, nonfunc_req.ES04.feature, nonfunc_req.ES04.des ) *BẢO MẬT* #table( columns: (0.5fr, 1fr, 3fr), inset: 10pt, align: horizon, [*ID*], [*Feature*], [*Description*], nonfunc_req.SE01.id, nonfunc_req.SE01.feature, nonfunc_req.SE01.des, nonfunc_req.SE02.id, nonfunc_req.SE02.feature, nonfunc_req.SE02.des, nonfunc_req.SE03.id, nonfunc_req.SE03.feature, nonfunc_req.SE03.des ) #pagebreak()
https://github.com/pluttan/asmlearning
https://raw.githubusercontent.com/pluttan/asmlearning/master/lab3/lab3.typ
typst
#import "@docs/bmstu:1.0.0":* #show: student_work.with( caf_name: "Компьютерные системы и сети", faculty_name: "Информатика и системы управления", work_type: "лабораторной работе", work_num: "3", discipline_name: "Программирование ветвлений и итерационных циклов ", theme: "Программирование целочисленных вычислений", author: (group: "ИУ6-42Б", nwa: "<NAME>"), adviser: (nwa: "<NAME>"), city: "Москва", table_of_contents: true, ) = Выполнение лабораторной работы == Цель Изучение средств и приемов программирования ветвлений и итерационных циклов на языке ассемблера. == Задание Разработать программу на языке ассемблера, вычисляющую: $ f = cases( (a+b)/m "если" m < 0, m^2 + b^3 "иначе", ) $ == Выполнение В предыдущей лабораторной работе подробно описан процесс ввод-вывода чисел с помощью процедур ```asm geti``` и ```asm outi```. В данной лабораторной работе я буду использовать эту библеотеку без изменений. === Схема алгоритма Перед началом разработки программы составим примерную схему алгоритма. Тут я не буде разделять ее по меткам, а создам полностью от начала выполнения программы до ее окаанчания. #img(image("flow.svg", width:29%), [Схема алгоритма]) === Инициализация и выделенние памяти И так алгоритм выполения готов, осталось только, придерживаясь его, сформировать программу. Для начала проинициализируем данные и выделим память. Как и в предыдущих лабораторных за это будут отвечать ```asm section .data``` и ```asm section .bss```. #let lab3 = parserasm(read("lab3.asm")) #code(funcstr(lab3, "section .data") + funcstr(lab3, "section .bss"), "asm", [Инициализируем данные и выделяем память]) === Ввод условная и безусловная передача управления В данных инициализируем строки приглашения на вход и сопутствующий ответу вывод. Память выделяем для ввода цифр пользователю. После работы с памятью необходимо запросить ввод пользователя, после ввода проверить $m < 0$. #code(funcstr(lab3, "_start:"), "asm", [Начало программы]) После ввода пользователя мы перемещаем в ```asm ebx``` $b$, ```asm ecx``` $m$, экономим 2 такта: при условии если $m > 0$ мы вообще не будем перемещать из памяти $a$, так как эта переменная не используется в арифмитических вычислениях. Команда ```asm cmp``` сравнивает два числа и поднимает некоторые флаги в регистре ```asm flags```. Эти флаги в последствии использует ```asm jl```, оперделяя необходимоть переходить к метке ```asm f1```, если переход просиходит, то в отличии от ```asm call``` место перехода не сохраняется в стеке и мы не сможем вернуться в ```asm _start``` с помощью ```asm ret```. по завершении метки процессор просто перейдет к следующей метке, лежащей в памяти, что может привести к многочисленным ошибкам. Такое как раз может произойти если ```asm ecx``` будет больше нуля, проэтому после ```asm jl``` написан безусловный (не проверяющий значения флагов) переход к метке ```asm jmp```. === Ветвление: $m < 0$ Для начала разберем ситуацию когда $m < 0$. #code(funcstr(lab3, "f1:"), "asm", [Считаем значение функции при $m < 0$]) В этом случае для вычислений нам все-таки пригодится значение $a$, поэтому переместим его в ```asm eax```. Сразу после этого прибавим ```asm ebx``` и разделим на ```asm ecx``` (подробнее об арифметических операциях я написал в лабораторной №2). После этого ответ будет в регистрe ```asm eax```. Переходим к выводу и завершению программы. === Ветвление: $m>=0$ Но для начала разберем другой случай: если $m >= 0$. Для этого напишем другую метку под названием ```asm f2```. #code(funcstr(lab3, "f2:"), "asm", [Считаем значение функции при $m >= 0$]) Тут так же будем использовать ```asm eax``` для арифметических вычислений. Переместим значение $b$ в него. Умножим 2 раза ```asm eax``` на $b$, таким образом получим куб $b$, который сохраним в ```asm ebx```. Переместим в ```asm eax``` $m$, умножим регистр на $m$ и получим $m^2$. Остается только сложить ```asm eax```, ```asm ebx``` и снова получить ответ в регистре ```asm eax```, после чего переходим к той же метке вывода и выхода. === Вывод результата и выход Так как ответы хранятся в одном и том же месте больше нет никакого значения в условии, поэтому для вывода и выхода буудет достаточно одной метки, которую назовем ```asm exit``` #code(funcstr(lab3, "exit:"), "asm", [Выводим число в ```asm eax``` и завершаем программу]) В предыдущей лабораторной работе описывалось, как работает мой вывод, тут скажу только о том, что число обязательно должно находится в оперативной памяти. Поэтому первым делом перемещаем в оперативную память наш ответ. Адрес числа передаем через регистры, как и адрес сопуствующего сообщения и его длину. Вызываем функцию ```asm outi```, которая организует остальной вывод за нас. Переместим в ```asm eax``` единицу, как код функции завершения и вызовем систему. == Компиляция Название файлов библеотеки ввода-вывода не изменилось, просто изменисля файл, указанный в ```sh $mod``` Вот, что необходимо ввести в терминал, для компиляции и сборки всех 3 файлов: #code("mod=lab3/lab3 # Название ассемблерного файла без расширения nasm -f elf -o $mod.o $mod.asm nasm -f elf -o lab2/input.o lab2/input.asm nasm -f elf -o lab2/output.o lab2/output.asm ld -m elf_i386 -o $mod $mod.o lab2/input.o lab2/output.o", "sh", "Команда в терминале") == Отладка Ввод-вывод отлажены в предыдущей лабораторной, поэтому посмотрим только результат работы кода в метках ```asm f1``` и ```asm f2```. === Отладка ```asm f1``` Для отладки при $m<0$ возьмем числа $a = 10; b = 13; m = -23$ $ f = (10+13)/(-23) = -1 $ #grid( columns:2, gutter:10pt, img(image("img/1.png", width: 88%), "Запуск"), img(image("img/2.png", width: 88%), ```asm mov eax, [a]```) ) #grid( columns:2, gutter:10pt, img(image("img/3.png", width: 88%), ```asm cmp eax, 0```), img(image("img/4.png", width: 88%), ```asm add eax, ebx```) ) #grid( columns:2, gutter:10pt, img(image("img/5.png", width: 88%), ```asm cdq```), img(image("img/6.png", width: 88%), ```asm idiv ecx```) ) #img(image("img/7.png", width: 50%),[Вывод ответа в консоль], f:(i)=>{i.display()}) === Отладка ```asm f2``` Для отладки при $m>=0$ возьмем числа $a = 0; b = -13; m = 23$ $ f = 23^2 + (-13)^3 = 529 - 2197 = -1668 $ #grid( columns:2, gutter:10pt, img(image("img/8.png", width: 90%), "Запуск"), img(image("img/9.png", width: 90%), ```asm mov eax, ebx```) ) #grid( columns:2, gutter:10pt, img(image("img/10.png", width: 90%), ```asm imul ebx```), img(image("img/11.png", width: 90%), ```asm imul ebx```) ) #grid( columns:2, gutter:10pt, img(image("img/12.png", width: 90%), ```asm mov ebx, eax```), img(image("img/13.png", width: 90%), ```asm mov eax, ecx```) ) #grid( columns:2, gutter:10pt, img(image("img/14.png", width: 90%), ```asm imul ecx```), img(image("img/15.png", width: 90%), ```asm add eax, ebx```) ) #img(image("img/16.png", width: 50%),[Вывод ответа в консоль], f:(i)=>{i.display()}) == Тестирование Напишем еще 3 теста для каждой метки. === Тестирование ```asm f1``` $ a = 2" "147" "483" "647; b = 0; m = -1\ f = (2147483647+0)/(-1) = -2147483647 $ #img(image("img/17.png", width: 50%),[Тест ```asm f1``` \#1], f:(i)=>{i.display()}) $ a = -2" "147" "483" "647; b = 0; m = -1\ f = (-2147483647+0)/(-1) = 2147483647 $ #img(image("img/18.png", width: 50%),[Тест ```asm f1``` \#2], f:(i)=>{i.display()}) $ a = -2" "147" "483" "647; b = " "147" "483" "647; m = -2" "000" "000\ f = (-2147483647+147483647)/(-2000000) = 1000 $ #img(image("img/19.png", width: 50%),[Тест ```asm f1``` \#3], f:(i)=>{i.display()}) === Тестирование ```asm f2``` $ b = 100; m = 0\ f = 100^3 + 0^2 = 1000000 $ #img(image("img/20.png", width: 50%),[Тест ```asm f2``` \#1], f:(i)=>{i.display()}) $ b = 100; m = 1000\ f = 100^3+1000^2 = 1000000+1000000 = 2000000 $ #img(image("img/21.png", width: 50%),[Тест ```asm f2``` \#2], f:(i)=>{i.display()}) $ b = 0; m = 10000\ f = 0^3 + 10000^2 = 100000000 $ #img(image("img/22.png", width: 50%),[Тест ```asm f2``` \#3], f:(i)=>{i.display()}) === Сводная таблица #align(center)[ #table( columns: 3, inset: 10pt, align: horizon, [*Исходные\ данные*],[*Ожидаемый\ результат*],[*Полученный\ результат*], [$ a = 10; b = 13; m = -23 $], [$-1$], [$-1$], [$ a = 2" "147" "483" "647;\ b = 13; m = -1 $], [$-2" "147" "483" "647$], [$-2" "147" "483" "647$], [$ a = -2" "147" "483" "647;\ b = 0; m = -1 $], [$2" "147" "483" "647$], [$2" "147" "483" "647$], [$ a = -2" "147" "483" "647;\ b = 147" "483" "647;\ m = -2" "000" "000 $], [$1" "000$], [$1" "000$], [$ b = -13; m = 23 $], [$-1" "668$], [$-1" "668$], [$ b = 100; m = 0 $], [$1" "000" "000$], [$1" "000" "000$], [$ b = 100; m = 1" "000 $], [$2" "000" "000$], [$2" "000" "000$], [$ b = 0; m = 10" "000 $], [$100" "000" "000$], [$100" "000" "000$], )] == Вывод В процессе выполения лабораторной работы был разобран механизм создания условных операторов в ассемблере, а так же написана и протестирована программа с простейшим ветвлением. #pagebreak() == Контрольные вопросы 1. *Какие машинные команды используют при программировании ветвлений и циклов?* a. Условные переходы (Branching / Conditional Jumps): - ```asm JE``` (Jump if Equal) - Переход, если равно. - ```asm JNE``` (Jump if Not Equal) - Переход, если не равно. - ```asm JZ``` (Jump if Zero) - Переход, если ноль (аналогично ```asm JE```). - ```asm JNZ``` (Jump if Not Zero) - Переход, если не ноль (аналогично ```asm JNE```). - ```asm JG``` (Jump if Greater) - Переход, если больше. - ```asm JGE``` (Jump if Greater or Equal) - Переход, если больше или равно. - ```asm JL``` (Jump if Less) - Переход, если меньше. - ```asm JLE``` (Jump if Less or Equal) - Переход, если меньше или равно. b. Безусловные переходы (Unconditional Jumps): - ```asm JMP``` (Jump) - Безусловный переход. c. Циклы (Loops): - ```asm LOOP``` – Уменьшает счетчик цикла (```asm CX```), и если он не равен нулю, выполняет переход. 2. *Выделите в своей программе фрагмент, реализующий ветвление. Каково назначение каждой машинной команды фрагмента?* Сравниваем ```asm ecx``` и `0`: #code("asm cmp ecx, 0 jl f1 ; Условный переход, если ecx < 0 (результат отрицателен) jmp f2 ; Иначе", "asm", "Ветвление") 3. *Чем вызвана необходимость использования команд безусловной передачи управления?* - ```asm JMP``` используется для эффективного перехода между различными участками кода, такими как циклы или ветвления. - может быть применен для перехода к обработчику ошибок при возникновении исключительных ситуаций. - используется для возврата из вызванной функции обратно в вызывающую функцию. 4. *Поясните последовательность команд, выполняющих операции ввода вывода в вашей программе. Чем вызвана сложность преобразований данных при выполнении операций ввода-вывода?* Рассмотрено в ЛР2
https://github.com/typst/packages
https://raw.githubusercontent.com/typst/packages/main/packages/preview/tuhi-course-poster-vuw/0.1.0/template/main.typ
typst
Apache License 2.0
#import "@preview/tuhi-course-poster-vuw:0.1.0": tuhi-course-poster-vuw // choice of fonts #set text(font: "Source Sans Pro") #show raw: set text(font: "Source Code Pro", size: 1.1em, tracking: -0.1pt) // dummy details #let logo = image("logo.svg") #let url = "https://paekakariki.nz/" #let contact = (school: "Ko Haumia Whakatere Taniwha te tangata • Ko Miriona te kuia", faculty: "Nau mai haere mai ki te papa kainga o Ngāti Haumia ki Paekākāriki", university: "Miriona Gardens, North end of Tilley Rd, Paekākāriki", phone: "+64·1·111·1111", email: "<EMAIL>", website: "paekakariki.fm" ) #let courses = ( Y1T1: "esca101 · esca145 · trek101 · swim141", Y1T2: "esca142 · esca131 · trek102 · swim142", Y2T1: "esca243 · esca245 · trek245", Y2T2: "esca241 · esca242 · trek201", Y3T1: "esca305 · esca307 · trek301", Y3T2: "esca304 · esca345 · trek360", Y4T1: "esca411 · esca413 · trek415 · swim490", Y4T2: "esca412 · esca414 · trek416 · swim417", ) // use the template #show: tuhi-course-poster-vuw.with( coursetitle : text[escarpment track], courseid : "esca101", coursemajor: "hiking", courseimage: image("images/esca101.jpg"), imagecredit : text[sunset], coursepoints : text[*1205*], coursetrimester : text[*0.005*], courselecturers : ("Bridges", "Stairway",), courseformat : text[*2* bridges/hangouts], coursedescription : text[Stairway to Heaven _that won't let you down_], courseprereqs: text[*1* achievement backpack \ in *LEVEL 3 NCEA* Tramping\ or equivalent, or *murph101*], courses: courses, contact: contact, logo: logo, qrcodeurl: url, ) == Paekākāriki to Pukerua Bay Popular • unique trail • average-to-high fitness • legendary • \ sense of exhilaration! • Part of New Zealand’s Te Araroa Trail == Take water, snacks and lunch with you Allow at least 3.5 to 4 hours (half a day) for the 10km walk, \ plus extra for the train travel and rest stops == Kāpiti Coastline Follow the signs for approximately 600m until you reach the railway bridge underpass. Not recommended for the faint-hearted.
https://github.com/jgm/typst-hs
https://raw.githubusercontent.com/jgm/typst-hs/main/test/typ/text/emphasis-00.typ
typst
Other
// Basic. _Emphasized and *strong* words!_ // Inside of a word it's a normal underscore or star. hello_world Nutzer*innen // Can contain paragraph in nested content block. _Still #[ ] emphasized._
https://github.com/t2lab-it/Lozano-Duran2022_information-theoretic
https://raw.githubusercontent.com/t2lab-it/Lozano-Duran2022_information-theoretic/main/main.typ
typst
#import "@preview/arkheion:0.1.0": * #import "style.typ": * #set math.equation(numbering: "(1)") //================================================== // DOCUMENT //================================================== #set text(font: mincho) #show: arkheion.with( title: text(font: mincho)[動的システムの情報理論的形式: 因果関係, モデリング, 操作], authors: ( ( name: "<NAME>", email: "", affiliation: "", orcid: "0000-0001-9306-0261" ), ( name: "<NAME>", email: "", affiliation: "", orcid: "0000-0001-6579-3791" ), ), abstract: [The problems of causality, modeling, and control for chaotic, high-dimensional dynamical systems are formulated in the language of information theory. The central quantity of interest is the Shannon entropy, which measures the amount of information in the states of the system. Within this framework, causality is quantified by the information flux among the variables of interest in the dynamical system. Reduced-order modeling is posed as a problem related to the conservation of information in which models aim at preserving the maximum amount of relevant information from the original system. Similarly, control theory is cast in information-theoretic terms by envisioning the tandem sensor-actuator as a device reducing the unknown information of the state to be controlled. The new formulation is used to address three problems about the causality, modeling, and control of turbulence, which stands as a primary example of a chaotic, high-dimensional dynamical system. The applications include the causality of the energy transfer in the turbulent cascade, subgrid-scale modeling for large-eddy simulation, and flow control for drag reduction in wall-bounded turbulence.] ) #set text(font: mincho) = 情報理論の基礎 == 情報量 離散化されたランダムな事象$X$が,$x$の値をとるとき,確率密度関数 $p$ は次式で表現できる. $ p(x) = Pr{X = x} $ この時の情報量は, $ cal(I)(x) := log_2[p(x)] $ で定義される. 一般には,事象$X$に対しての平均を取る. $ H(X) = ⟨cal(I)(x)⟩ = sum_x -p(x) log_2[p(x)] >= 0 $ この時,記号$⟨dot⟩$は期待値を求める操作を表す. これはシャノンエントロピーと呼ばれる. == 同時エントロピー これを複数の事象$bold(X)=[X_1, X_2, dots,X_m]$に拡張すると,同時エントロピーが得られる. $ H(bold(X)) = ⟨cal(I)(bold(x))⟩ = sum_(bold(x)) -p(x_1, x_2, dots , x_m)log_2[p(x_1, x_2, dots , x_m)] $ 特に,事象が2つの場合には次のように記述できる. $ H(X,Y) = ⟨cal(I)(x,y)⟩ = sum_(x,y) -p(x,y)log_2[p(x,y)] $ この時,確率分布の性質は利用できる. 例えば,$x$は$y$に対して規格化条件を満たす必要がある. $ p(y) = sum_x p(x,y) $ == 条件付きエントロピー === 条件付きエントロピーの定義 $x$に関する$y$の条件付き確率を次式で定めることができる. $ p(x|y) = frac(p(x,y),p(y)) $ これによって定められる条件付きエントロピーは $ H(X|Y) = sum_(x,y) -p(x, y)log_2[p(x|y)] $ となる. === 条件付きエントロピーの性質 もし,$x$が$y$に対して独立であるなら, $ p(x,y) = p(x)p(y) $ が成立するから, $ p(x|y) = frac(p(x)p(y),p(y)) = p(x) $ となるので, $ H(X|Y) &= sum_(x,y) -p(x)p(y)log_2[p(x)]\ &= sum_x -p(x)log_2[p(x)]\ &= H(X) $ となる. 逆に,$x$が$y$に対して完全に従属であるなら, $ p(x,y) = p(y) $ となり,条件付き確率は, $ p(x|y) = frac(p(y),p(y)) = 1 $ となる.これより,条件付きエントロピーは $ H(X|Y) &= sum_(x,y) -p(y)log_2[1]\ &= sum_x 0\ &= 0 $ となる. これらから,相互情報量は以下で定義できる. $ I(X:Y) &= H(X) - H(X|Y)\ &= H(Y) - H(Y|X) $ = 動的システムにおける情報 == 動的システムの準備 動的システムにおける変数を,$bold(q)$とすると, $ bold(q) = bold(q)(bold(x),t) $ である. この時,$bold(x)$は空間座標で,$t$は時間である. 変数$bold(q)$がベクトルであるのは,複数の変数を考慮するためである. 例えば非圧縮の流体の場合,速度場$u_1,u_2,u_3$および圧力$p$を合わせて,次のようになる. $ bold(q) = [u_1, u_2, u_3, p]^T $ この記述を一般化すれば,自由度$N$のシステムに対して次のようになる. $ bold(q) = [q_1, q_2, dots, q_N]^T $ このシステムにおける支配方程式は,一般化して次のように書ける. $ frac(partial bold(q),partial t) = bold(F)(bold(q)) $ 上式を,時間$t$で積分する.積分範囲は$t_n$から$t_(n+1)$とすれば, $ integral_(t_n)^(t_(n+1)) frac(partial bold(q), partial t) d t &= integral_(t_n)^(t_(n+1)) bold(F)(bold(q)) d t\ bold(q)(bold(x),t_(n+1)) &= bold(q)(bold(x),t_n) + integral_(t_n)^(t_(n+1)) bold(F)(bold(q)) d t $ となる. この時,$t_(n+1) - t_n$は時間幅となる. 時刻$t_n$における変数を$bold(q)^n$とすれば, $ bold(q)^n = [q_1^n, q_2^n, dots, q_N^n]^T $ である. == 確率変数の導入 今,このシステムの物理量を確率変数として扱う. 時刻$t_n$における物理量の確率変数を$Q^n$とすれば, $ bold(Q)^n = [Q_1^n, Q_2^n, dots, Q_N^n]^T $ と書ける. この時,先の式から支配方程式が存在し, $ bold(Q)^(n+1) = bold(f)(bold(Q)^n) $<Qeq> の関係がある. $bold(Q)$がとりうる範囲$D$を$N_q$個に分割し,それぞれの領域を$D_i$とする. この時,$D_i$は$D$の集合とみなせて, $ D = {D_1, D_2, dots, D_N_q} $ と書ける. #block(fill: red.transparentize(50%))[領域$D_i$は空間的な分割?なんの分割か?] それぞれ$D_i$は$i!=j$において,互いに同じ領域を持たないように取る. $ D_i and D_j = nothing $ もし,$bold(q)^n$が領域$D_i$に含まれる時,その確率は $ p_i^q = Pr{bold(Q)^n in D_i} $ と書くことができる. 略記として,上記の記述を $ p_i^q = p(bold(q)^n) $ と書くことにする. == 動的システムの情報理論的視点 確率変数$bold(Q)^(n+1)$は,支配方程式@Qeq より$bold(Q)^n$によって記述できる. これを利用すれば,$bold(Q)^(n+1)$のエントロピーは, $ H(bold(Q)^(n+1)) = H(bold(f)(bold(Q)^n)) <= H(bold(Q)^n) $ となる. 上のような不等号が成立するのは,$bold(Q)^n$から$bold(Q)^(n+1)$を導くことはできるが,$bold(Q)^(n+1)$から$bold(Q)^n$を導けるとは限らないためである.\ \ また,支配方程式が存在するので,$t_n$の時の確率分布$p(bold(q)^n)$を知っていれば,次の時刻$t_(n+1)$での確率分布$p(bold(q)^(n+1))$を計算することも可能である. これを,転送作用素の演算子$bb(P)$を使って, $ p(bold(q)^(n+1)) = bb(P)[p(bold(q)^n)] $ と記述する. #block(fill: red.transparentize(50%))[転送作用素とは?確率を求める関数という認識?] これを用いれば,$bold(Q)^n$に対する$bold(Q)^(n+1)$の条件付きエントロピーは, $ H(bold(Q)^(n+1)|bold(Q)^n) &= sum -p(bold(q)^(n+1),bold(q)^n) log_2[p(bold(q)^(n+1)|bold(q)^n)]\ &= sum -p(bold(q)^(n+1)|bold(q)^n)p(bold(q)^n) log_2[p(bold(q)^(n+1)|bold(q)^n)]\ &= sum -bb(P)[p(bold(q)^n|bold(q)^n)]p(bold(q)^n) log_2{bb(P)[p(bold(q)^n|bold(q)^n)]}\ &= 0 $ となり,条件付きエントロピーは0となる. #block(fill: red.transparentize(50%))[式(29)から,式(30)の$p(bold(q)^(n+1)|bold(q)^n) = bb(P)[p(bold(q)^n|bold(q)^n)]$が導かれるのは,数学的にどういう原理か?] これは,$bold(Q)^n$を知っているとき,$bold(Q)^(n+1)$の不確実性は全くないことを表している.\ \ もし,逆関係 $ bold(Q)^n = bold(f)^(-1) H(bold(Q)^n) $ が成立するなら,情報はその時間内で保存される. $ H(bold(Q)^(n+1)) = H(bold(Q)^n) $ == ノイズを含むシステム より一般的には,$bold(Q)^n$と$bold(Q)^(n+1)$の間には,何らかノイズを含む. つまり,ノイズの影響を考えると,$bold(Q)^n$に対する$bold(Q)^(n+1)$の条件付きエントロピーは0にならず,ある程度の値を持つ. $ H(bold(Q)^(n+1)|bold(Q)^n) >= 0 $ このノイズを$bold(W)$とすれば,支配方程式を記述し直して, $ bold(Q)^(n+1) = bold(f)(bold(Q)^n, bold(W)^n) $ とできる. このノイズの影響まで考慮すれば,条件付きエントロピーは $ H(bold(Q)^(n+1)|bold(Q)^n,bold(W)^n) = 0 $ となり,0になる. 流体のようなカオス系では,微小な初期誤差$bold(W)^n$の影響で,カオスの初期値鋭敏性によって非ゼロとなりうる. 今後は,$bold(W)^n$の影響を考えずに議論をする. = 相関としての情報流 == 情報流 先の方程式@Qeq から,システムの確率変数の1つ$Q_j^(n+1)$に関する支配方程式は $ Q_j^(n+1) = f_j (bold(Q)^n) $ となる. これより,条件付きエントロピーは, $ H(Q_j^(n+1) | bold(Q)^n) = 0 $ である. これは,$Q_j^(n+1)$に含まれる情報は,$bold(Q)^n$に完全に含まれていることを意味する.\ \ ここで,$bold(Q)^n$のうちの一部分$bold(Q)_bold(i)^n$を考える. この時,$bold(i)$は,$N$以下の一部分で, $ bold(i) = [i_1, i_2, dots, i_M] $ とする. $M$は$M<=N$を満たす. このとき,$bold(Q)_bold(i)^n$は $ bold(Q)_bold(i)^n = [Q_(i_1)^n, Q_(i_2)^n, dots,Q_(i_M)^n] $ となる. また,これの反要素$bold(Q)^n and overline(bold(Q)_bold(i)^n)$を$bold(Q)_bold(cancel(i))^n$と表せば, $ bold(Q)^n = [bold(Q)_bold(i)^n, bold(Q)_bold(cancel(i))^n] $ の関係になる. もし,この反要素$bold(Q)_bold(cancel(i))^n$しか知らなかったとすると,一般に $ H(Q_j^(n+1)|bold(Q)_(cancel(i))^n) >= 0 $ となり,0とならずに値を持ちうる. これは,$bold(Q)_bold(cancel(i))^n$の情報だけ知っていても,$Q_j^(n+1)$を表現できるとは限らないことを意味する. 逆に言えば,$bold(Q)_bold(i)^n$は,$Q_j^(n+1)$を表現するのに貢献していると言える. もし,貢献していなければ,上の条件付きエントロピーはゼロとなる. このことから,$bold(Q)_bold(i)^n$から$Q_j^(n+1)$への情報の輸送は,条件付きエントロピー$H(Q_j^(n+1)|bold(Q)_(cancel(i))^n)$で表現できると考えられる. 実際に,移動エントロピーの一般式は $ T_(bold(i) arrow.r j) = sum_(k=0)^(M-1) sum_(bold(i)(k) in C_k) (-1)^k H(Q_j^(n+1)|bold(Q)_(cancel(i)(k))^n) $<trans_eq1> となる. #block(fill: red.transparentize(50%))[式(41)から式(42)の導出は?(式(41)およびベン図から)概念は理解できるが,どのようにしてこの式が組み立てられるのかがわからない.この式の一般性を証明できない.] ここで,$bold(i)(k)$は,$bold(i)$のうち,$k$個の要素を抜いたものである. この集合が$C_k$である. 例えば,$bold(i) = [1,2]$であれば,次の組み合わせとなる. $ C_0 &= {[1,2]}\ C_1 &= {[1],[2]} $ この移動エントロピー$T_([1,2] arrow.r 3)$では,上記の一般式に代入して $ T_([1,2] arrow.r 3) &= sum_(k=0)^1 sum_(bold(i)(k) in C_k) (-1)^k H(Q_3^(n+1)|bold(Q)_(bold(cancel(i))(k))^n)\ &= H(Q_3^(n+1)|Q_3^n) - ( H(Q_3^(n+1)|Q_2^n,Q_3^n) + H(Q_3^(n+1)|Q_1^n,Q_3^n) )\ &= H(Q_3^(n+1)|Q_3^n) - H(Q_3^(n+1)|Q_2^n,Q_3^n) - H(Q_3^(n+1)|Q_1^n,Q_3^n) $<trans_1_2_3> これを図で表す.移動エントロピーは,以下の青部分である. #figure( image("figs/fig1.png",width: 50%) ) これに対し,@trans_1_2_3 のそれぞれのエントロピーは,以下の領域を表す. #figure( image("figs/fig2.png",width: 100%) ) これより,先の式が正しいことが視覚的に確認できる.\ \ 性質として,それぞれの移動エントロピー$T$には重複が含まれない. 例えば,$T_([1,2] arrow.r 3)$と$T_(1 arrow.r 3)$は次のようになる. #figure( image("figs/fig3.png",width: 70%) ) 上のように,それぞれの移動エントロピーは重複しない. #block(fill: red.transparentize(50%))[一般性の証明はどのように?] また,移動エントロピーは,条件付き相互情報量で表現することが可能である. $ T_(bold(i) arrow.r j) = I(Q_j^(n+1):Q_(j_1)^n:Q_(j_2)^n:dots:Q_(j_M)^n|bold(Q)_(bold(cancel(i)))^n) $ この条件付き相互情報量は,以下の性質がある. $ I(Q_j^(n+1):Q_(j_1)^n:Q_(j_2)^n:dots:Q_(j_M)^n|bold(Q)_(bold(cancel(i)))^n) = I&(Q_j^(n+1):Q_(j_1)^n:Q_(j_2)^n:dots:Q_(j_(M-1))^n|bold(Q)_(bold(cancel(i)))^n) \ &- I(Q_j^(n+1):Q_(j_1)^n:Q_(j_2)^n:dots:Q_(j_(M-1))^n|[Q_(i_M)^n,bold(Q)_(bold(cancel(i)))^n]) $ #block(fill: red.transparentize(50%))[要素が3つの場合は視覚的に確認済み.この式の一般性の証明はどのように?] また,$Z$に対する$X$と$Y$の相互情報量は,次式になる. $ I(X:Y|Z) &= sum_(x,y,z) p(x,y,z) log_2 frac(p(x,y|z),p(x|z)p(y|z))\ &= sum_(x,y,z) p(x,y,z) log_2 frac(p(x,y,z)p(z),p(x,z)p(y,z))\ &= sum_(x,y,z) p(x,y,z) log_2 frac(p(z),p(x,z)) - sum_(x,y,z) p(x,y,z) log_2 frac(p(y,z),p(x,y,z))\ &=sum_(x,z)-p(x,z)log_2 p(x|z) - sum_(x,y,z) p(x,y,z) log_2 p(x|y,z)\ &= H(X|Z) - H(X|Y,Z) $ 以上の2式を用いれば,エントロピーから移動エントロピーを計算が可能である.\ \ さらに,移動エントロピーを用いて$H(Q_j^(n+1))$を計算することができる. $ H(Q_j^(n+1)) = sum_(bold(i)' in cal(C)) T_(bold(i)' arrow.r j) $ ここで,$cal(C)$は,1から$N$までの要素を持つ$bold(i) or bold(cancel(i))$の組み合わせである. 先のベン図の例では, $ cal(C) = {1, 2, 3, [1,2], [2,3], [1,3], [1,2,3]} $ である.これは, #figure( image("figs/fig4.png",width: 50%) ) となり,移動エントロピーの和がエントロピーとなることがわかる. もし,$bold(Q)_(bold(i))^n$が$Q_j^(n+1)$へ与える影響がないとき,システムの支配方程式は以下の形で書ける. $ Q_j^(n+1) = f_j (bold(Q)_(bold(cancel(i)))^n) $ これは,$bold(cancel(i))^n$の成分のみから,次の時刻の$Q_j^(n+1)$を再現できることと同義である. この場合,$bold(i) arrow.r j$の方向の移動エントロピーは0である. $ T_(bold(i) arrow.r j) = 0 $ これは,$bold(Q)_bold(i)$の要素が,$Q_j$に対して作用しない限り,直接的な因果関係が生じないという直感と一致する. 加えて,情報流は確率分布を基礎として構築されるので,移動や再スケール,あるいは一般の非線形$C^1$級微分同相変換に対して不変である. もう一つ重要な性質として,移動エントロピーは中間変数を含まない直接的な相関を再現する. 例えば,相関の流れが $ Q_i arrow.r Q_j arrow.r Q_k $ である時,$Q_i arrow.r Q_k$の移動は観測されない.この場合, $ T_(i arrow.r k) = 0 $ である. また,一般に情報流は非対称である. $ T_(bold(i) arrow.r bold(j)) != T_(bold(j) arrow.r bold(i)) $ == 観測可能な量における情報流 多くの場合で,我々が興味あるもの,或いは観測可能な量は限定される. この場合,観測可能な状態量を$bold(Y)^n$として, $ bold(Y)^n = bold(h)(bold(Q)^n) $ と書ける. この時,$bold(Y)$は,以下の自由度を持つ. $ bold(Y) = [Y_1^n, Y_2^n, dots, Y_(N_Y)^n] $ $N_Y < N$であり,自由度が減少した分だけ保持する情報量は小さくなる. $ H(bold(Y)^n) = H(bold(h)(bold(Q)^n)) <= H(bold(Q)^n) $ この場合,$bold(Y)^n$が,未来の状態$bold(Y)^(n+1)$を表現できるとは限らない. この関係は,以下の式で明らかになる. $ H(bold(Y)^(n+1)|bold(Y)^n) >= H(bold(Y)^(n+1)|bold(Q)^n) = 0 $ 特に$Y_j^(n+1)$に注目すれば,上式は $ H(Y_j^(n+1)|bold(Y)^n) >= 0 $ となる. この場合,先の移動エントロピーの式は修正されて,以下の形で定義される. $ T_(bold(i) arrow.r j)^Y = [sum_(k=0)^(M-1) sum_(bold(i)(k) in cal(P)_k) (-1)^k H(Y_j^(n+1)|bold(Y)_(cancel(i)(k))^n)] +(-1)^M H(Y_j^(n+1)|bold(Y)^n) $ この時,$M <= N_Y$となる$bold(i)$を選択する.つまり, $ bold(i) = [i_1,i_2,dots,i_M] $ となる$bold(i)$の中から選択される. このため,集合$cal(P)_k$は$cal(C)_k$とは異なる集合である(一般に,$cal(P)_k in cal(C)_k$が成立). 最終項は,$H(Y_j^(n+1)|bold(Y)^n)$で表現される観測できない状態量による情報の損失を補うために追加された項である. より上記を自然に記述するために,和の記号の中に入れることもできる. $ T_(bold(i) arrow.r j)^Y = sum_(k=0)^(M) sum_(bold(i)(k) in cal(P)_k) (-1)^k H(Y_j^(n+1)|bold(Y)_(cancel(i)(k))^n) $<trans_eq2> 条件付き相互情報量の形で記述することもできる. $ T_(bold(i) arrow.r j)^Y = I(Y_j^(n+1):Y_(i_1)^n:Y_(i_2)^n:dots:Y_(i_M)^n|bold(Y)_(bold(cancel(i)))^n) $ もし,$bold(Y)^n=bold(Q)^n$であれば,条件付きエントロピーは0となる. $ H(Y_j^(n+1)|bold(Y)^n) = 0 $ これは,先のエントロピーの式@trans_eq1 と一致する. よって式@trans_eq2 は,より一般化された形である.\ \ さらに,$bold(i) = [i]$であるとき,観測可能な状態量による情報流は, $ T_(i arrow.r j)^Y = H(Y_j^(n+1)|bold(Y)_cancel(i)^n) - H(Y_j^(n+1)|bold(Y)^n) $ と簡単な形で書ける.\ \ また,移動エントロピーの和は未来の情報量と一致することを先に示したが,観測可能な量が限定されている場合には,"もれ"が発生する. $ H(Y_j^(n+1)) = sum_(bold(i) in cal(P)) T_(bold(i) arrow.r j)^Y + T_(mono(l e a k),j)^Y $ この$T_(mono(l e a k),j)^Y$は,条件付きエントロピーと一致する. $ T_(mono(l e a k),j)^Y = H(Y_j^(n+1)|bold(Y)^n) $ 上記の式を,$T_(i arrow.r j)^Y$で正規化すれば, $ T N_(bold(i) arrow.r j)^Y = frac(T_(bold(i) arrow.r j)^Y, H(Y_j^(n+1))) $ $ T N_(mono(l e a k),j)^Y = frac(T_(mono(l e a k),j)^Y, H(Y_j^(n+1))) $ となり,先の式は $ sum_(bold(i) in cal(P)) T N_(bold(i) arrow.r j)^Y + T N_(mono(l e a k),j)^Y = 1 $ とかける. 例として,先と同じ3つの場合で考えると,図は次のようになる. #figure( image("figs/fig5.png",width: 70%) ) $bold(i)=[1],j=2$のとき,移動エントロピーの式に代入すると次のようになる. $ T_(1 arrow.r 2)^Y = H(Y_2^(n+1)|Y_2^n,Y_3^n) - H(Y_2^(n+1)|Y_1^n,Y_2^n,Y_3^n) $ $bold(i)=[1,3],j=2$のとき,移動エントロピーの式に代入すると次のようになる. $ T_([1,2] arrow.r 2)^Y = H&(Y_2^(n+1)|Y_2^n) - H(Y_2^(n+1)|Y_1^n,Y_2^n)\ &- H(Y_2^(n+1)|Y_2^n,Y_3^n) + H(Y_2^(n+1)|Y_1^n,Y_2^n,Y_3^n) $ $bold(i)=[1,2,3],j=2$のとき,移動エントロピーの式に代入すると次のようになる. $ T_([1,2,3] arrow.r 2)^Y = H&(Y_2^(n+1))\ &- H(Y_2^(n+1)|Y_1^n) - H(Y_2^(n+1)|Y_2^n) - H(Y_2^(n+1)|Y_3^n)\ &+ H(Y_2^(n+1)|Y_1^n,Y_2^n) + H(Y_2^(n+1)|Y_1^n,Y_3^n) + H(Y_2^(n+1)|Y_2^n,Y_3^n)\ &+ H(Y_2^(n+1)|Y_1^n,Y_2^n,Y_3^n) $ これらより,図から$Y_2^(n+1)$のエントロピーは,移動エントロピーの和で記述できることがわかる. $ H(Y_2^(n+1)) = T_(1 arrow.r 2)^Y + T_(2 arrow.r 2)^Y + T_(3 arrow.r 2)^Y + T_([1,2] arrow.r 2)^Y + T_([2,3] arrow.r 2)^Y + T_([1,3] arrow.r 2)^Y + T_([1,2,3] arrow.r 2)^Y + T_(mono(l e a k),j)^Y $ ここで,$T_(mono(l e a k),j)^Y = H(Y_2^(n+1)|Y_1^n,Y_2^n,Y_3^n)$である.\ \ $T_(bold(i) arrow.r j)^Y$は,非負性を満たすとは限らないことに注意しなければならない. 移動エントロピーの変数の数が奇数の場合,非負性の拘束はない. #block(fill: red.transparentize(50%))[証明方法?] == 情報流の最適観測状態と位相空間分割 $i != j$において,それぞれの相互情報量$I(Y_i^n:Y_j^n)$が次の条件を満たすときを考える. $ I(Y_i^n : Y_j^n) = 0 $ このとき,情報の流れは単独の流れのみを観測すれば良い. つまり,2個以上の流れ($T_([1,2] arrow.r 2)$や$T_([1,2,3] arrow.r 2)$など)は全て0となり,それぞれ独立な流れ($T_(1 arrow.r 2)$や$T_(2 arrow.r 2)$など)のみを考えれば良い.\ しかし,一般にはこれが成立しないので,ある変換$bold(w)^*$を行う. $ bold(Y)^(n*) = bold(w)^*(bold(Y)^n) $ この変換は,情報を失わないように,可逆であることを条件とする. 変換では, $ bold(w)^* = arg min_(bold(w)(bold(Y)^n)) (sum_(i,j,i != j)I(Y_i^n : Y_j^n)) $ また, $ H(bold(Y)^(n*)) = H(bold(Y)^n) $ とすることで,情報の流れを各変数に単独な流れとして観測しやすくなる. この変換によって,各パラメータが未来の情報に与える影響を評価しやすくすることができる. 似たような議論として,位相空間における分割$D = {D_1,D_2,dots,D_(N_q)}$の方法を最適な$D^*$に変更すると, $ D^* = arg min_D (sum_(i,j,i != j) I(Q_i^n : Q_j^n)) $ となる. このとき,$D$の条件は$D^*$も満たす必要がある. /* = 等方性乱流におけるエネルギーカスケードの相関 非圧縮における流体の方程式は,次式で記述できる. $ frac(partial u_i, partial t) + frac(partial u_i u_j, partial x_j) = -frac(1,rho)frac(partial Pi, partial x_i) + nu frac(partial^2 u_i, partial x_j partial x_j) + f_i $ $ frac(partial u_i, partial x_i) = 0 $ このとき,$u_i$は速度であり,$Pi$は圧力である. また,$rho$は密度であり,$nu$は動粘度である. 上記のNavier-Stokes方程式に対して,$u_i$をかけて,エネルギー方程式にする. $ underbrace(u_i frac(partial u_i, partial t), A) + underbrace(u_i frac(partial u_i u_j, partial x_j),B) = underbrace(-u_i frac(1,rho)frac(partial Pi, partial x_i),C) + underbrace(nu u_i frac(partial^2 u_i, partial x_j partial x_j),D) + underbrace(f_i u_i, E) $ それぞれの項について,変形をする.最初にA項について, $ u_i frac(partial u_i, partial t) = frac(partial, partial t)(frac(u_i u_i, 2)) = frac(partial k, partial t) $ ここで,運動エネルギー$k = frac(u_i u_i, 2)$を定めた. 次にB項について, $ u_i frac(partial u_i u_j, partial x_j) &= u_i u_i underbrace(frac(partial u_j, partial x_j),0) + u_i u_j frac(partial u_i, partial x_j)\ &= u_i u_j frac(partial u_i, partial x_j)\ &= u_j frac(partial,partial x_j)(frac(u_i u_i, 2))\ &= u_j frac(partial k, partial x_j) $ */ = 情報理論的SGSモデルの問題点について SGS応力を, $ tau_(i j)^("SGS") - 1/3 tau_(k k)^("SGS")delta_(i j) &= theta_1 macron(Delta)^2 macron(S)_(i j)sqrt(macron(S)_(m n)macron(S)_(m n)) + theta_2 macron(Delta)^2(macron(S)_(i k)macron(Omega)_(k j) - macron(Omega)_(i k)macron(S)_(k j)) $ とモデル化する. このとき,$theta_1$および$theta_2$は求めるパラメータである.\ 乱流の統計理論で重要となる生成項を求める. これは, $ P &= (tau_(i j)^("SGS") - 1/3 tau_(k k)^("SGS")delta_(i j))macron(S)_(i j)\ &= [theta_1 macron(Delta)^2 macron(S)_(i j)sqrt(macron(S)_(m n)macron(S)_(m n)) + theta_2 macron(Delta)^2(macron(S)_(i k)macron(Omega)_(k j) - macron(Omega)_(i k)macron(S)_(k j))]macron(S)_(i j) $<eq:sgs_theta> と書ける. ここで,右辺第2項 $ (macron(S)_(i k)macron(Omega)_(k j) - macron(Omega)_(i k)macron(S)_(k j))macron(S)_(i j) &= underbrace(macron(S)_(i k)macron(Omega)_(k j)macron(S)_(i j), "(a)") - underbrace(macron(Omega)_(i k)macron(S)_(k j)macron(S)_(i j), "(b)") $<eq4_1> について考える. 変形速度テンソル$macron(S)_(i j)$および回転テンソル$macron(Omega)_(i j)$は,速度勾配テンソル $ A_(i j) &= (partial u_i)/(partial x_j) $ を用いて $ macron(S)_(i j) &= 1/2 (A_(i j) + A_(j i))\ macron(Omega)_(i j) &= 1/2 (A_(i j) - A_(j i)) $ のように記述できる. これを@eq4_1 右辺第1項(a)に代入すれば, $ macron(S)_(i k)macron(Omega)_(k j)macron(S)_(i j) &= 1/8 (A_(i k) + A_(k i))(A_(k j) - A_(j k))(A_(i j) + A_(j i))\ &= 1/8(A_(i k)A_(k j) - A_(i k)A_(j k) + A_(k i)A_(k j) - A_(k i)A_(j k))(A_(i j) + A_(j i))\ &= 1/8(underbrace(A_(i k)A_(k j)A_(i j),"(a1)") - underbrace(A_(i k)A_(j k)A_(i j),"(a2)") + underbrace(A_(k i)A_(k j)A_(i j),"(a3)") - underbrace(A_(k i)A_(j k)A_(i j),"(a4)")\ &+ underbrace(A_(i k)A_(k j)A_(j i),"(a5)") - underbrace(A_(i k)A_(j k)A_(j i),"(a6)") + underbrace(A_(k i)A_(k j)A_(j i),"(a7)") - underbrace(A_(k i)A_(j k)A_(j i),"(a8)")) $ @eq4_1 右辺第1項(b)に代入すれば, $ macron(Omega)_(i k)macron(S)_(k j)macron(S)_(i j) &= 1/8 (A_(i k) - A_(k i))(A_(k j) + A_(j k))(A_(i j) + A_(j i))\ &= 1/8(A_(i k)A_(k j) + A_(i k)A_(j k) - A_(k i)A_(k j) - A_(k i)A_(j k))(A_(i j) + A_(j i))\ &= 1/8(underbrace(A_(i k)A_(k j)A_(i j),"(b1)") + underbrace(A_(i k)A_(j k)A_(i j),"(b2)") - underbrace(A_(k i)A_(k j)A_(i j),"(b3)") - underbrace(A_(k i)A_(j k)A_(i j),"(b4)")\ &+ underbrace(A_(i k)A_(k j)A_(j i),"(b5)") + underbrace(A_(i k)A_(j k)A_(j i),"(b6)") - underbrace(A_(k i)A_(k j)A_(j i),"(b7)") - underbrace(A_(k i)A_(j k)A_(j i),"(b8)")) $ (a2), (a3), (a6), (a7)は(b2), (b3), (b6), (b7)で消去される. また,(a1), (a4), (a5), (a8)は(b1), (b4), (b5), (b8)と同一項である. よって,@eq4_1 を書き直せば, $ (macron(S)_(i k)macron(Omega)_(k j) - macron(Omega)_(i k)macron(S)_(k j))macron(S)_(i j) &= 1/4(underbrace(A_(i k)A_(k j)A_(i j), alpha) - underbrace(A_(k i)A_(j k)A_(i j), beta) + underbrace(A_(i k)A_(k j)A_(j i), gamma) - underbrace(A_(k i)A_(j k)A_(j i), epsilon)) $ ここで,$epsilon$における添字$(i, j, k)$を$(j, i, k)$に入れ替えれば, $ A_(k i)A_(j k)A_(j i) = A_(k j)A_(i k)A_(i j) $ となり,$alpha$と一致する. 同様にして,$gamma$における添字$(i, j, k)$を$(k, j, i)$に入れ替えれば, $ A_(i k)A_(k j)A_(j i) = A_(k i)A_(i j)A_(j k) $ となり,$beta$と一致する. よって, $ (macron(S)_(i k)macron(Omega)_(k j) - macron(Omega)_(i k)macron(S)_(k j))macron(S)_(i j) = 0 $ となる. これより,@eq:sgs_theta の第二項は消去されて $ P &= [theta_1 macron(Delta)^2 macron(S)_(i j)sqrt(macron(S)_(m n)macron(S)_(m n))]macron(S)_(i j) $ となり,生成項は$theta_2$に依存しない.
https://github.com/Myriad-Dreamin/typst.ts
https://raw.githubusercontent.com/Myriad-Dreamin/typst.ts/main/fuzzers/corpora/math/class_02.typ
typst
Apache License 2.0
#import "/contrib/templates/std-tests/preset.typ": * #show: test-page // Test nested. #let normal = math.class.with("normal") #let pluseq = $class("binary", normal(+) normal(=))$ $ a pluseq 5 $
https://github.com/FlandiaYingman/note-me
https://raw.githubusercontent.com/FlandiaYingman/note-me/main/stick-together.typ
typst
MIT License
// https://gist.github.com/PgBiel/2976c9d0ed5638ef57633ce7233928ea // MIT No Attribution // // Copyright (c) 2023 <NAME> // // Permission is hereby granted, free of charge, to any person obtaining a copy of this // software and associated documentation files (the "Software"), to deal in the Software // without restriction, including without limitation the rights to use, copy, modify, // merge, publish, distribute, sublicense, and/or sell copies of the Software, and to // permit persons to whom the Software is furnished to do so. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, // INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A // PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT // HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE // SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. // Attempts to ensure the two elements will be in the same page. // The threshold specifies how early a pagebreak should be forced. // That is, the minimum vertical space that both elements should // have available in the same page; if they have less than that // threshold, they are moved to the next page. // A higher threshold means that a pagebreak is forced earlier. // When using with tables, a threshold of at least the height // of the heading + the header row + a little bit should be used // to ensure the header rows won't be alone. // E.g. 5em could be good for a small table, but you will have to fiddle // with it (make sure to test it by pushing your table to the bottom and seeing // how early the elements are moved to the next page). #let stick-together(a, b, threshold: 3em) = { block(a + v(threshold), breakable: false) v(-1 * threshold) b }
https://github.com/AsiSkarp/grotesk-cv
https://raw.githubusercontent.com/AsiSkarp/grotesk-cv/main/src/template/content/education.typ
typst
The Unlicense
#let meta = toml("../info.toml") #import meta.import.path: education-entry #import "@preview/fontawesome:0.4.0": * #let icon = meta.section.icon.education #let language = meta.personal.language #let include-icon = meta.personal.include_icons = #if include-icon [#fa-icon(icon) #h(5pt)] #if language == "en" [Education] else if language == "es" [Educación] #v(5pt) #education-entry( degree: [M.Sc. Artifical Intelligence], date: [2006 - 2008], institution: [California Institute of Technology], location: [Pasadena, CA], ) #if language == "en" [ - *Thesis:* _"Ethical Implications of Sentient AI: When Your Machine Gets Existential."_ - *Research focus:* Autonomous systems, neural networks, and their applications in real-world scenarios (with a minor in Asimov's Laws of Robotics). #v(5pt) #education-entry( degree: [B.Sc. Computer Science], date: [2002 - 2006], institution: [University of California, Los Angeles], location: [Los Angeles, CA], ) - Specialization in software architecture and machine learning. - Extracurriculars: Member of the campus Robotics Club and AI Ethics Society. ] else if language == "es" [ - *Tesis:* _"Implicaciones éticas de la IA consciente: cuando tu máquina se vuelve existencial."_ - *Enfoque de investigación:* Sistemas autónomos, redes neuronales y sus aplicaciones en escenarios del mundo real (con una especialización en las Leyes de la Robótica de Asimov). #v(5pt) #education-entry( degree: [Licenciatura en Ciencias de la Computación], date: [2002 - 2006], institution: [Universidad de California, Los Ángeles], location: [Los Ángeles, CA], ) - Especialización en arquitectura de software y aprendizaje automático. - Actividades extracurriculares: Miembro del club de robótica del campus y de la Sociedad de Ética de la IA. ]
https://github.com/Maeeen/thesis_template_typst
https://raw.githubusercontent.com/Maeeen/thesis_template_typst/master/template/template.typ
typst
/// This file defines multiple components that can be used /// to generate a document. /// This function generates a title page for a document. Sets the title, author, and date of the document. /// *Example*: /// ```typc /// #title_page( /// title: "Why AI may not be the solution to all our problems", /// school: "École Polytechnique Fédérale de Lausanne", /// author: "<NAME>", /// type: "Master Thesis", /// address: [ /// Someplace around the world /// ], /// body: [ /// Definitely not approved by the Examining Committee: /// /// Prof. Dr. sc. ETH <NAME> \ /// Thesis Advisor /// ], /// date: datetime(year: 2024, month: 8, day: 1), /// logos: ( /// rect(width: 1in, height: 1in, fill: red), /// rect(width: 1in, height: 1in, fill: blue) /// ) /// ) /// ``` /// /// - title (string, content): The title of the document. /// - school (string, content): The name of the school. /// - author (string, content): The author of the document. /// - type (string, content): The type of the document. /// - address (list of strings, content): The address of the school. /// - body (content): The content of the title page. /// - date (datetime): Optional: the date of the document. If not provided, the current date is used. /// - logos (list of content): Optional: logos to display on the title page. /// -> content #let title_page( title: "Default Title", school: "École Polytechnique Fédérale de Lausanne", author: "The Student", type: "Master Thesis", address: [ EPFL IC IINFCOM HEXHIVE \ BC 160 (Bâtiment BC) \ Station 14 \ CH-1015 Lausanne \ ], body: [], date: none, logos: (), ) = { let date = if date == none { datetime.today() } else { date } set document(title: title, author: author, date: date) align(center)[ #if logos != none { grid( columns: logos.map(_ => 1fr), align: horizon, gutter: 1em, ..logos ) } #v(1fr) #text(school, size: 17pt) #v(2em) #text(title, size: 17pt) #v(2em) #text("by " + author, size: 14pt) #v(2fr) #text(type, size: 17pt) #v(2fr) ] body align(center)[ #address #v(1em) #text(date.display("[month repr:long] [day padding:none], [year]")) #v(1fr) ] pagebreak(weak: true) } #let vertical-separator = v(2in) /// This function generates a dedication page for a document. /// *Example*: /// ```typc /// #dedication[ /// #align(right)[ /// #quote("Follow the white rabbit...", attribution: "The Matrix", block: true) /// ] /// /// #align(center)[ /// Dedicated to my pet bunny. /// ] /// /// The dedication is usually a short inspirational quote. /// Define your dedication here. /// ]``` /// /// - body (content): The content of the dedication page. #let dedication( body ) = { pagebreak(to: "even") vertical-separator body } // --- Page counting utils --- /// The resets the page counter number #let page-number-reset = counter(page).update(1) /// Shows the page numbers #let enable-counting = { [#[]<enable-page-numbering>] } /// Hides the page numbers #let hide-counting = { [#[]<hide-page-numbering>] } /// Setups the page numbers. /// ```typc /// #show: setup-page-counting /// ``` #let setup-page-counting(r) = { set page(footer: context { let previous-enable-tags = query(selector(<enable-page-numbering>).before(here())).sorted(key: k => k.location().position().y) let previous-hide-tags = query(selector(<hide-page-numbering>).before(here())).sorted(key: k => k.location().position().y) if previous-enable-tags.len() == 0 { return none } if previous-hide-tags.len() == 0 or previous-enable-tags.last().location().position().y > previous-hide-tags.last().location().position().y { align(center)[#counter(page).display()] } }) r } // --- Page breaks --- #let new_page(body) = { vertical-separator body }
https://github.com/jgm/typst-hs
https://raw.githubusercontent.com/jgm/typst-hs/main/test/typ/compiler/ops-10.typ
typst
Other
// Test assignment operators. #let x = 0 #(x = 10) #test(x, 10) #(x -= 5) #test(x, 5) #(x += 1) #test(x, 6) #(x *= x) #test(x, 36) #(x /= 2.0) #test(x, 18.0) #(x = "some") #test(x, "some") #(x += "thing") #test(x, "something")
https://github.com/Mc-Zen/zero
https://raw.githubusercontent.com/Mc-Zen/zero/main/src/assertations.typ
typst
MIT License
/// Check that a given value is one of the given string options /// and prints a suitable error message suggesting the possible /// values. #let assert-option( /// Value to check -> any value, /// Name of the parameter -> str name, /// Possible options -> array options ) = { if value not in options { options = options.map(x => "\"" + x + "\"") if options.len() == 2 { options = options.join(" or ") } else { options = options.slice(0, -1).join(", ") + ", or " + options.last() } assert( false, message: "Expected " + options + " for `" + name + "`, got " + "\"" + value + "\"" ) } } /// Checks that a given set of `arguments` contains only named /// arguments contained in `dict`. Otherwise, the function panicks /// with a suitable error message. #let assert-settable-args(args, dict, name: none) = { if args.pos().len() != 0 { let message = "Unexpected argument: " + repr(args.pos().first()) if name != none { message += " in `" + name + "`" } assert(false, message: message) } for (arg, _) in args.named() { if arg in dict { continue } let message = "Unexpected argument: " + arg if name != none { message += " in `" + name + "`" } assert(false, message: message) } }
https://github.com/kotfind/hse-se-2-notes
https://raw.githubusercontent.com/kotfind/hse-se-2-notes/master/prob/lectures/2024-10-11.typ
typst
#import "/utils/math.typ": * = Непрерывные случайные величины Нельзя задать рядом распределения Можно задать функцией распределения #def[ #defitem[Плотность $f_xi (x)$] случайно величины --- такая неотрицательная кусочная функция, что $ forall x in R: F_xi (x) = integral_(-oo)^x f_xi (t) d t $ ] #def[ Случайные величины, для которых определена плотность определения, будем называть #defitem[непрерывными]#footnote[ На самом деле есть три вида величин: + Дискретные + Сингулярные + Абсолютно неприрывные Но мы рассматриваем только два вида ]. ] #blk(title: [*Канторова лестница*])[ Пример функции, которая непрерывна, но плотности не имеет $ F(x)= cases( 0 "," &x <= 0, 1/2 F(3 x) "," &0 <= x <= 1/3, 1/2 "," &1/3 <= x <= 2/3, 1/2 + 1/2 F(3 x - 2) "," &2/3 <= x <= 1, 1 "," &x >= 1, ) $ ] В точках дифференцируемости функции $F(x)$: $f(x) = F'(x)$ С какой вероятностью будет принято какое-то конкретное значение $x$: $ f(x) = lim_(Delta x -> 0) (F(x + Delta x) - F(x)) / (Delta x) = lim_(Delta x -> 0) P(x < xi <= x + Delta x) / (Delta x) $ $ f(x) Delta x underbrace(=, Delta x -> 0) P(x < xi <= x + Delta x) $ Итого, ответ 0 == Свойства плотности распределения - $forall x: f(x) >= 0$ - $integral_(-oo)^(oo) f(x) d x = F(+oo) = 1$ - $integral_(x_1)^(x_2) f(x) d x = F(x_2) - F(x_1) = P(x_1 < xi <= x_2)$ - Пусть СВ $xi$ имеет плотность распределения $f_xi (x)$, а функция $phi(x)$ --- монотонная, дифференцируемая, детерминированная. СВ $eta = phi(xi)$. $f_eta (y) = ?$: + Пусть $phi(x)$ --- монотонно возрастающая $ F_eta (y) = P(eta <= y) = P(phi(xi) <= y) = P(xi <= phi^(-1) (y)) = F_xi (phi^(-1) (y)) $ $ f_eta (y) = (F_eta (y))' = f_eta (phi^(-1) (y)) (phi^(-1) (y)) $ + Пусть $phi(x)$ --- монотонно убывающая $ F_eta (y) = P(eta <= y) = P(phi(xi) <= y) = P(xi >= phi^(-1) (y)) = 1 - F_xi (phi^(-1) (y)) $ $ f_eta (y) = (F_eta (y))' = -f_eta (phi^(-1) (y)) underbrace((phi^(-1) (y)), <0) $ + *Итого*, $f_eta (y) = f_xi (phi^(-1) (y)) abs((phi^(-1) (y))')$ - Если функция не монотонная, то нужно разделить её на интервалы монотонности и применить прошлый пункт == Числовые характеристики === Математическое ожидание #def[ #defitem[Математическим ожиданием] непрерывной случайной величины $xi$ называется число $ E xi = integral^(oo)_(-oo) x f_xi (x) d x, $ если интеграл сходится абсолютно: $ E xi = integral^(oo)_(-oo) abs(x) f_xi (x) d x. $ Для бесконечностей: - Если $f(x) > 0$ только при $x > 0$ и $integral^(oo)_(-oo) x f_xi (x) d x$ расходится, то $E xi = +oo$ - Если $f(x) > 0$ только при $x < 0$ и $integral^(oo)_(-oo) x f_xi (x) d x$ расходится, то $E xi = -oo$ ] ==== Свойства математического ожидания + $E c = c$ + $E(c xi) = c E(xi)$ + Если $a <= xi <= b$, то $a <= E xi <= b$. + $E(xi_1 + xi_2) = E(xi_1) + E(xi_2)$ + Пусть $eta = phi(xi)$, где $phi$ --- детерминированная функция, тогда $E eta = integral_(-oo)^(oo) phi(x) f_xi (x) d x$ == Квантиль #def[ Число $z_gamma, 0 < gamma < 1$ называется #defitem[$gamma$-квантилью] непрерывного строго монотонного распределения $F_xi (x)$, если $underbrace(F_xi (z_gamma), = P(xi <= z_gamma)) = gamma$ Для непрерывного распределения верно: $ integral_(-oo)^(z_gamma) f_xi (x) d x = gamma $ Для дискретных величин в качестве квантили берут минимальное подходящее число: $ z_gamma = min { x : F(x) >= gamma } $ ] Если $forall x: f(-x) = f(x)$, то $z_gamma = -z_(1 - gamma)$. #def[ Квантиль уровня $0.5$ называется #defitem[медианой]. ] #def[ Квантили уровня $0.25$ и $0.75$ называются #defitem[нижним и верхним квартилью]. ] == Часто встречающиеся непрерывные распределения === Равномерное на интервале $(a; b)$ $ xi ~ R(a, b) $ $ f(x) = cases( 0 "," &x in.not (a, b), 1/(b - a) "," &x in (a, b), ) $ $ E xi = integral_a^b x dot 1/(b - a) d x = (a + b) / 2 $ $ D xi = E xi^2 - (E xi)^2 = integral_a^b x^2 / (b - a) d x - ((a + b) / 2)^2 = (b - a)^2 / 12 $ $ F(x) = integral_(-oo)^x f(t) d = cases( 0 "," & x <= a, integral_(-oo)^a 0 d t + integral_a^x 1/(b - a) d t = (x - a) / (b - a) "," & x in (a, b), underbrace(integral_(-oo)^a 0 d t, = 0) + underbrace(integral_a^x 1/(b - a) d t, = 1) + underbrace(integral_b^x 0 d t, = 0) = 1 "," & x >= b ) $
https://github.com/frectonz/the-pg-book
https://raw.githubusercontent.com/frectonz/the-pg-book/main/book/196.%20worked.html.typ
typst
worked.html What I Worked On February 2021Before college the two main things I worked on, outside of school, were writing and programming. I didn't write essays. I wrote what beginning writers were supposed to write then, and probably still are: short stories. My stories were awful. They had hardly any plot, just characters with strong feelings, which I imagined made them deep.The first programs I tried writing were on the IBM 1401 that our school district used for what was then called "data processing." This was in 9th grade, so I was 13 or 14. The school district's 1401 happened to be in the basement of our junior high school, and my friend <NAME> and I got permission to use it. It was like a mini Bond villain's lair down there, with all these alien-looking machines � CPU, disk drives, printer, card reader � sitting up on a raised floor under bright fluorescent lights.The language we used was an early version of Fortran. You had to type programs on punch cards, then stack them in the card reader and press a button to load the program into memory and run it. The result would ordinarily be to print something on the spectacularly loud printer.I was puzzled by the 1401. I couldn't figure out what to do with it. And in retrospect there's not much I could have done with it. The only form of input to programs was data stored on punched cards, and I didn't have any data stored on punched cards. The only other option was to do things that didn't rely on any input, like calculate approximations of pi, but I didn't know enough math to do anything interesting of that type. So I'm not surprised I can't remember any programs I wrote, because they can't have done much. My clearest memory is of the moment I learned it was possible for programs not to terminate, when one of mine didn't. On a machine without time-sharing, this was a social as well as a technical error, as the data center manager's expression made clear.With microcomputers, everything changed. Now you could have a computer sitting right in front of you, on a desk, that could respond to your keystrokes as it was running instead of just churning through a stack of punch cards and then stopping. [1]The first of my friends to get a microcomputer built it himself. It was sold as a kit by Heathkit. I remember vividly how impressed and envious I felt watching him sitting in front of it, typing programs right into the computer.Computers were expensive in those days and it took me years of nagging before I convinced my father to buy one, a TRS-80, in about 1980. The gold standard then was the Apple II, but a TRS-80 was good enough. This was when I really started programming. I wrote simple games, a program to predict how high my model rockets would fly, and a word processor that my father used to write at least one book. There was only room in memory for about 2 pages of text, so he'd write 2 pages at a time and then print them out, but it was a lot better than a typewriter.Though I liked programming, I didn't plan to study it in college. In college I was going to study philosophy, which sounded much more powerful. It seemed, to my naive high school self, to be the study of the ultimate truths, compared to which the things studied in other fields would be mere domain knowledge. What I discovered when I got to college was that the other fields took up so much of the space of ideas that there wasn't much left for these supposed ultimate truths. All that seemed left for philosophy were edge cases that people in other fields felt could safely be ignored.I couldn't have put this into words when I was 18. All I knew at the time was that I kept taking philosophy courses and they kept being boring. So I decided to switch to AI.AI was in the air in the mid 1980s, but there were two things especially that made me want to work on it: a novel by Heinlein called The Moon is a Harsh Mistress, which featured an intelligent computer called Mike, and a PBS documentary that showed Terry Winograd using SHRDLU. I haven't tried rereading The Moon is a Harsh Mistress, so I don't know how well it has aged, but when I read it I was drawn entirely into its world. It seemed only a matter of time before we'd have Mike, and when I saw Winograd using SHRDLU, it seemed like that time would be a few years at most. All you had to do was teach SHRDLU more words.There weren't any classes in AI at Cornell then, not even graduate classes, so I started trying to teach myself. Which meant learning Lisp, since in those days Lisp was regarded as the language of AI. The commonly used programming languages then were pretty primitive, and programmers' ideas correspondingly so. The default language at Cornell was a Pascal-like language called PL/I, and the situation was similar elsewhere. Learning Lisp expanded my concept of a program so fast that it was years before I started to have a sense of where the new limits were. This was more like it; this was what I had expected college to do. It wasn't happening in a class, like it was supposed to, but that was ok. For the next couple years I was on a roll. I knew what I was going to do.For my undergraduate thesis, I reverse-engineered SHRDLU. My God did I love working on that program. It was a pleasing bit of code, but what made it even more exciting was my belief � hard to imagine now, but not unique in 1985 � that it was already climbing the lower slopes of intelligence.I had gotten into a program at Cornell that didn't make you choose a major. You could take whatever classes you liked, and choose whatever you liked to put on your degree. I of course chose "Artificial Intelligence." When I got the actual physical diploma, I was dismayed to find that the quotes had been included, which made them read as scare-quotes. At the time this bothered me, but now it seems amusingly accurate, for reasons I was about to discover.I applied to 3 grad schools: MIT and Yale, which were renowned for AI at the time, and Harvard, which I'd visited because <NAME> went there, and was also home to <NAME>, who'd invented the type of parser I used in my SHRDLU clone. Only Harvard accepted me, so that was where I went.I don't remember the moment it happened, or if there even was a specific moment, but during the first year of grad school I realized that AI, as practiced at the time, was a hoax. By which I mean the sort of AI in which a program that's told "the dog is sitting on the chair" translates this into some formal representation and adds it to the list of things it knows.What these programs really showed was that there's a subset of natural language that's a formal language. But a very proper subset. It was clear that there was an unbridgeable gap between what they could do and actually understanding natural language. It was not, in fact, simply a matter of teaching SHRDLU more words. That whole way of doing AI, with explicit data structures representing concepts, was not going to work. Its brokenness did, as so often happens, generate a lot of opportunities to write papers about various band-aids that could be applied to it, but it was never going to get us Mike.So I looked around to see what I could salvage from the wreckage of my plans, and there was Lisp. I knew from experience that Lisp was interesting for its own sake and not just for its association with AI, even though that was the main reason people cared about it at the time. So I decided to focus on Lisp. In fact, I decided to write a book about Lisp hacking. It's scary to think how little I knew about Lisp hacking when I started writing that book. But there's nothing like writing a book about something to help you learn it. The book, On Lisp, wasn't published till 1993, but I wrote much of it in grad school.Computer Science is an uneasy alliance between two halves, theory and systems. The theory people prove things, and the systems people build things. I wanted to build things. I had plenty of respect for theory � indeed, a sneaking suspicion that it was the more admirable of the two halves � but building things seemed so much more exciting.The problem with systems work, though, was that it didn't last. Any program you wrote today, no matter how good, would be obsolete in a couple decades at best. People might mention your software in footnotes, but no one would actually use it. And indeed, it would seem very feeble work. Only people with a sense of the history of the field would even realize that, in its time, it had been good.There were some surplus Xerox Dandelions floating around the computer lab at one point. Anyone who wanted one to play around with could have one. I was briefly tempted, but they were so slow by present standards; what was the point? No one else wanted one either, so off they went. That was what happened to systems work.I wanted not just to build things, but to build things that would last.In this dissatisfied state I went in 1988 to visit <NAME> at CMU, where he was in grad school. One day I went to visit the Carnegie Institute, where I'd spent a lot of time as a kid. While looking at a painting there I realized something that might seem obvious, but was a big surprise to me. There, right on the wall, was something you could make that would last. Paintings didn't become obsolete. Some of the best ones were hundreds of years old.And moreover this was something you could make a living doing. Not as easily as you could by writing software, of course, but I thought if you were really industrious and lived really cheaply, it had to be possible to make enough to survive. And as an artist you could be truly independent. You wouldn't have a boss, or even need to get research funding.I had always liked looking at paintings. Could I make them? I had no idea. I'd never imagined it was even possible. I knew intellectually that people made art � that it didn't just appear spontaneously � but it was as if the people who made it were a different species. They either lived long ago or were mysterious geniuses doing strange things in profiles in Life magazine. The idea of actually being able to make art, to put that verb before that noun, seemed almost miraculous.That fall I started taking art classes at Harvard. Grad students could take classes in any department, and my advisor, <NAME>, was very easy going. If he even knew about the strange classes I was taking, he never said anything.So now I was in a PhD program in computer science, yet planning to be an artist, yet also genuinely in love with Lisp hacking and working away at On Lisp. In other words, like many a grad student, I was working energetically on multiple projects that were not my thesis.I didn't see a way out of this situation. I didn't want to drop out of grad school, but how else was I going to get out? I remember when my friend <NAME> got kicked out of Cornell for writing the internet worm of 1988, I was envious that he'd found such a spectacular way to get out of grad school.Then one day in April 1990 a crack appeared in the wall. I ran into professor Cheatham and he asked if I was far enough along to graduate that June. I didn't have a word of my dissertation written, but in what must have been the quickest bit of thinking in my life, I decided to take a shot at writing one in the 5 weeks or so that remained before the deadline, reusing parts of On Lisp where I could, and I was able to respond, with no perceptible delay "Yes, I think so. I'll give you something to read in a few days."I picked applications of continuations as the topic. In retrospect I should have written about macros and embedded languages. There's a whole world there that's barely been explored. But all I wanted was to get out of grad school, and my rapidly written dissertation sufficed, just barely.Meanwhile I was applying to art schools. I applied to two: RISD in the US, and the Accademia di Belli Arti in Florence, which, because it was the oldest art school, I imagined would be good. RISD accepted me, and I never heard back from the Accademia, so off to Providence I went.I'd applied for the BFA program at RISD, which meant in effect that I had to go to college again. This was not as strange as it sounds, because I was only 25, and art schools are full of people of different ages. RISD counted me as a transfer sophomore and said I had to do the foundation that summer. The foundation means the classes that everyone has to take in fundamental subjects like drawing, color, and design.Toward the end of the summer I got a big surprise: a letter from the Accademia, which had been delayed because they'd sent it to Cambridge England instead of Cambridge Massachusetts, inviting me to take the entrance exam in Florence that fall. This was now only weeks away. My nice landlady let me leave my stuff in her attic. I had some money saved from consulting work I'd done in grad school; there was probably enough to last a year if I lived cheaply. Now all I had to do was learn Italian.Only stranieri (foreigners) had to take this entrance exam. In retrospect it may well have been a way of excluding them, because there were so many stranieri attracted by the idea of studying art in Florence that the Italian students would otherwise have been outnumbered. I was in decent shape at painting and drawing from the RISD foundation that summer, but I still don't know how I managed to pass the written exam. I remember that I answered the essay question by writing about Cezanne, and that I cranked up the intellectual level as high as I could to make the most of my limited vocabulary. [2]I'm only up to age 25 and already there are such conspicuous patterns. Here I was, yet again about to attend some august institution in the hopes of learning about some prestigious subject, and yet again about to be disappointed. The students and faculty in the painting department at the Accademia were the nicest people you could imagine, but they had long since arrived at an arrangement whereby the students wouldn't require the faculty to teach anything, and in return the faculty wouldn't require the students to learn anything. And at the same time all involved would adhere outwardly to the conventions of a 19th century atelier. We actually had one of those little stoves, fed with kindling, that you see in 19th century studio paintings, and a nude model sitting as close to it as possible without getting burned. Except hardly anyone else painted her besides me. The rest of the students spent their time chatting or occasionally trying to imitate things they'd seen in American art magazines.Our model turned out to live just down the street from me. She made a living from a combination of modelling and making fakes for a local antique dealer. She'd copy an obscure old painting out of a book, and then he'd take the copy and maltreat it to make it look old. [3]While I was a student at the Accademia I started painting still lives in my bedroom at night. These paintings were tiny, because the room was, and because I painted them on leftover scraps of canvas, which was all I could afford at the time. Painting still lives is different from painting people, because the subject, as its name suggests, can't move. People can't sit for more than about 15 minutes at a time, and when they do they don't sit very still. So the traditional m.o. for painting people is to know how to paint a generic person, which you then modify to match the specific person you're painting. Whereas a still life you can, if you want, copy pixel by pixel from what you're seeing. You don't want to stop there, of course, or you get merely photographic accuracy, and what makes a still life interesting is that it's been through a head. You want to emphasize the visual cues that tell you, for example, that the reason the color changes suddenly at a certain point is that it's the edge of an object. By subtly emphasizing such things you can make paintings that are more realistic than photographs not just in some metaphorical sense, but in the strict information-theoretic sense. [4]I liked painting still lives because I was curious about what I was seeing. In everyday life, we aren't consciously aware of much we're seeing. Most visual perception is handled by low-level processes that merely tell your brain "that's a water droplet" without telling you details like where the lightest and darkest points are, or "that's a bush" without telling you the shape and position of every leaf. This is a feature of brains, not a bug. In everyday life it would be distracting to notice every leaf on every bush. But when you have to paint something, you have to look more closely, and when you do there's a lot to see. You can still be noticing new things after days of trying to paint something people usually take for granted, just as you can after days of trying to write an essay about something people usually take for granted.This is not the only way to paint. I'm not 100% sure it's even a good way to paint. But it seemed a good enough bet to be worth trying.Our teacher, professor Ulivi, was a nice guy. He could see I worked hard, and gave me a good grade, which he wrote down in a sort of passport each student had. But the Accademia wasn't teaching me anything except Italian, and my money was running out, so at the end of the first year I went back to the US.I wanted to go back to RISD, but I was now broke and RISD was very expensive, so I decided to get a job for a year and then return to RISD the next fall. I got one at a company called Interleaf, which made software for creating documents. You mean like Microsoft Word? Exactly. That was how I learned that low end software tends to eat high end software. But Interleaf still had a few years to live yet. [5]Interleaf had done something pretty bold. Inspired by Emacs, they'd added a scripting language, and even made the scripting language a dialect of Lisp. Now they wanted a Lisp hacker to write things in it. This was the closest thing I've had to a normal job, and I hereby apologize to my boss and coworkers, because I was a bad employee. Their Lisp was the thinnest icing on a giant C cake, and since I didn't know C and didn't want to learn it, I never understood most of the software. Plus I was terribly irresponsible. This was back when a programming job meant showing up every day during certain working hours. That seemed unnatural to me, and on this point the rest of the world is coming around to my way of thinking, but at the time it caused a lot of friction. Toward the end of the year I spent much of my time surreptitiously working on On Lisp, which I had by this time gotten a contract to publish.The good part was that I got paid huge amounts of money, especially by art student standards. In Florence, after paying my part of the rent, my budget for everything else had been $7 a day. Now I was getting paid more than 4 times that every hour, even when I was just sitting in a meeting. By living cheaply I not only managed to save enough to go back to RISD, but also paid off my college loans.I learned some useful things at Interleaf, though they were mostly about what not to do. I learned that it's better for technology companies to be run by product people than sales people (though sales is a real skill and people who are good at it are really good at it), that it leads to bugs when code is edited by too many people, that cheap office space is no bargain if it's depressing, that planned meetings are inferior to corridor conversations, that big, bureaucratic customers are a dangerous source of money, and that there's not much overlap between conventional office hours and the optimal time for hacking, or conventional offices and the optimal place for it.But the most important thing I learned, and which I used in both Viaweb and Y Combinator, is that the low end eats the high end: that it's good to be the "entry level" option, even though that will be less prestigious, because if you're not, someone else will be, and will squash you against the ceiling. Which in turn means that prestige is a danger sign.When I left to go back to RISD the next fall, I arranged to do freelance work for the group that did projects for customers, and this was how I survived for the next several years. When I came back to visit for a project later on, someone told me about a new thing called HTML, which was, as he described it, a derivative of SGML. Markup language enthusiasts were an occupational hazard at Interleaf and I ignored him, but this HTML thing later became a big part of my life.In the fall of 1992 I moved back to Providence to continue at RISD. The foundation had merely been intro stuff, and the Accademia had been a (very civilized) joke. Now I was going to see what real art school was like. But alas it was more like the Accademia than not. Better organized, certainly, and a lot more expensive, but it was now becoming clear that art school did not bear the same relationship to art that medical school bore to medicine. At least not the painting department. The textile department, which my next door neighbor belonged to, seemed to be pretty rigorous. No doubt illustration and architecture were too. But painting was post-rigorous. Painting students were supposed to express themselves, which to the more worldly ones meant to try to cook up some sort of distinctive signature style.A signature style is the visual equivalent of what in show business is known as a "schtick": something that immediately identifies the work as yours and no one else's. For example, when you see a painting that looks like a certain kind of cartoon, you know it's by <NAME>. So if you see a big painting of this type hanging in the apartment of a hedge fund manager, you know he paid millions of dollars for it. That's not always why artists have a signature style, but it's usually why buyers pay a lot for such work. [6]There were plenty of earnest students too: kids who "could draw" in high school, and now had come to what was supposed to be the best art school in the country, to learn to draw even better. They tended to be confused and demoralized by what they found at RISD, but they kept going, because painting was what they did. I was not one of the kids who could draw in high school, but at RISD I was definitely closer to their tribe than the tribe of signature style seekers.I learned a lot in the color class I took at RISD, but otherwise I was basically teaching myself to paint, and I could do that for free. So in 1993 I dropped out. I hung around Providence for a bit, and then my college friend <NAME> did me a big favor. A rent-controlled apartment in a building her mother owned in New York was becoming vacant. Did I want it? It wasn't much more than my current place, and New York was supposed to be where the artists were. So yes, I wanted it! [7]Asterix comics begin by zooming in on a tiny corner of Roman Gaul that turns out not to be controlled by the Romans. You can do something similar on a map of New York City: if you zoom in on the Upper East Side, there's a tiny corner that's not rich, or at least wasn't in 1993. It's called Yorkville, and that was my new home. Now I was a New York artist � in the strictly technical sense of making paintings and living in New York.I was nervous about money, because I could sense that Interleaf was on the way down. Freelance Lisp hacking work was very rare, and I didn't want to have to program in another language, which in those days would have meant C++ if I was lucky. So with my unerring nose for financial opportunity, I decided to write another book on Lisp. This would be a popular book, the sort of book that could be used as a textbook. I imagined myself living frugally off the royalties and spending all my time painting. (The painting on the cover of this book, ANSI Common Lisp, is one that I painted around this time.)The best thing about New York for me was the presence of Idelle and <NAME>. <NAME> was a painter, one of the early photorealists, and I'd taken her painting class at Harvard. I've never known a teacher more beloved by her students. Large numbers of former students kept in touch with her, including me. After I moved to New York I became her de facto studio assistant.She liked to paint on big, square canvases, 4 to 5 feet on a side. One day in late 1994 as I was stretching one of these monsters there was something on the radio about a famous fund manager. He wasn't that much older than me, and was super rich. The thought suddenly occurred to me: why don't I become rich? Then I'll be able to work on whatever I want.Meanwhile I'd been hearing more and more about this new thing called the World Wide Web. <NAME> showed it to me when I visited him in Cambridge, where he was now in grad school at Harvard. It seemed to me that the web would be a big deal. I'd seen what graphical user interfaces had done for the popularity of microcomputers. It seemed like the web would do the same for the internet.If I wanted to get rich, here was the next train leaving the station. I was right about that part. What I got wrong was the idea. I decided we should start a company to put art galleries online. I can't honestly say, after reading so many Y Combinator applications, that this was the worst startup idea ever, but it was up there. Art galleries didn't want to be online, and still don't, not the fancy ones. That's not how they sell. I wrote some software to generate web sites for galleries, and Robert wrote some to resize images and set up an http server to serve the pages. Then we tried to sign up galleries. To call this a difficult sale would be an understatement. It was difficult to give away. A few galleries let us make sites for them for free, but none paid us.Then some online stores started to appear, and I realized that except for the order buttons they were identical to the sites we'd been generating for galleries. This impressive-sounding thing called an "internet storefront" was something we already knew how to build.So in the summer of 1995, after I submitted the camera-ready copy of ANSI Common Lisp to the publishers, we started trying to write software to build online stores. At first this was going to be normal desktop software, which in those days meant Windows software. That was an alarming prospect, because neither of us knew how to write Windows software or wanted to learn. We lived in the Unix world. But we decided we'd at least try writing a prototype store builder on Unix. Robert wrote a shopping cart, and I wrote a new site generator for stores � in Lisp, of course.We were working out of Robert's apartment in Cambridge. His roommate was away for big chunks of time, during which I got to sleep in his room. For some reason there was no bed frame or sheets, just a mattress on the floor. One morning as I was lying on this mattress I had an idea that made me sit up like a capital L. What if we ran the software on the server, and let users control it by clicking on links? Then we'd never have to write anything to run on users' computers. We could generate the sites on the same server we'd serve them from. Users wouldn't need anything more than a browser.This kind of software, known as a web app, is common now, but at the time it wasn't clear that it was even possible. To find out, we decided to try making a version of our store builder that you could control through the browser. A couple days later, on August 12, we had one that worked. The UI was horrible, but it proved you could build a whole store through the browser, without any client software or typing anything into the command line on the server.Now we felt like we were really onto something. I had visions of a whole new generation of software working this way. You wouldn't need versions, or ports, or any of that crap. At Interleaf there had been a whole group called Release Engineering that seemed to be at least as big as the group that actually wrote the software. Now you could just update the software right on the server.We started a new company we called Viaweb, after the fact that our software worked via the web, and we got $10,000 in seed funding from Idelle's husband Julian. In return for that and doing the initial legal work and giving us business advice, we gave him 10% of the company. Ten years later this deal became the model for Y Combinator's. We knew founders needed something like this, because we'd needed it ourselves.At this stage I had a negative net worth, because the thousand dollars or so I had in the bank was more than counterbalanced by what I owed the government in taxes. (Had I diligently set aside the proper proportion of the money I'd made consulting for Interleaf? No, I had not.) So although Robert had his graduate student stipend, I needed that seed funding to live on.We originally hoped to launch in September, but we got more ambitious about the software as we worked on it. Eventually we managed to build a WYSIWYG site builder, in the sense that as you were creating pages, they looked exactly like the static ones that would be generated later, except that instead of leading to static pages, the links all referred to closures stored in a hash table on the server.It helped to have studied art, because the main goal of an online store builder is to make users look legit, and the key to looking legit is high production values. If you get page layouts and fonts and colors right, you can make a guy running a store out of his bedroom look more legit than a big company.(If you're curious why my site looks so old-fashioned, it's because it's still made with this software. It may look clunky today, but in 1996 it was the last word in slick.)In September, Robert rebelled. "We've been working on this for a month," he said, "and it's still not done." This is funny in retrospect, because he would still be working on it almost 3 years later. But I decided it might be prudent to recruit more programmers, and I asked Robert who else in grad school with him was really good. He recommended <NAME>, which surprised me at first, because at that point I knew Trevor mainly for his plan to reduce everything in his life to a stack of notecards, which he carried around with him. But Rtm was right, as usual. Trevor turned out to be a frighteningly effective hacker.It was a lot of fun working with Robert and Trevor. They're the two most independent-minded people I know, and in completely different ways. If you could see inside Rtm's brain it would look like a colonial New England church, and if you could see inside Trevor's it would look like the worst excesses of Austrian Rococo.We opened for business, with 6 stores, in January 1996. It was just as well we waited a few months, because although we worried we were late, we were actually almost fatally early. There was a lot of talk in the press then about ecommerce, but not many people actually wanted online stores. [8]There were three main parts to the software: the editor, which people used to build sites and which I wrote, the shopping cart, which Robert wrote, and the manager, which kept track of orders and statistics, and which Trevor wrote. In its time, the editor was one of the best general-purpose site builders. I kept the code tight and didn't have to integrate with any other software except Robert's and Trevor's, so it was quite fun to work on. If all I'd had to do was work on this software, the next 3 years would have been the easiest of my life. Unfortunately I had to do a lot more, all of it stuff I was worse at than programming, and the next 3 years were instead the most stressful.There were a lot of startups making ecommerce software in the second half of the 90s. We were determined to be the Microsoft Word, not the Interleaf. Which meant being easy to use and inexpensive. It was lucky for us that we were poor, because that caused us to make Viaweb even more inexpensive than we realized. We charged $100 a month for a small store and $300 a month for a big one. This low price was a big attraction, and a constant thorn in the sides of competitors, but it wasn't because of some clever insight that we set the price low. We had no idea what businesses paid for things. $300 a month seemed like a lot of money to us.We did a lot of things right by accident like that. For example, we did what's now called "doing things that don't scale," although at the time we would have described it as "being so lame that we're driven to the most desperate measures to get users." The most common of which was building stores for them. This seemed particularly humiliating, since the whole raison d'etre of our software was that people could use it to make their own stores. But anything to get users.We learned a lot more about retail than we wanted to know. For example, that if you could only have a small image of a man's shirt (and all images were small then by present standards), it was better to have a closeup of the collar than a picture of the whole shirt. The reason I remember learning this was that it meant I had to rescan about 30 images of men's shirts. My first set of scans were so beautiful too.Though this felt wrong, it was exactly the right thing to be doing. Building stores for users taught us about retail, and about how it felt to use our software. I was initially both mystified and repelled by "business" and thought we needed a "business person" to be in charge of it, but once we started to get users, I was converted, in much the same way I was converted to fatherhood once I had kids. Whatever users wanted, I was all theirs. Maybe one day we'd have so many users that I couldn't scan their images for them, but in the meantime there was nothing more important to do.Another thing I didn't get at the time is that growth rate is the ultimate test of a startup. Our growth rate was fine. We had about 70 stores at the end of 1996 and about 500 at the end of 1997. I mistakenly thought the thing that mattered was the absolute number of users. And that is the thing that matters in the sense that that's how much money you're making, and if you're not making enough, you might go out of business. But in the long term the growth rate takes care of the absolute number. If we'd been a startup I was advising at Y Combinator, I would have said: Stop being so stressed out, because you're doing fine. You're growing 7x a year. Just don't hire too many more people and you'll soon be profitable, and then you'll control your own destiny.Alas I hired lots more people, partly because our investors wanted me to, and partly because that's what startups did during the Internet Bubble. A company with just a handful of employees would have seemed amateurish. So we didn't reach breakeven until about when Yahoo bought us in the summer of 1998. Which in turn meant we were at the mercy of investors for the entire life of the company. And since both we and our investors were noobs at startups, the result was a mess even by startup standards.It was a huge relief when Yahoo bought us. In principle our Viaweb stock was valuable. It was a share in a business that was profitable and growing rapidly. But it didn't feel very valuable to me; I had no idea how to value a business, but I was all too keenly aware of the near-death experiences we seemed to have every few months. Nor had I changed my grad student lifestyle significantly since we started. So when Yahoo bought us it felt like going from rags to riches. Since we were going to California, I bought a car, a yellow 1998 VW GTI. I remember thinking that its leather seats alone were by far the most luxurious thing I owned.The next year, from the summer of 1998 to the summer of 1999, must have been the least productive of my life. I didn't realize it at the time, but I was worn out from the effort and stress of running Viaweb. For a while after I got to California I tried to continue my usual m.o. of programming till 3 in the morning, but fatigue combined with Yahoo's prematurely aged culture and grim cube farm in Santa Clara gradually dragged me down. After a few months it felt disconcertingly like working at Interleaf.Yahoo had given us a lot of options when they bought us. At the time I thought Yahoo was so overvalued that they'd never be worth anything, but to my astonishment the stock went up 5x in the next year. I hung on till the first chunk of options vested, then in the summer of 1999 I left. It had been so long since I'd painted anything that I'd half forgotten why I was doing this. My brain had been entirely full of software and men's shirts for 4 years. But I had done this to get rich so I could paint, I reminded myself, and now I was rich, so I should go paint.When I said I was leaving, my boss at Yahoo had a long conversation with me about my plans. I told him all about the kinds of pictures I wanted to paint. At the time I was touched that he took such an interest in me. Now I realize it was because he thought I was lying. My options at that point were worth about $2 million a month. If I was leaving that kind of money on the table, it could only be to go and start some new startup, and if I did, I might take people with me. This was the height of the Internet Bubble, and Yahoo was ground zero of it. My boss was at that moment a billionaire. Leaving then to start a new startup must have seemed to him an insanely, and yet also plausibly, ambitious plan.But I really was quitting to paint, and I started immediately. There was no time to lose. I'd already burned 4 years getting rich. Now when I talk to founders who are leaving after selling their companies, my advice is always the same: take a vacation. That's what I should have done, just gone off somewhere and done nothing for a month or two, but the idea never occurred to me.So I tried to paint, but I just didn't seem to have any energy or ambition. Part of the problem was that I didn't know many people in California. I'd compounded this problem by buying a house up in the Santa Cruz Mountains, with a beautiful view but miles from anywhere. I stuck it out for a few more months, then in desperation I went back to New York, where unless you understand about rent control you'll be surprised to hear I still had my apartment, sealed up like a tomb of my old life. Idelle was in New York at least, and there were other people trying to paint there, even though I didn't know any of them.When I got back to New York I resumed my old life, except now I was rich. It was as weird as it sounds. I resumed all my old patterns, except now there were doors where there hadn't been. Now when I was tired of walking, all I had to do was raise my hand, and (unless it was raining) a taxi would stop to pick me up. Now when I walked past charming little restaurants I could go in and order lunch. It was exciting for a while. Painting started to go better. I experimented with a new kind of still life where I'd paint one painting in the old way, then photograph it and print it, blown up, on canvas, and then use that as the underpainting for a second still life, painted from the same objects (which hopefully hadn't rotted yet).Meanwhile I looked for an apartment to buy. Now I could actually choose what neighborhood to live in. Where, I asked myself and various real estate agents, is the Cambridge of New York? Aided by occasional visits to actual Cambridge, I gradually realized there wasn't one. Huh.Around this time, in the spring of 2000, I had an idea. It was clear from our experience with Viaweb that web apps were the future. Why not build a web app for making web apps? Why not let people edit code on our server through the browser, and then host the resulting applications for them? [9] You could run all sorts of services on the servers that these applications could use just by making an API call: making and receiving phone calls, manipulating images, taking credit card payments, etc.I got so excited about this idea that I couldn't think about anything else. It seemed obvious that this was the future. I didn't particularly want to start another company, but it was clear that this idea would have to be embodied as one, so I decided to move to Cambridge and start it. I hoped to lure Robert into working on it with me, but there I ran into a hitch. Robert was now a postdoc at MIT, and though he'd made a lot of money the last time I'd lured him into working on one of my schemes, it had also been a huge time sink. So while he agreed that it sounded like a plausible idea, he firmly refused to work on it.Hmph. Well, I'd do it myself then. I recruited <NAME>, who had worked for Viaweb, and two undergrads who wanted summer jobs, and we got to work trying to build what it's now clear is about twenty companies and several open source projects worth of software. The language for defining applications would of course be a dialect of Lisp. But I wasn't so naive as to assume I could spring an overt Lisp on a general audience; we'd hide the parentheses, like Dylan did.By then there was a name for the kind of company Viaweb was, an "application service provider," or ASP. This name didn't last long before it was replaced by "software as a service," but it was current for long enough that I named this new company after it: it was going to be called Aspra.I started working on the application builder, Dan worked on network infrastructure, and the two undergrads worked on the first two services (images and phone calls). But about halfway through the summer I realized I really didn't want to run a company � especially not a big one, which it was looking like this would have to be. I'd only started Viaweb because I needed the money. Now that I didn't need money anymore, why was I doing this? If this vision had to be realized as a company, then screw the vision. I'd build a subset that could be done as an open source project.Much to my surprise, the time I spent working on this stuff was not wasted after all. After we started Y Combinator, I would often encounter startups working on parts of this new architecture, and it was very useful to have spent so much time thinking about it and even trying to write some of it.The subset I would build as an open source project was the new Lisp, whose parentheses I now wouldn't even have to hide. A lot of Lisp hackers dream of building a new Lisp, partly because one of the distinctive features of the language is that it has dialects, and partly, I think, because we have in our minds a Platonic form of Lisp that all existing dialects fall short of. I certainly did. So at the end of the summer Dan and I switched to working on this new dialect of Lisp, which I called Arc, in a house I bought in Cambridge.The following spring, lightning struck. I was invited to give a talk at a Lisp conference, so I gave one about how we'd used Lisp at Viaweb. Afterward I put a postscript file of this talk online, on paulgraham.com, which I'd created years before using Viaweb but had never used for anything. In one day it got 30,000 page views. What on earth had happened? The referring urls showed that someone had posted it on Slashdot. [10]Wow, I thought, there's an audience. If I write something and put it on the web, anyone can read it. That may seem obvious now, but it was surprising then. In the print era there was a narrow channel to readers, guarded by fierce monsters known as editors. The only way to get an audience for anything you wrote was to get it published as a book, or in a newspaper or magazine. Now anyone could publish anything.This had been possible in principle since 1993, but not many people had realized it yet. I had been intimately involved with building the infrastructure of the web for most of that time, and a writer as well, and it had taken me 8 years to realize it. Even then it took me several years to understand the implications. It meant there would be a whole new generation of essays. [11]In the print era, the channel for publishing essays had been vanishingly small. Except for a few officially anointed thinkers who went to the right parties in New York, the only people allowed to publish essays were specialists writing about their specialties. There were so many essays that had never been written, because there had been no way to publish them. Now they could be, and I was going to write them. [12]I've worked on several different things, but to the extent there was a turning point where I figured out what to work on, it was when I started publishing essays online. From then on I knew that whatever else I did, I'd always write essays too.I knew that online essays would be a marginal medium at first. Socially they'd seem more like rants posted by nutjobs on their GeoCities sites than the genteel and beautifully typeset compositions published in The New Yorker. But by this point I knew enough to find that encouraging instead of discouraging.One of the most conspicuous patterns I've noticed in my life is how well it has worked, for me at least, to work on things that weren't prestigious. Still life has always been the least prestigious form of painting. Viaweb and Y Combinator both seemed lame when we started them. I still get the glassy eye from strangers when they ask what I'm writing, and I explain that it's an essay I'm going to publish on my web site. Even Lisp, though prestigious intellectually in something like the way Latin is, also seems about as hip.It's not that unprestigious types of work are good per se. But when you find yourself drawn to some kind of work despite its current lack of prestige, it's a sign both that there's something real to be discovered there, and that you have the right kind of motives. Impure motives are a big danger for the ambitious. If anything is going to lead you astray, it will be the desire to impress people. So while working on things that aren't prestigious doesn't guarantee you're on the right track, it at least guarantees you're not on the most common type of wrong one.Over the next several years I wrote lots of essays about all kinds of different topics. O'Reilly reprinted a collection of them as a book, called Hackers & Painters after one of the essays in it. I also worked on spam filters, and did some more painting. I used to have dinners for a group of friends every thursday night, which taught me how to cook for groups. And I bought another building in Cambridge, a former candy factory (and later, twas said, porn studio), to use as an office.One night in October 2003 there was a big party at my house. It was a clever idea of my friend <NAME>, who was one of the thursday diners. Three separate hosts would all invite their friends to one party. So for every guest, two thirds of the other guests would be people they didn't know but would probably like. One of the guests was someone I didn't know but would turn out to like a lot: a woman called <NAME>. A couple days later I asked her out.Jessica was in charge of marketing at a Boston investment bank. This bank thought it understood startups, but over the next year, as she met friends of mine from the startup world, she was surprised how different reality was. And how colorful their stories were. So she decided to compile a book of interviews with startup founders.When the bank had financial problems and she had to fire half her staff, she started looking for a new job. In early 2005 she interviewed for a marketing job at a Boston VC firm. It took them weeks to make up their minds, and during this time I started telling her about all the things that needed to be fixed about venture capital. They should make a larger number of smaller investments instead of a handful of giant ones, they should be funding younger, more technical founders instead of MBAs, they should let the founders remain as CEO, and so on.One of my tricks for writing essays had always been to give talks. The prospect of having to stand up in front of a group of people and tell them something that won't waste their time is a great spur to the imagination. When the Harvard Computer Society, the undergrad computer club, asked me to give a talk, I decided I would tell them how to start a startup. Maybe they'd be able to avoid the worst of the mistakes we'd made.So I gave this talk, in the course of which I told them that the best sources of seed funding were successful startup founders, because then they'd be sources of advice too. Whereupon it seemed they were all looking expectantly at me. Horrified at the prospect of having my inbox flooded by business plans (if I'd only known), I blurted out "But not me!" and went on with the talk. But afterward it occurred to me that I should really stop procrastinating about angel investing. I'd been meaning to since Yahoo bought us, and now it was 7 years later and I still hadn't done one angel investment.Meanwhile I had been scheming with Robert and Trevor about projects we could work on together. I missed working with them, and it seemed like there had to be something we could collaborate on.As Jessica and I were walking home from dinner on March 11, at the corner of Garden and Walker streets, these three threads converged. Screw the VCs who were taking so long to make up their minds. We'd start our own investment firm and actually implement the ideas we'd been talking about. I'd fund it, and Jessica could quit her job and work for it, and we'd get Robert and Trevor as partners too. [13]Once again, ignorance worked in our favor. We had no idea how to be angel investors, and in Boston in 2005 there were no Ron Conways to learn from. So we just made what seemed like the obvious choices, and some of the things we did turned out to be novel.There are multiple components to Y Combinator, and we didn't figure them all out at once. The part we got first was to be an angel firm. In those days, those two words didn't go together. There were VC firms, which were organized companies with people whose job it was to make investments, but they only did big, million dollar investments. And there were angels, who did smaller investments, but these were individuals who were usually focused on other things and made investments on the side. And neither of them helped founders enough in the beginning. We knew how helpless founders were in some respects, because we remembered how helpless we'd been. For example, one thing Julian had done for us that seemed to us like magic was to get us set up as a company. We were fine writing fairly difficult software, but actually getting incorporated, with bylaws and stock and all that stuff, how on earth did you do that? Our plan was not only to make seed investments, but to do for startups everything Julian had done for us.YC was not organized as a fund. It was cheap enough to run that we funded it with our own money. That went right by 99% of readers, but professional investors are thinking "Wow, that means they got all the returns." But once again, this was not due to any particular insight on our part. We didn't know how VC firms were organized. It never occurred to us to try to raise a fund, and if it had, we wouldn't have known where to start. [14]The most distinctive thing about YC is the batch model: to fund a bunch of startups all at once, twice a year, and then to spend three months focusing intensively on trying to help them. That part we discovered by accident, not merely implicitly but explicitly due to our ignorance about investing. We needed to get experience as investors. What better way, we thought, than to fund a whole bunch of startups at once? We knew undergrads got temporary jobs at tech companies during the summer. Why not organize a summer program where they'd start startups instead? We wouldn't feel guilty for being in a sense fake investors, because they would in a similar sense be fake founders. So while we probably wouldn't make much money out of it, we'd at least get to practice being investors on them, and they for their part would probably have a more interesting summer than they would working at Microsoft.We'd use the building I owned in Cambridge as our headquarters. We'd all have dinner there once a week � on tuesdays, since I was already cooking for the thursday diners on thursdays � and after dinner we'd bring in experts on startups to give talks.We knew undergrads were deciding then about summer jobs, so in a matter of days we cooked up something we called the Summer Founders Program, and I posted an announcement on my site, inviting undergrads to apply. I had never imagined that writing essays would be a way to get "deal flow," as investors call it, but it turned out to be the perfect source. [15] We got 225 applications for the Summer Founders Program, and we were surprised to find that a lot of them were from people who'd already graduated, or were about to that spring. Already this SFP thing was starting to feel more serious than we'd intended.We invited about 20 of the 225 groups to interview in person, and from those we picked 8 to fund. They were an impressive group. That first batch included reddit, <NAME> and <NAME>, who went on to found Twitch, <NAME>, who had already helped write the RSS spec and would a few years later become a martyr for open access, and <NAME>, who would later become the second president of YC. I don't think it was entirely luck that the first batch was so good. You had to be pretty bold to sign up for a weird thing like the Summer Founders Program instead of a summer job at a legit place like Microsoft or Goldman Sachs.The deal for startups was based on a combination of the deal we did with Julian ($10k for 10%) and what Robert said MIT grad students got for the summer ($6k). We invested $6k per founder, which in the typical two-founder case was $12k, in return for 6%. That had to be fair, because it was twice as good as the deal we ourselves had taken. Plus that first summer, which was really hot, Jessica brought the founders free air conditioners. [16]Fairly quickly I realized that we had stumbled upon the way to scale startup funding. Funding startups in batches was more convenient for us, because it meant we could do things for a lot of startups at once, but being part of a batch was better for the startups too. It solved one of the biggest problems faced by founders: the isolation. Now you not only had colleagues, but colleagues who understood the problems you were facing and could tell you how they were solving them.As YC grew, we started to notice other advantages of scale. The alumni became a tight community, dedicated to helping one another, and especially the current batch, whose shoes they remembered being in. We also noticed that the startups were becoming one another's customers. We used to refer jokingly to the "YC GDP," but as YC grows this becomes less and less of a joke. Now lots of startups get their initial set of customers almost entirely from among their batchmates.I had not originally intended YC to be a full-time job. I was going to do three things: hack, write essays, and work on YC. As YC grew, and I grew more excited about it, it started to take up a lot more than a third of my attention. But for the first few years I was still able to work on other things.In the summer of 2006, Robert and I started working on a new version of Arc. This one was reasonably fast, because it was compiled into Scheme. To test this new Arc, I wrote Hacker News in it. It was originally meant to be a news aggregator for startup founders and was called Startup News, but after a few months I got tired of reading about nothing but startups. Plus it wasn't startup founders we wanted to reach. It was future startup founders. So I changed the name to Hacker News and the topic to whatever engaged one's intellectual curiosity.HN was no doubt good for YC, but it was also by far the biggest source of stress for me. If all I'd had to do was select and help founders, life would have been so easy. And that implies that HN was a mistake. Surely the biggest source of stress in one's work should at least be something close to the core of the work. Whereas I was like someone who was in pain while running a marathon not from the exertion of running, but because I had a blister from an ill-fitting shoe. When I was dealing with some urgent problem during YC, there was about a 60% chance it had to do with HN, and a 40% chance it had do with everything else combined. [17]As well as HN, I wrote all of YC's internal software in Arc. But while I continued to work a good deal in Arc, I gradually stopped working on Arc, partly because I didn't have time to, and partly because it was a lot less attractive to mess around with the language now that we had all this infrastructure depending on it. So now my three projects were reduced to two: writing essays and working on YC.YC was different from other kinds of work I've done. Instead of deciding for myself what to work on, the problems came to me. Every 6 months there was a new batch of startups, and their problems, whatever they were, became our problems. It was very engaging work, because their problems were quite varied, and the good founders were very effective. If you were trying to learn the most you could about startups in the shortest possible time, you couldn't have picked a better way to do it.There were parts of the job I didn't like. Disputes between cofounders, figuring out when people were lying to us, fighting with people who maltreated the startups, and so on. But I worked hard even at the parts I didn't like. I was haunted by something <NAME> once said about companies: "No one works harder than the boss." He meant it both descriptively and prescriptively, and it was the second part that scared me. I wanted YC to be good, so if how hard I worked set the upper bound on how hard everyone else worked, I'd better work very hard.One day in 2010, when he was visiting California for interviews, <NAME> did something astonishing: he offered me unsolicited advice. I can only remember him doing that once before. One day at Viaweb, when I was bent over double from a kidney stone, he suggested that it would be a good idea for him to take me to the hospital. That was what it took for Rtm to offer unsolicited advice. So I remember his exact words very clearly. "You know," he said, "you should make sure Y Combinator isn't the last cool thing you do."At the time I didn't understand what he meant, but gradually it dawned on me that he was saying I should quit. This seemed strange advice, because YC was doing great. But if there was one thing rarer than Rtm offering advice, it was Rtm being wrong. So this set me thinking. It was true that on my current trajectory, YC would be the last thing I did, because it was only taking up more of my attention. It had already eaten Arc, and was in the process of eating essays too. Either YC was my life's work or I'd have to leave eventually. And it wasn't, so I would.In the summer of 2012 my mother had a stroke, and the cause turned out to be a blood clot caused by colon cancer. The stroke destroyed her balance, and she was put in a nursing home, but she really wanted to get out of it and back to her house, and my sister and I were determined to help her do it. I used to fly up to Oregon to visit her regularly, and I had a lot of time to think on those flights. On one of them I realized I was ready to hand YC over to someone else.I asked Jessica if she wanted to be president, but she didn't, so we decided we'd try to recruit <NAME>. We talked to Robert and Trevor and we agreed to make it a complete changing of the guard. Up till that point YC had been controlled by the original LLC we four had started. But we wanted YC to last for a long time, and to do that it couldn't be controlled by the founders. So if Sam said yes, we'd let him reorganize YC. Robert and I would retire, and Jessica and Trevor would become ordinary partners.When we asked Sam if he wanted to be president of YC, initially he said no. He wanted to start a startup to make nuclear reactors. But I kept at it, and in October 2013 he finally agreed. We decided he'd take over starting with the winter 2014 batch. For the rest of 2013 I left running YC more and more to Sam, partly so he could learn the job, and partly because I was focused on my mother, whose cancer had returned.She died on January 15, 2014. We knew this was coming, but it was still hard when it did.I kept working on YC till March, to help get that batch of startups through Demo Day, then I checked out pretty completely. (I still talk to alumni and to new startups working on things I'm interested in, but that only takes a few hours a week.)What should I do next? Rtm's advice hadn't included anything about that. I wanted to do something completely different, so I decided I'd paint. I wanted to see how good I could get if I really focused on it. So the day after I stopped working on YC, I started painting. I was rusty and it took a while to get back into shape, but it was at least completely engaging. [18]I spent most of the rest of 2014 painting. I'd never been able to work so uninterruptedly before, and I got to be better than I had been. Not good enough, but better. Then in November, right in the middle of a painting, I ran out of steam. Up till that point I'd always been curious to see how the painting I was working on would turn out, but suddenly finishing this one seemed like a chore. So I stopped working on it and cleaned my brushes and haven't painted since. So far anyway.I realize that sounds rather wimpy. But attention is a zero sum game. If you can choose what to work on, and you choose a project that's not the best one (or at least a good one) for you, then it's getting in the way of another project that is. And at 50 there was some opportunity cost to screwing around.I started writing essays again, and wrote a bunch of new ones over the next few months. I even wrote a couple that weren't about startups. Then in March 2015 I started working on Lisp again.The distinctive thing about Lisp is that its core is a language defined by writing an interpreter in itself. It wasn't originally intended as a programming language in the ordinary sense. It was meant to be a formal model of computation, an alternative to the Turing machine. If you want to write an interpreter for a language in itself, what's the minimum set of predefined operators you need? The Lisp that <NAME> invented, or more accurately discovered, is an answer to that question. [19]McCarthy didn't realize this Lisp could even be used to program computers till his grad student <NAME> suggested it. Russell translated McCarthy's interpreter into IBM 704 machine language, and from that point Lisp started also to be a programming language in the ordinary sense. But its origins as a model of computation gave it a power and elegance that other languages couldn't match. It was this that attracted me in college, though I didn't understand why at the time.McCarthy's 1960 Lisp did nothing more than interpret Lisp expressions. It was missing a lot of things you'd want in a programming language. So these had to be added, and when they were, they weren't defined using McCarthy's original axiomatic approach. That wouldn't have been feasible at the time. McCarthy tested his interpreter by hand-simulating the execution of programs. But it was already getting close to the limit of interpreters you could test that way � indeed, there was a bug in it that McCarthy had overlooked. To test a more complicated interpreter, you'd have had to run it, and computers then weren't powerful enough.Now they are, though. Now you could continue using McCarthy's axiomatic approach till you'd defined a complete programming language. And as long as every change you made to McCarthy's Lisp was a discoveredness-preserving transformation, you could, in principle, end up with a complete language that had this quality. Harder to do than to talk about, of course, but if it was possible in principle, why not try? So I decided to take a shot at it. It took 4 years, from March 26, 2015 to October 12, 2019. It was fortunate that I had a precisely defined goal, or it would have been hard to keep at it for so long.I wrote this new Lisp, called Bel, in itself in Arc. That may sound like a contradiction, but it's an indication of the sort of trickery I had to engage in to make this work. By means of an egregious collection of hacks I managed to make something close enough to an interpreter written in itself that could actually run. Not fast, but fast enough to test.I had to ban myself from writing essays during most of this time, or I'd never have finished. In late 2015 I spent 3 months writing essays, and when I went back to working on Bel I could barely understand the code. Not so much because it was badly written as because the problem is so convoluted. When you're working on an interpreter written in itself, it's hard to keep track of what's happening at what level, and errors can be practically encrypted by the time you get them.So I said no more essays till Bel was done. But I told few people about Bel while I was working on it. So for years it must have seemed that I was doing nothing, when in fact I was working harder than I'd ever worked on anything. Occasionally after wrestling for hours with some gruesome bug I'd check Twitter or HN and see someone asking "Does <NAME> still code?"Working on Bel was hard but satisfying. I worked on it so intensively that at any given time I had a decent chunk of the code in my head and could write more there. I remember taking the boys to the coast on a sunny day in 2015 and figuring out how to deal with some problem involving continuations while I watched them play in the tide pools. It felt like I was doing life right. I remember that because I was slightly dismayed at how novel it felt. The good news is that I had more moments like this over the next few years.In the summer of 2016 we moved to England. We wanted our kids to see what it was like living in another country, and since I was a British citizen by birth, that seemed the obvious choice. We only meant to stay for a year, but we liked it so much that we still live there. So most of Bel was written in England.In the fall of 2019, Bel was finally finished. Like McCarthy's original Lisp, it's a spec rather than an implementation, although like McCarthy's Lisp it's a spec expressed as code.Now that I could write essays again, I wrote a bunch about topics I'd had stacked up. I kept writing essays through 2020, but I also started to think about other things I could work on. How should I choose what to do? Well, how had I chosen what to work on in the past? I wrote an essay for myself to answer that question, and I was surprised how long and messy the answer turned out to be. If this surprised me, who'd lived it, then I thought perhaps it would be interesting to other people, and encouraging to those with similarly messy lives. So I wrote a more detailed version for others to read, and this is the last sentence of it. Notes[1] My experience skipped a step in the evolution of computers: time-sharing machines with interactive OSes. I went straight from batch processing to microcomputers, which made microcomputers seem all the more exciting.[2] Italian words for abstract concepts can nearly always be predicted from their English cognates (except for occasional traps like polluzione). It's the everyday words that differ. So if you string together a lot of abstract concepts with a few simple verbs, you can make a little Italian go a long way.[3] I lived at Piazza San Felice 4, so my walk to the Accademia went straight down the spine of old Florence: past the Pitti, across the bridge, past Orsanmichele, between the Duomo and the Baptistery, and then up Via Ricasoli to Piazza San Marco. I saw Florence at street level in every possible condition, from empty dark winter evenings to sweltering summer days when the streets were packed with tourists.[4] You can of course paint people like still lives if you want to, and they're willing. That sort of portrait is arguably the apex of still life painting, though the long sitting does tend to produce pained expressions in the sitters.[5] Interleaf was one of many companies that had smart people and built impressive technology, and yet got crushed by Moore's Law. In the 1990s the exponential growth in the power of commodity (i.e. Intel) processors rolled up high-end, special-purpose hardware and software companies like a bulldozer.[6] The signature style seekers at RISD weren't specifically mercenary. In the art world, money and coolness are tightly coupled. Anything expensive comes to be seen as cool, and anything seen as cool will soon become equally expensive.[7] Technically the apartment wasn't rent-controlled but rent-stabilized, but this is a refinement only New Yorkers would know or care about. The point is that it was really cheap, less than half market price.[8] Most software you can launch as soon as it's done. But when the software is an online store builder and you're hosting the stores, if you don't have any users yet, that fact will be painfully obvious. So before we could launch publicly we had to launch privately, in the sense of recruiting an initial set of users and making sure they had decent-looking stores.[9] We'd had a code editor in Viaweb for users to define their own page styles. They didn't know it, but they were editing Lisp expressions underneath. But this wasn't an app editor, because the code ran when the merchants' sites were generated, not when shoppers visited them.[10] This was the first instance of what is now a familiar experience, and so was what happened next, when I read the comments and found they were full of angry people. How could I claim that Lisp was better than other languages? Weren't they all Turing complete? People who see the responses to essays I write sometimes tell me how sorry they feel for me, but I'm not exaggerating when I reply that it has always been like this, since the very beginning. It comes with the territory. An essay must tell readers things they don't already know, and some people dislike being told such things.[11] People put plenty of stuff on the internet in the 90s of course, but putting something online is not the same as publishing it online. Publishing online means you treat the online version as the (or at least a) primary version.[12] There is a general lesson here that our experience with Y Combinator also teaches: Customs continue to constrain you long after the restrictions that caused them have disappeared. Customary VC practice had once, like the customs about publishing essays, been based on real constraints. Startups had once been much more expensive to start, and proportionally rare. Now they could be cheap and common, but the VCs' customs still reflected the old world, just as customs about writing essays still reflected the constraints of the print era.Which in turn implies that people who are independent-minded (i.e. less influenced by custom) will have an advantage in fields affected by rapid change (where customs are more likely to be obsolete).Here's an interesting point, though: you can't always predict which fields will be affected by rapid change. Obviously software and venture capital will be, but who would have predicted that essay writing would be?[13] Y Combinator was not the original name. At first we were called Cambridge Seed. But we didn't want a regional name, in case someone copied us in Silicon Valley, so we renamed ourselves after one of the coolest tricks in the lambda calculus, the Y combinator.I picked orange as our color partly because it's the warmest, and partly because no VC used it. In 2005 all the VCs used staid colors like maroon, navy blue, and forest green, because they were trying to appeal to LPs, not founders. The YC logo itself is an inside joke: the Viaweb logo had been a white V on a red circle, so I made the YC logo a white Y on an orange square.[14] YC did become a fund for a couple years starting in 2009, because it was getting so big I could no longer afford to fund it personally. But after Heroku got bought we had enough money to go back to being self-funded.[15] I've never liked the term "deal flow," because it implies that the number of new startups at any given time is fixed. This is not only false, but it's the purpose of YC to falsify it, by causing startups to be founded that would not otherwise have existed.[16] She reports that they were all different shapes and sizes, because there was a run on air conditioners and she had to get whatever she could, but that they were all heavier than she could carry now.[17] Another problem with HN was a bizarre edge case that occurs when you both write essays and run a forum. When you run a forum, you're assumed to see if not every conversation, at least every conversation involving you. And when you write essays, people post highly imaginative misinterpretations of them on forums. Individually these two phenomena are tedious but bearable, but the combination is disastrous. You actually have to respond to the misinterpretations, because the assumption that you're present in the conversation means that not responding to any sufficiently upvoted misinterpretation reads as a tacit admission that it's correct. But that in turn encourages more; anyone who wants to pick a fight with you senses that now is their chance.[18] The worst thing about leaving YC was not working with Jessica anymore. We'd been working on YC almost the whole time we'd known each other, and we'd neither tried nor wanted to separate it from our personal lives, so leaving was like pulling up a deeply rooted tree.[19] One way to get more precise about the concept of invented vs discovered is to talk about space aliens. Any sufficiently advanced alien civilization would certainly know about the Pythagorean theorem, for example. I believe, though with less certainty, that they would also know about the Lisp in McCarthy's 1960 paper.But if so there's no reason to suppose that this is the limit of the language that might be known to them. Presumably aliens need numbers and errors and I/O too. So it seems likely there exists at least one path out of McCarthy's Lisp along which discoveredness is preserved.Thanks to <NAME>, <NAME>, <NAME>, <NAME>, <NAME>, <NAME>, <NAME>, and <NAME> for reading drafts of this.
https://github.com/TypstApp-team/typst
https://raw.githubusercontent.com/TypstApp-team/typst/master/tests/typ/compiler/repr-color-gradient.typ
typst
Apache License 2.0
// Test representation of values in the document. --- // Colors #set page(width: 400pt) #set text(0.8em) #blue \ #color.linear-rgb(blue) \ #oklab(blue) \ #oklch(blue) \ #cmyk(blue) \ #color.hsl(blue) \ #color.hsv(blue) \ #luma(blue) --- // Gradients #set page(width: 400pt) #set text(0.8em) #gradient.linear(blue, red) \ #gradient.linear(blue, red, dir: ttb) \ #gradient.linear(blue, red, angle: 45deg, relative: "self") \ #gradient.linear(blue, red, angle: 45deg, space: rgb)
https://github.com/typst/packages
https://raw.githubusercontent.com/typst/packages/main/packages/preview/metro/0.1.1/src/impl/qty.typ
typst
Apache License 2.0
#import "num.typ": num #import "unit.typ": unit #let qty( number, unt, e: none, pm: none, allow-quantity-breaks: false, quantity-product: sym.space.thin, separate-uncertainty: "bracket", ..options ) = { let result = { let u = { if options.named().at("per-mode", default: "") == "symbol" { unit(unt, quantity-product: quantity-product, ..options) } else { $#quantity-product$ unit(unt, ..options) } } num(number, e: e, pm: pm, separate-uncertainty: separate-uncertainty, separate-uncertainty-unit: if separate-uncertainty == "repeat" { u }, ..options) u } return if allow-quantity-breaks { result } else { box(result) } }
https://github.com/typstdocsinchinese/typstdocsinchinese.github.io
https://raw.githubusercontent.com/typstdocsinchinese/typstdocsinchinese.github.io/main/README.md
markdown
<h1 align="center">这是又一个 <a href="https://github.com/typst/typst">Typst</a> 非官方的中文文档</h1> <p align="center"><a href="https://github.com/typst/typst">访问官方仓库</a> · <a target="_blank" href="https://typstdocsinchinese.github.io">立即阅读</a> · <a href="https://github.com/typstdocsinchinese/typstdocsinchinese.github.io/issues">反馈问题</a> · <a target="_blank" href="https://github.com/typstdocsinchinese/typst">翻译仓库</a> > [!NOTE] > 文档的翻译工作在 [Typst 的 fork](https://github.com/typstdocsinchinese/typst) 中进行。本 Repo 是用 Nuxt 编写的网页载体,负责 `typst-doc` 编译出的数据的展示,计划部署于 GitHub Pages。更多技术细节将在翻译大致完成以后写出。 > > ——2024.10.15
https://github.com/deadManAlive/ui-thesis-typst-template
https://raw.githubusercontent.com/deadManAlive/ui-thesis-typst-template/master/primer/primer.typ
typst
#let primer(doc) = { set text( font: "Times New Roman", size: 12pt, lang: "id" ) set page( paper: "a4", margin: (x: 3cm, y: 3cm), ) set block(spacing: 1em) show heading: set text(size: 12pt) set par(justify: true) doc } #let main(body) = { set page( header: context { let intro = query(<intro>).first() if intro.location().page() == here().page() { counter(page).update(1) } let matches = query(heading.where(level: 1)) let h = here().page() let m = matches.map(val => val.location().page()) let has-h1 = m.any(val => val == h) if not has-h1 { [ #set align(right) #locate(loc => counter(page).at(loc).first()) ] } }, header-ascent: 1.5cm, footer: context { let matches = query(heading.where(level: 1)) let h = here().page() let m = matches.map(val => val.location().page()) let has-h1 = m.any(val => val == h) set align(center) if has-h1 { counter(page).display() } // [ \ ] set align(right) text("Universitas Indonesia", font: "Arial", size: 10pt, weight: "bold") } ) set figure( numbering: (..nums) => { let ch = str(counter(heading).get().first()) let fc = nums.pos().map(str).join(".") ch + "." + fc } ) show figure.where( kind: image ): set figure( supplement: [Gambar] ) show figure.where( kind: table ): set figure( supplement: [Tabel] ) set math.equation( numbering: (..nums) => { let ch = str(counter(heading).get().first()) let fc = nums.pos().map(str).join(".") "(" + ch + "." + fc + ")" } ) show heading.where(level: 1): head => context [ #counter(figure.where(kind: image)).update(0) #counter(figure.where(kind: table)).update(0) #counter(math.equation).update(0) #set align(center) #set par(leading: 0.75em) #upper([#counter(heading).display()]) \ #upper([#head.body]) #v(1.5em) ] show heading.where(level: 1): set heading( numbering: (..nums) => "Bab " + str(nums.pos().first()) ) set par(justify: true, first-line-indent: 2em, leading: 1.5em) set block(spacing: 1.5em) set heading(numbering: "1.1.1.") set text(lang: "id") show heading: set block(spacing: 1.5em) body }
https://github.com/Myriad-Dreamin/typst.ts
https://raw.githubusercontent.com/Myriad-Dreamin/typst.ts/main/fuzzers/corpora/math/attach-p3_03.typ
typst
Apache License 2.0
#import "/contrib/templates/std-tests/preset.typ": * #show: test-page // Show and let rules for limits and scripts #let eq = $ ∫_a^b iota_a^b $ #eq #show "∫": math.limits #show math.iota: math.limits.with(inline: false) #eq $iota_a^b$
https://github.com/lelimacon/typst-minimal-cv
https://raw.githubusercontent.com/lelimacon/typst-minimal-cv/main/README.md
markdown
MIT No Attribution
# Minimal-CV Yet another John Doe CV. <a href="thumbnail.png"> <img src="thumbnail.png" alt="thumbnail" width="300" /> </a> A Typst CV template that aims for : - Clean aesthetics - Easy customizability ## Usage ### From Typst app Create a new project based on the template [minimal-cv](https://typst.app/universe/package/minimal-cv). ### Locally The default font is ["Inria Sans"](https://fonts.google.com/specimen/Inria+Sans). Make sure it is installed on your system, or change it in [# Theme](#theme). Copy the [template](https://raw.githubusercontent.com/lelimacon/typst-minimal-cv/main/template/cv.typ) to your Typst project. ### From a blank project Import the library : ```typst #import "@preview/minimal-cv:0.1.0": * ``` Show the root `cv` function : ```typst #show: cv.with( theme: (), title: "YOUR NAME", subtitle: "YOUR POSITION", aside: [ ASIDE CONTENT ] MAIN CONTENT ``` Several content functions are available. **Section** ```typst #section( theme: (), "TITLE_CONTENT", "BODY_CONTENT", ) ``` **Entry** ```typst #entry( theme: (), right: "FLOATING_CONTENT", "GUTTER_CONTENT", "TITLE_CONTENT", "BODY_CONTENT", ) ``` **Progress bar** ```typst #progress-bar(50%) ``` ## Theme Customize the theme by specifying the `theme` parameter and overriding 1 or more keys. ### Function `cv` | Key | Type | Default | --- | ---- | ------- | `margin` | relative | `22pt` | `font` | relative | `"Inria Sans"` | `font-size` | relative | `11pt` | `accent-color` | color | `blue` | `body-color` | color | `rgb("222")` | `header-accent-color` | color | inherit | `header-body-color` | color | inherit | `main-accent-color` | color | inherit | `main-body-color` | color | inherit | `main-width` | relative | `5fr` | `main-gutter-width` | relative | `64pt` | `aside-accent-color` | color | inherit | `aside-body-color` | color | inherit | `aside-width` | relative | `3fr` | `aside-gutter-width` | relative | `48pt` ### Function `section` | Key | Type | Default | --- | ---- | ------- | `gutter-size` | color | inherit | `accent-color` | color | inherit | `body-color` | color | inherit ### Function `entry` | Key | Type | Default | --- | ---- | ------- | `gutter-size` | color | inherit | `accent-color` | color | inherit | `body-color` | color | inherit
https://github.com/maxlambertini/troika-srd-typst
https://raw.githubusercontent.com/maxlambertini/troika-srd-typst/main/chap04.typ
typst
#let chap04_title = [ = Items and Spells] #let chap04= [ == Items <items> If an item is not listed here assume it adds a bonus of +1 to rolls associated with it. Lockpicks, for instance, would add +1 to Lock rolls while a rope would add +1 to Climb, and so on. Item bonuses only apply if you are trained in the Skill they are meant to enhance. Lockpicks will only give their bonus if you know how to use lockpicks \(have 1+ in Locks already). An incomplete list of desirous things: #strong[Astrological Equipment] requires twenty minutes to set up and use but doesn’t need to be outside. Consists of a ruby specular, charms against reciprocal observation, and complicated charts of the spheres. Grants +1 to Astrology. #strong[A bale hook] counts as a Knife for Damage and grants +1 on rolls to lift heavy objects. #strong[The blue star maps of Corda] hold the secrets of travel between the spheres. Every juncture in space and time can be found on its many square metred face if one is sufficiently educated in its use. Test Astrology to tell the precise destination of any portal. #strong[An Epopt’s Staff] is a tool, an advert, and, in a pinch, a Weapon. In its head is set a cloudy ruby, like a useless magnifying glass, which grants the user +1 Second Sight while peering through it. #strong[A fusil] is a long Weapon that looks like a rifle and can be used in melee as a Club. A Fusil holds 6 charges before the plasmic core needs replacing. #strong[Knuckle dice] are made from the nimble, petal shaped knuckle bones of goblins and make excellent two sided dice. #strong[A pistolet] is a hand held energy Weapon. Holds enough energy for 8 shots. #strong[Plasmic cores] are crystalised starlight cast in metal. Or astral vapours captured in glass. Or maybe hard-ghosts? Whatever it is, it’s pretty and used as a fuel source for exotic Weapons and reckless magicians. A plasmic core can be cracked open and huffed by a wizard in place of spending Stamina on a Spell. However, if an Oops! Table roll is called for the wizard has overdosed and drops dead, foaming at the mouth. #strong[The pocket barometer] is part of a fashionable affectation for the metropolitan Troikan. Though the city has no discernable weather it is considered polite to check it intermittently and comment on the present clemency and hope for it to continue into the future. Examining its quartz face will inform you of future weather with 5 in 6 accuracy. #strong[Pocket gods] are little cloth puppets made in the image of your numerous gods. If you whisper a secret to one and throw it away you regain 1 Luck. #strong[Ruby lorgnettes] are collapsable spectacles made with ruby lenses that require a free hand to use. While wearing them your sight is impaired but you can see sorcerous activity clearly \(+2 Second Sight). #strong[Salt] is the poor man’s Silver. Where Silver kills the demonic and the dead Salt merely harms or bars. #strong[Silver] is the star metal, the most untouched material fallen from the hump-backed sky. Weapons made from it may inflict Damage to creatures normally immune to material harm. #strong[A tea set] grants +1 to Etiquette when you have the time to sit down and make tea for those you are trying to impress. #strong[The Velare], when inactive, looks like an ornate piece of costume jewellery, usually a brooch or a circlet. When active it produces a full body disguise on the wearer formed from hard-light. Grants +4 Disguise. Lasts for 24 hours before needing to be recharged with a plasmic core. #strong[Witch-hair ropes] are immune to manipulation via magical means. #strong[A yoke] gives you +4 carry capacity while worn but you can’t use your hands while wearing it. == Spells <spells> To cast a Spell you must spend Stamina equal to the casting cost \(the number in brackets) and Roll Under your Skill Total in the Spell you wish to cast. A double 1 will always succeed while a double 6 will always fail and require a roll on the Oops! Table. === Affix \(3) <affix-3> Cause a subject to be fixed in place. While they are so held they do not move, breathe, fall, perspire, acquire, or otherwise change. They are totally immune to harm, in fact. Lasts for 3 minutes. === Amity \(4) <amity-4> The College of Friends always sends out its Factotums on nights after Amity classes. Clearing out the bars and brothels of their drunken apprentices is tiring work. Use of this Spell causes the target to Test their Luck \(or Skill for Enemies) or become very friendly towards the wizard, as though they were an old friend. They will not act irrationally, though, and if they were already a bit of a boor this might not change much. === Animate \(2) <animate-2> Cause inanimate objects to question their place. One object up to the size of a human baby may be caused to hop around and do whatever else the wizard wishes. === Assassin’s Dagger \(3) <assassins-dagger-3> Evocatively named but actually quite mundane. The wizard whispers to an object and that object then seeks out and vigorously and repeatedly bumps into the desired target. Obviously if you whisper to a poisoned dagger the result is one thing while doing it to a letter is another. Travels any distance and always arrives \(eventually). === Assume Shape \(4) <assume-shape-4> The wizard undergoes a distressing transformation into an inanimate object no larger than a piano and no smaller than a cup. Lasts until ended. === Astral Reach \(1) <astral-reach-1> The Sorcerers of the Academy of Doors are most famous for this one Spell. With it they may reach through any portal and into another known receptacle. For example they might use it to reach through to a safe in their manse via their purse. This Spell only allows partial translocation— the wizard cannot fully or permanently enter. === Babble \(2) <babble-2> The wizard speaks nonsense while watching the intended target, causing their words to trip and confuse. This may be done under their breath and relatively subtly. === Banish Spirit \(6) <banish-spirit-6> The wizard explains, clearly, sternly, why it is impossible that the spirit could be here at this time. The spirit must Test its Luck \(or Skill for Enemies) or be sent to somewhere less improbable. === Befuddle \(1) <befuddle-1> A wizard’s touch can shake up someone’s mind like a snow globe. The target makes all rolls at a -1 penalty until their head clears. Lasts for 3 minutes. === Blood Shroud \(4) <blood-shroud-4> Smear a small amount of a demon’s blood on yourself to become completely invisible to them, even if you attack or speak to them, for 6 hours. === Breach \(2) <breach-2> The wizard’s hands work elemental material as though it were soft clay. Fire, stone, goo, earth, fog, all of it behaves like clay under their touch. Lasts for 9 minutes. === Brittle Twigs \(2) <brittle-twigs-2> You snap a twig or other brittle object to cause an injury in another. They must Test their Luck \(or Skill for Enemies) or suffer a broken bone. === Callous Strike \(1) <callous-strike-1> The Wizard-Knights are most famous for their remote combat whereby they swing their Silver Swords seemingly at nothing only for their opponents, many metres away, to be torn to tatters. This Spell can be used in place of a melee attack by Rolling Versus as normal and inflicting Damage according to the Weapon used. May only be used against targets within clear sight. === Coal Resolve \(1) <coal-resolve-1> This Spell turns one’s heart into a burning ember of grief. Those under its effect are so consumed by grief that they are immune to mind controlling effects and the non-physical impact of pain. Lasts until the next rest. === Cockroach \(5) <cockroach-5> A popular Spell that turns troublesome folk into humiliated animals. The target must Test their Luck \(or Skill for Enemies) or be turned into an insignificant creature of the wizard’s choice. Lasts forever. === Cone of Air \(2) <cone-of-air-2> Creates a mysterious and specifically shaped cone of air focused on a touched target’s head. They may continue to breathe the freshest of air for 12 minutes. === Darkness \(3) <darkness-3> Summon a stationary, perfect sphere of darkness up to five metres from the wizard for up to 3 minutes. === Darksee \(1) <darksee-1> The wizard reaches into their sockets and extricates their eyes. Thus freed, the dark void behind can see perfectly well in pitch blackness and suffer excruciating pain in light \(-4 penalty to all rolls). Be careful not to lose those eyeballs as re-inserting them is the only way to end the Spell. === Diminish \(2) <diminish-2> Cause something to Test its Luck \(or Skill for Enemies) or reduce its size by half. Lasts 3 minutes. === Drown \(4) <drown-4> Cause a target’s lungs to fill with water. They must Test their Luck \(or Skill for Enemies). If they fail they start to Drown \(7.9) and are incapacitated as water pours from their mouth. They may Test again once per Turn until they pass, at which point the Spell ends. === Earthquake \(5) <earthquake-5> The wizard hikes up their wizard robe and stomps their wizard feet. An area 30 metres around them suffers a massive earthquake. Everyone must Test their Luck \(or Skill for Enemies) or fall through a crack in the earth, taking falling Damage and being stuck in a bloody great big hole \(7.8.1). Buildings may be wrecked unless especially sturdy. === Ember \(2) <ember-2> A simple but effective summoning of fire. Flames the size of a small bonfire appear somewhere within 12 metres of the wizard. Once present there is no accounting for its actions. Exchange === Exchange Shape \(5) <exchange-shape-5> What looks like a hug is in fact fell wizardry! The wizard bumps into another and exchanges bodies. Lasts until the wizard chooses to end it but they must be within sight of their own body for this to happen. === Exorcism \(1) <exorcism-1> The Red Priests posit that all negative behaviour is a symptom of some level of possession, or at least direct influence, by the forces of Change, unwitting agents of Mass in need of healing. The wizard throws salt at their target and Rolls Versus the possessing spirit to cast it out. In the case of a Fumble the spirit is drawn into and possesses the wizard. === Explode \(5) <explode-5> So simple that it’s arguably not even a Spell but rather a premeditated failure of catastrophic proportions. The wizard causes a one cubic metre object to explode and deal Damage to everyone within 24 metres depending on proximity. Those within 6 metres take Damage as a Gigantic Beast, within 12 as a Large Beast, 18 as a Modest Beast and 24 as a Small Beast. === Farseeing \(2) <farseeing-2> Endows the wizard with engorged, plate-like eyes that are able to see in minute detail for miles around but are unable to see anything up close. Lasts until ended. === Fear \(1) <fear-1> In the eyes of one poor target the wizard grows into a primal monster from the depths of their lizard brain. They will attempt to flee and if flight is impossible they will curl up in a ball and whimper. They may Test their Luck \(or Skill for Enemies) to resist the illusion. === Find \(2) <find-2> When wizards lose their glasses they mumble to themselves until they turn up. The thing being sought must be a specific object, not a general category or type, and the direction is only given in terms of compass points. === Fire Bolt \(1) <fire-bolt-1> Shoot impressive flames from your fingertips, dealing Damage to one target within 20 metres. #align(center)[#table( columns: 8, align: (col, row) => (auto,auto,auto,auto,auto,auto,auto,auto,).at(col), inset: 6pt, [roll], [1], [2], [3], [4], [5], [6], [7+], [damage], [3], [3], [5], [7], [9], [12], [16], ) ] === Flash \(3) <flash-3> The wizard claps neatly and issues forth the light of a thousand suns from their hands. All within 20 metres must Test their Luck \(or Skill for Enemies) or be blinded for 1d6 minutes. === Gills \(3) <gills-3> The wizard may permanently gift a touched subject with gills, replacing their usual breathing arrangement if they fail to Test their Luck \(or Skill for Enemies). Useful for underwater excursions but less so when inflicted upon a chap in the middle of town. The wizard may end this at will. === Grow \(2) <grow-2> Cause an item to grow half its size again if it fails to Test its Luck \(or Skill for Enemies). Lasts for 3 minutes. === Helping Hands \(1) <helping-hands-1> Animate hands spring forth from an inanimate surface and perform any task the wizard requires but are limited to being rooted to the spot from which they sprang. They last until the wizard wills it or leaves the location. === Hurricane \(5) <hurricane-5> The wizard waves their hands in the air like they just don’t care, which, being wizards, they likely don’t. A mighty gust knocks everyone over within 30 metres who fails to Test their Luck \(or Skill for Enemies), dealing 1d3 Damage and making an awful mess. Lasts for 10 minutes. Test Luck every Turn if not taking cover or else take further Damage. === Illusion \(2 per viewer) <illusion-2-per-viewer> Those viewing this illusion may Test their Luck \(or Skill for Enemies) to unveil the trickery. Lasts until the wizard leaves or falls asleep. === Invisibility \(3) <invisibility-3> The wizard turns flesh into refractive crystal sheets. It’s very uncomfortable and you make a slight shish-ing sound as you move but are quite invisible and don’t suffer from the usual limitations of illusions. Lasts for 3 minutes after which you noisily reform into dull and frustratingly opaque flesh. === Ironhand \(3) <ironhand-3> The common man does not appreciate exactly how close flesh and iron are when considered relative to, say, flesh and the smell of hot tea. With some slight convincing the wizard may cause a target’s flesh to behave as though it had the desirable properties of metal. They get +1 Skill and immunity to modestly proportioned fires for 3 minutes. === Jolt \(1) <jolt-1> The mischievous apprentice’s favourite Spell, Jolt sends an arc of electricity from the wizard’s outstretched hand towards a target. Ignores Armour. #align(center)[#table( columns: 8, align: (col, row) => (auto,auto,auto,auto,auto,auto,auto,auto,).at(col), inset: 6pt, [roll], [1], [2], [3], [4], [5], [6], [7+], [damage], [2], [2], [3], [3], [5], [7], [9], ) ] === Languages \(1) <languages-1> The wizard forms a mouth with their hands through which they can speak any language. They can simultaneously cup their other hand to their ear to understand them in return. Lasts for one conversation. === Leech \(2) <leech-2> The necromancer must place their hands on a living subject and allow their fingertips to transform into sucking apertures which drain the victim of blood. Deal 2d6 Damage to your victim and regain half as much Stamina. === Levitate \(2) <levitate-2> Elevates the wizard or another on the backs of tiny invisible sprites who answer only to their summoner. May float about for 3 minutes. === Life Line \(1) <life-line-1> Created by the Horizon Knights to enable them to take the fight to the Nothing, they would cast this on their squires and dive off the edge of creation. While this Spell lasts the wizard’s essential bodily functions are linked to another, thereby enabling them to breath or eat for the recipient. They will need to breathe and eat for two, which makes it hard to do anything useful while linked. The Spell lasts for a day, until cancelled, or until the death of the linked person. Note if the linked person dies, starves, or is choked you will suffer equally. === Light \(1) <light-1> Create an ethereal orb of light that glows like a torch. Lasts 6 hours and can be extinguished at will. === Lock \(1) <lock-1> Magically lock an object. The object must have a lockable aspect to it but is now magically sealed. Permanent until undone or dismissed. === Mirror Selves \(3) <mirror-selves-3> In the minds of others the wizard appears to be, in fact, three wizards. All three will perform the same actions in unison, offering attackers only a 1 in 3 chance of targeting the right wizard. Lasts for 12 minutes. === Natter \(1) <natter-1> As everyone knows, wizards are excellent ventriloquists, so good, in fact, that they can throw their voice inside another’s mouth. They can target anyone within sight and transmit a short sentence. === Open \(1) <open-1> The wizard chooses a reality wherein the lock was open all along. May be used to open any mundane door or container and counteract a Lock Spell. === Peace \(2) <peace-2> Open up the mind to universal love and cause two subjects to Test their Luck \(or Skill for Enemies) or cease hostilities. They will still defend themselves if attacked but will at least appreciate the pettiness of it. === Poison \(1) <poison-1> When cast upon a liquid this Spell causes it to become deadly poison. The liquid deals 4 Damage if drunk and 1 Damage per Turn until the target successfully Tests their Luck \(or Skill for Enemies). The liquid loses its potency after an hour. === Posthumous Vitality \(5) <posthumous-vitality-5> Necromancers, known for their social inadequacy, often find themselves having to make friends. This Spell requires a fresh, or at least whole and lubricated, corpse. The wizard rolls 2d6 plus their Posthumous Vitality Skill Total and consults the following chart \(13+ counts for an Advancement tick): 4-12 Nothing happens. 13-14 The vitality is clumsily applied, causing the body to explode messily. A new one will need to be found. 15-16 The creature is animated and will last for 24 hours before literally falling to pieces. 17+ Perfect reanimation. The creature will last until destroyed. === Presence \(1) <presence-1> This Spell creates the sense of being watched by a patriarchal figure. Some find it comforting, others, not so much. === Protection from Rain \(1) <protection-from-rain-1> This Spell prevents the wizard from getting rained upon for one shower. === Purple Lens \(1) <purple-lens-1> The recipient’s eyes glow purple as they experience an alternative reality where people are kind, their surroundings are beautiful, their food is indulgent, and so on. This doesn’t change the reality of things but it does make them more palatable. Lasts until they want it to end. === Quench \(1) <quench-1> Snuff a small flame with the wave of a hand. === Read Entrails \(1) <read-entrails-1> The wizard can get the answer to one question from the entrails of a living creature. The size and importance of the creature influences the level of knowledge gained. Small, common animals are able to offer yes or no answers, oxen can predict things obtusely, lamassu may offer explicit and thorough advice. === Read Stars \(1) <read-stars-1> Rather than physical stars the wizard navigates by astral starlight that peeks through the veil. This Spell enables the wizard to get a reasonable sense of direction regardless of any obscuring factors. === See Through \(1) <see-through-1> The wizard rubs a surface vigorously, making it translucent. Can penetrate up to 12 inches of material. Lead and Silver are immune. === Sentry \(1) <sentry-1> The wizard plucks a bit of their mind out like candy floss and leaves it stuck to a wall somewhere. This psychic presence is invisible to the naked eye but extends the wizard’s senses to that spot for the duration. While it lasts the wizard suffers -1 to all rolls due to the incredible confusion this generates. If the shard is discovered and harmed the wizard will lose 2d6 Stamina due to the shock. === Shatter \(3) <shatter-3> The wizard may wildly gesticulate at a brittle object no larger than an umbrella and cause it to shatter into a million pieces. Living targets may Test their Luck to avoid this unpleasant Spell. === Skeletal Counsel \(3) <skeletal-counsel-3> Necromancers often talk to skulls. Sometimes they talk back. Use of this Spell enables speaking with the dead, who answer one question per casting. Requires a skull. === Sleep \(2) <sleep-2> The wizard convinces a target to forgo wakefulness for a time, causing them to sleep until woken unless they successfully Test their Luck. Remember: fighting is loud. === Slide Skywards \(6) <slide-skywards-6> Requires mirrors or other highly reflective surfaces. The wizard stands between two reflective surfaces so that they are infinitely repeated. They then step out from between them but as a different incidence of themselves. To those watching the wizard moves in the direction not seen and reappears between two mirrors elsewhere. If the location has been compromised the wizard arrives in a random mirrored location somewhere across the million crystal spheres. === Starry Orb \(4) <starry-orb-4> The wizard creates a 5th dimensional orb above their head. All intelligent beings looking at it must Test their Luck or marvel at it for 3 minutes. === Teleport \(10) <teleport-10> The wizard or a target of their choosing may travel to any location within a single sphere instantly. If unfamiliar with the location they must Test their Luck \(or Skill for Enemies) or be thrown wildly off course to potentially devastating results. === Thought Vapour \(1) <thought-vapour-1> The wizard can cause their nose to exist in multiple alternative realities, travel through various spheres, and enable the olfactory sensation of thought. Emotions, attitudes, and underlying feelings can be smelled. No words or images are formed, just impressions. Any strong odour will cause this Spell to fail. === Thunder \(2) <thunder-2> The wizard raises their arms and shouts something suitably ominous. All within 24 metres must Test their Luck \(or Skill for Enemies) or be deafened by a riotous roll of thunder. Luck or no, they will be mightily impressed. === Tongue Twister \(2) <tongue-twister-2> Beware! If a wizard screws their nose and twists their fingers at you then a Tongue Twister is coming your way. The target must Test their Luck \(or Skill for Enemies) or have their tongue literally tied in knots. This requires some time and a fair bit of patience to disentangle. === Torpor \(3) <torpor-3> Those who study the dead consider it necessary to develop a profound sympathy with their subject — how can you speak with the dead if you don’t understand the dead? Torpor helps build post-mortem empathy by causing the necromancer to temporarily die. Bodily functions are halted, no food, water, or air is needed, and they are, by most vulgar definitions of the word, dead. The Spell lasts until ended by the wizard, who remains vaguely aware of their surroundings to the extent of being conscious of sound and movement but not of what is said or who is saying it. They will still take Damage from bodily abuse while under the effect and can indeed become irretrievably dead. === True Seeing \(3) <true-seeing-3> The wizard focuses their sight on the unambiguous truth of matter, enabling them to see through illusions for the next 10 minutes. === Undo \(double cost of original Spell) The wizard disentangles a Spell from this instance of reality. To do so they must Roll Versus the original casting if disentanglement is possible at all. === Ward \(1) <ward-1> A handy Spell only requiring the flick of a wrist. In response to being fired upon the wizard may cast this Spell to cause the missile to be deflected. === Wall of Power \(2) <wall-of-power-2> What they call a wall is in fact a dome, but wizards always have worked in mysterious ways. The wall is a shimmering bubble that causes 1d6 Damage when touched. Nothing may pass without the wizard’s permission \(it is recommended that they remember to allow air). Lasts for 12 minutes. === Web \(2) <web-2> Whether this is opening a portal to the plane of slime or channelling the sprites of sickness, all can agree that it is quite disgusting. The wizard blows forth the "web" from their nose and all in a cone extending 12 metres in front of the wizard are trapped unless they Test their Luck \(or Skill for Enemies). Each Turn anything passing through or out of it must repeat the Test or become stuck. Dries up after 12 rounds. #colbreak() === Zed \(?) <zed> No one knows what this does but everyone who has cast it disappears instantly, never to be seen again. #v(24pt) ]
https://github.com/Myriad-Dreamin/typst.ts
https://raw.githubusercontent.com/Myriad-Dreamin/typst.ts/main/fuzzers/corpora/layout/grid-styling_01.typ
typst
Apache License 2.0
#import "/contrib/templates/std-tests/preset.typ": * #show: test-page #grid(columns: 3, stroke: none, fill: green, [A], [B], [C])
https://github.com/soul667/typst
https://raw.githubusercontent.com/soul667/typst/main/PPT/typst-slides-fudan/themes/polylux/book/src/dynamic/obo-lbl.md
markdown
# `#one-by-one` and `#line-by-line` Consider some code like the following: ```typ #uncover("1-")[first ] #uncover("2-")[second ] #uncover("3-")[third] ``` The goal here is to uncover parts of the slide one by one, so that an increasing amount of content is shown. A shorter but equivalent way would be to write ```typ {{#include one-by-one.typ:6}} ``` resulting in ![one-by-one](one-by-one.png) And what about this? ```typ #uncover("3-")[first ] #uncover("4-")[second ] #uncover("5-")[third] ``` Now, we still want to uncover certain elements one after the other but starting on subslide 3. We can use the optional `start` argument of `#one-by-one` for that: ```typ {{#include one-by-one-start.typ:6}} ``` resulting in ![one-by-one-start](one-by-one-start.png) `#one-by-one` is especially useful for arbitrary contents that you want to display in that manner. Often, you just want to do that with very simple elements, however. A very frequent use case are bullet lists. Instead of ```typ #one-by-one[ - first ][ - second ][ - third ] ``` you can also write ```typ {{#include line-by-line.typ:6:10}} ``` resulting in ![line-by-line](line-by-line.png) The content provided as an argument to `#line-by-line` is parsed as a `sequence` by Typst with one element per line (hence the name of this function). We then simply iterate over that `sequence` as if it were given to `#one-by-one`. Note that there also is an optional `start` argument for `#line-by-line`, which works just the same as for `#one-by-one`.
https://github.com/N3M0-dev/Notes
https://raw.githubusercontent.com/N3M0-dev/Notes/main/CS/FLaA/final_note.typ
typst
#import "@local/note_template:0.0.1": * #import "@preview/finite:0.3.0": automaton #import "@preview/cetz:0.2.2" #set heading(numbering: "1.1") #show heading: body => [ #text(font:("Times New Roman","Weibei SC"))[#body] ] #frontmatter(title: "Final Note", date: "2021-6-12", authors: ("Nemo",)) #set text(font:("Times New Roman","Weibei SC")) #outline(indent: true) #set text(font: ("Times New Roman","SimSun")) #pagebreak() #let make_cols(cols,body) = context{ let size = measure(body) box(height: size.height/cols)[ #columns(cols)[ #body ] ] } = 有穷自动机 Basic defs: #make_cols(2)[ - 字母表 - 字符串/字 - 空串 - 串的长度 - 串的连接 - 串的逆序 - 集合的连接 - 集合的幂 - 正闭包 - 克林闭包 - 串的前缀, 后缀, 真前缀, 真后缀 - 语言: $L, forall L in Sigma^*$ ] == DFA #let map = sym.arrow.r.bar $"DFA" A = (Q, Sigma, delta, q_0, F)$ 状态转移函数: $delta: Q times Sigma map Q $ 拓展状态转移函数: $hat(delta): Q times Sigma^* map Q$ === Exercies + Design a DFA that accepts all strings w over {0, 1} such that w is the binary representation of a number that is a multiple of 3. 基本的, 分成三个类别, $q_0, q_1, q_2$, 余数分别为0, 1, 2; 考虑一下初始状态, 如果开始时0, 则为 $q_0$, 开始为1, 则为 $q_1$, 故还需要添加一个开始状态, 记作 _dummy_. 有以下自动机: #align(center)[ #automaton(( dummy: (q0: 0,q1: 1), q0: (q0: 0,q1: 1), q1: (q0: 1,q2: 0), q2: (q2: 1,q1: 0) ), layout:( dummy: (0,0), q0: (0,-3), q1: (3,-3), q2: (6,-3) ), initial: "dummy", final: "q0" )] 思路为, 二进制数读入一个0, 已知数乘二, 读入一个1, 已知数乘二加一. == NFA $"NFA" A = (Q, Sigma, delta, q_0, F)$ $delta: Q times Sigma map 2^Q$ 状态可以一次转移并行的跳转至多个状态, 最终接受时, 只要有一个状态处于接受集中即可. #note()[如果出现一个状态没有任何转移, 则认为其转移到一个空集.] === Exercies + $L={w bar w in {0,1}^*}$ 设计 NFA 使其接受最后三个符号至少有一个 1 的串. + 有以下自动机: #align(center)[ #automaton(( q0: (q0: (0,1), q1: 1), q1: (q2: (0,1)), q2: (q3: (0,1)), q3: () ), initial: "q0", final: ("q1","q2","q3") ) ] 思路为: 开始时如果没有 1 就停留在 $q_0$, 有 1 就向下传, 一共传递 3 次, 如果没有结束就转移至 $nothing$, 结束就停在 $q_1, q_2, q_3$ 中任一状态, 以实现 "最后三个字符" 的要求. 同时要注意, $q_0, 0 -> q_0$ 的转移是必须的, 如果出现一次 1 但是后续若超过 3 个字符, NFA 将转移至 $nothing$, 无法接受, 故此转移维护了起始状态. #note()[ 可以利用 NFA 转移至 $nothing$ 的方式来实现计数, 但是这样会使得状态数目增加, 且每个状态不具有充分的实际意义, 更像占位符. ] + 还有另外一种方式的实现: #align(center)[ #automaton(( q0: (q0: (0,1), q1: 1, q2: 1, q3: 1), q1: (q2: (0,1)), q2: (q3: (0,1)), q3: () ), initial: "q0", final: ("q3"), layout: ( q0: (0,0), q1: (0,-3), q2: (3,-3), q3: (6,-3) ), style: ( q0-q1: (curve: 0) )) ] 和上面差不多同理, 也是通过三个状态, 转移至 $nothing$ 来计数. + $L = {w bar w "starts with 01"} union {w bar w "ends with 01"}$ 设计 NFA 接受 $L$ 有以下自动机: #align(center)[ #automaton(( q0: (q1: 0, q3: (0,1)), q1: (q2: 1), q2: (q2: (0,1)), q3: (q3: (0,1), q4: 0), q4: (q5: 1), q5: () ), initial: "q0", final: ("q2","q5"), layout: ( q0: (0,0), q1: (3,2), q2: (6,2), q3: (3,-2), q4: (6,-2), q5: (9,-2) ), style: ( transition: (curve: 0) ) ) ] === NFA 与 DFA 的等价性 对于 NFA 并行的跳转状态, 可以理解为一次跳转至一个确定的状态集, 因此可以将该状态集作为 DFA 的一个状态, 从而实现 NFA 与 DFA 的等价性. 证明详见 _课程讲义 2.3.4_. == $epsilon dash.en$NFA $epsilon dash.en "NFA" = (Q, Sigma, delta, q_0, F)$ $delta: Q times Sigma union {epsilon} map 2^Q$ 允许读入空串 (不读入字符) 进行转移. === $epsilon dash.en "closure"$ #let eclose="ECLOSE" $epsilon dash.en "closure" (q) = {q} union {p bar p "is reachable from q by epsilon transitions"}$ 记为 ECLOSE(q) 对于状态集合的 ECLOSE(S), 则结果为所有状态的 ECLOSE(q) 的并集. === 状态转移函数的定义 + $hat(delta)(q, epsilon) = eclose(q)$ + 若 $w=x a$ $hat(delta)(q, w) = eclose(union.big_(p in hat(delta)(q,x)) delta(p,a))$ === Exercies + 求 $hat(delta)(q_0, 10)$ 先做 $q_0$ 空转移 再读入 1 得到状态转移, 再进行 ECLOSE 再读入 0 得到状态转移, 再进行 ECLOSE === 消除空转移 设 $epsilon dash "NFA" E = (Q_E, Sigma, delta_E, q_E, F_E) space "DFA" D = (Q_D, Sigma, delta_D, q_D, F_D)$ 其中: $ Q_D &= 2^(Q_E)\ q_D &= eclose(q_E)\ F_D &= {S bar S in Q_E, S sect F_E eq.not nothing}\ delta_D (S, a) &= eclose(union.big_(p in S) delta_E (p, a)) $ === $epsilon dash.en "NFA"$ 与 DFA 的等价性 先证明 $epsilon dash.en "NFA"$ 与 NFA 的等价性, 然后再证明 NFA 与 DFA 的等价性. 好像能一步到位, 但是我还没看懂( ToDo 证明与 NFA 的等价性需要构造 NFA $delta_N(q, a) = hat(delta)_E(q, a)$ 以及 $F_N = cases(F_E union {q_0} "if" eclose(q_0) sect F_E eq.not nothing, F_E "otherwise")$ = 正则表达式与正则语言 自动机通过识别来定义语言, 正则表达式通过规则产生语言 (或表示语言); 正则表达式所表示的语 言与正则语言等价. == 正则表达式的定义 递归定义: + $nothing$ 是正则表达式, 表示空语言, 没有任何串能匹配. + $epsilon$ 是正则表达式, 表示空串. + 对于 $a in Sigma$, $a$ 是正则表达式, 表示只有一个字符的串. + 若 $r_1, r_2$ 是正则表达式, 则 $r_1 r_2, r_1 + r_2, r_1^*, (r_1)$是正则表达式, 分别表示串的连接, 串的并, 串的闭包, 以及串运算优先级. / e.g. : $("aa")^*("bb")^*b -> {w bar w = a^(2n)b^(2m+1)}$ 优先级: $r^* gt r s gt r + s$ == 有穷自动机与正则表达式 === DFA #sym.arrow Regex ==== 递归法 将 DFA 所有状态编号为 ${1, 2, ..., n}$ 其中编号为 1 的为开始节点, 则该 DFA 对应的正则表达式为: $union.big_(j in F) R^(k)_(1j)$, 其中 $R^(k)_(i j) = {x bar hat(delta)(q_i, x) = q_j, forall w, x = w alpha, hat(delta)(q_i, w) = q_m, m lt k}$ 即, 从 $i$ 至 $j$ 且不经过 $k$ 及以上的所有串. 递推规则为: $ R_(i j)^(k) = R_(i j)^(k-1) union R_(i k)^(k-1) (R_(k k)^(k-1))^* R_(k j)^(k-1)\ R_(i j)^(0) = cases({a bar delta(q_i, a) = q_j} &"if" i eq.not j, {a bar delta(q_i, a) = q_j} union {epsilon} &"otherwise") $ 理解: 递推关系为, 从 $i$ 至 $j$ 的串, 通过不超过 $k-1$, 以及从 $i$ 至 $k$, $k$ 至 $k$, $k$ 至 $j$ 的串的连接, 以及 $k$ 至 $k$ 的串的闭包. 采用递推关系计算时: 首先应当明确结果是哪几个串的并集, 同时建议列表, 将 $k lt n$ 的部分算完, 最后一列只需要算需要的, 以避免错误. ==== 状态消除法 通过消除中间状态将 DFA 变换至只有起始节点和接受节点. #make_cols(2)[ #automaton(( q0: (q2:"p"), q1: (), q2: (q1:"q", q4:"t", q2: "c"), q3: (q2:"r"), q4: () ), initial: "", final: "", layout:( q0: (0,0), q1: (4,0), q2: (2,-2), q3: (0,-4), q4: (4,-4) ), style:( transition: (curve: 0) ) ) #automaton(( q0: (q1:"pc*q", q4:"pc*t"), q1: (), q3: (q1:"rc*q", q4:"rc*t"), q4: () ), initial: "", final: "", layout:( q0: (0,0), q1: (4,0), q2: (2,-2), q3: (0,-4), q4: (4,-4) ), style:( transition: (curve: 0, label: (pos: 0.1)) ) ) ] == 代数定律 + 交换律 + 结合律 + 分配律 + 幂等律 + 有关闭包的定律 + Others $ (L+M)^* &=L^*M^*\ L^*L^* &= L^*\ (epsilon + L)^* &= L^* $ = 正则语言的性质 == 证明非正则 泵引理 若语言 $L$ 是正则的, 则存在一个正整数 (常数) $N$, 对于任何 $w in L$, 只要 $abs(w) gt.eq N$, 则可以把 $w$ 分为三部分 $w = x y z$ 使得 + $y eq.not epsilon$ + $abs(x y) lt.eq N$ + $x y^k z in L, forall k gt 0$ == 正则语言的封闭性 正则语言在交, 并, 补, 差, 连接和克林闭包运算下保持封闭. 并, 连接, 克林闭包由 regex 定义得出. 补可由定义自动机得出 ($F' = Q - F$). 其他集合运算可由并补得证. 正则语言在反转运算下封闭, 根据 regex 定义, 归纳证明. 正则语言在同态, 逆同态映射下封闭, 同样递归证明. == 正则语言的判定性质 === 空性, 有穷性, 无穷性 具有 $n$ 个状态的自动机 $M$ 接受串的集合为 $S$, 有: + $S$ 非空, 当且仅当 $M$ 接受某个长度小于 $n$ 的串. + $S$ 无穷, 当且仅当 $M$ 接受某个长度为 $m$ 的串, $n lt.eq m lt 2n$. === 等价性 存在一个算法, 判定两个有穷自动机是否等价 (是否接受同一语言). == 自动机最小化 DFA中,称两个状态 $p$ 和 $q$ 是等价的,如果对任意串 $w in Sigma$ 满足: $ hat(delta)(p, w) arrow.l.r.double hat(delta)(q, w) $ 同时在或者同时不在接受集. 反之称为可区分. === 填表算法 慢慢找喽. 重复以下过程,直到表中内容不再改变:若存在一个未标记状态 ${p, q}$, 且对于某个 $a in Sigma, {delta(p, a), delta(q, a)}$ 已做标记,则在 ${p, q}$ 对应格子内做标记 == 上下文无关文法/语言 === CFG 定义 上下文无关文法 (CFG) 由四元组 $G = (V, Sigma, P, S)$ 定义, 其中: + $V$ 是变元, 非终结符集合 + $Sigma$ 是终结符集合 + $P$ 是产生式集合 + $S$ 是开始符号 === 派生 分析文法和串的关系, 可以由产生式的头向产生式的体分析, 称为派生或推导 (derivation), 也可以由产生式的体向头分析, 称为递归推理 (recursive inference) 或归约 (reduction). CFG $G = (V, T, P, S)$, 设 $alpha, beta, gamma in (V union T)^* 且 A in V$ , 如果 $A arrow.r gamma$ 是 $G$ 的产生式, 那么称在文法 $G$ 中由 $alpha A beta$ 可派生出 $alpha gamma beta$, 记为 $alpha A beta arrow.r.double_G alpha gamma beta$ 最左派生, 最右派生: 字面意思, 每次只能派生最左或最右的变元. === 文法产生的语言 $L(G) = {w bar w in T^* ,S arrow.r.double_G^* w}$ === 句型 能由初始符号派生出来的串, 称为句型. == 语法分析树 语法分析树是一个树, 其中叶子节点是终结符, 内部节点是非终结符, 根节点是开始符号. 如果内节点的标记是 A, 其子节点从左至右分别为 $t_1, t_2, ..., t_n$, 则 $A -> t_1 t_2 ... t_n$ 是一个产生式. 语法分析树的全部叶节点从左到右连接起来, 称为该树的产物 语法树和派生等价 == 歧义 如果 CFG $G$ 使某些串有两棵不同的语法分析树, 则称 $G$ 是歧义 (ambiguity) 的, 也称二义性的. 产生同样的语言可以有多种文法, 如果上下文无关的语言 $L$ 的所有文法都是歧义的, 那么称 $L$ 是 固有歧义 (Inherent Ambiguity) 的. 这样的语言是确实存在的. “判定任何给定 CFG "G" 是否是歧义的”是一个不可判定问题. == 文法化简 文法化简的主要内容包括: + 消除无用符号: 在派生过程中没有用到的符号 + 消除空产生式: $epsilon$ + 消除单元产生式: $A->B$ === 消除无用符号 符号 $X in (V union U)$, 如果由初始符号 $S arrow.r.double^* alpha X beta$, 称 $X$ 是可达的 (reachable); 如果有 $alpha X beta arrow.r.double^* w (w in T^*)$, 称 $X$ 是产生的 (generating). 如果 $X$ 同时是产生的和可达的, 即 $S arrow.r.double^* alpha X beta arrow.r.double^* w (w in T^*)$, 称 $X$ 是有用的, 否则称为无用符号. 从文法中消除无用符号, 同时不改变文法产生的语言. 每个非空的 CFL 都能被一个不带无用符号的 CFG 产生. 注意, 此处判断一个符号是否可达/产生不仅需要考虑符号本身还要考虑符号推到出的符号. #make_cols(3)[ 文法定义 $S -> A B bar b\ A -> a$ 消除非产生 $S -> b\ A -> a$ 消除非可达 $S -> b$ ] === 消除空产生式 先确定全部可空的变元: + 如果A→ε,则A是可空的; + 如果 $B → alpha$ 且 $alpha$ 中的每个符号都是可空的, 则 $B$ 是可空的 再替换全部带有可空符号的产生式, 如果 $A → X_1 X_2 ... X_n$ 是产生式, 那么用所有的 $A → Y_1 Y_2 ... Y_n$ 产生式代替, 其中: + 若 $X_i$ 不是可空的,则 $Y_i = X_i$ + 若 $X_i$ 是可空的,则 $Y_i$ 是 $X_i$ 或 $epsilon$ + 但 $Y_i$ 不能全部为 $epsilon$. === 消除单元产生式 先确定所有的单元对$(A,B) "满足" A arrow.r.double^* B$, 若存在 $B->alpha$ 为非单元产生式, 则将 $A->alpha$ 加入产生式集合, 最后删除所有单元产生式. 文法简化步骤的顺序是重要的, 一个可靠的顺序是: + 消除 ε 产生式; + 消除单元产生式; + 消除非产生的无用符号; + 消除非可达的无用符号. == 乔姆斯基范式和格雷巴赫范式 文法格式的限制通过两个范式定理给出: 乔姆斯基范式 (Chomsky Normal Form, CNF) 定理和格雷巴赫范式 (Greibach Normal Form, GNF) 定理. === 乔姆斯基范式 每个不带 $epsilon$ 的 CFL 都可以由这样的 CFG $G$ 产生, $G$ 中所有产生式 的形式或为 $A -> B C$, 或为 $A -> a$, 这里的 $A, B$ 和 $C$ 是变元, $a$ 是终结符. 利用 CNF 派生长度为 n 的串, 刚好需要 2n - 1 步, 因此可以设计算法判断串是否在 CFL 中. 此外利用 CNF 可以实现多项式时间的解析算法 (CYK 算法). === 格雷巴赫范式 每个不带 $epsilon$ 的 CFL 都可以由这样的 CFG $G$ 产生, $G$ 中的每个产生 式的形式为 $A -> a alpha$, 这里 $A$ 是变元, $a$ 是终结符, $alpha$ 是零个或多个变元的串. 因为格雷巴赫范式的每个产生式都会引入一个终结符, 所以长度为 n 的串的派生恰好是 n 步. 转换方法ToDo 暂时没搞清楚这几个东西的设计意图. == PDA 下推自动机 (Pushdown Automata, PDA) $P$ 的形式定义, 为七元组 $P = (Q, Sigma, Gamma, delta, q_0 , Z_0 , F )$: + $Q$ 是状态集合 + $Sigma$ 是输入字母表 + $Gamma$ 是栈字母表 + $delta$ 是状态转移函数 + $q_0$ 是初始状态 + $Z_0$ 是初始栈符号 + $F$ 是接受状态集合 === PDA 的状态转移 $delta(q,a,Z) = {(p_1, beta_1), ..., (p_n, beta_n)}$ 输入符号是 $a$, 栈顶符号 $Z$ 的情况下, 处于状态 $q$ 的 PDA 能够进入状态 $p_i$, 且用符号串 $beta_i$ 替换栈顶的符号 $Z$, 这里的 $i$ 是任意的, 然后输入头前进一个符号. 图形表示: #align(center)[ #automaton(( q0: (q1: "a,Z/beta"), q1: () ), initial: "", final: "", layout: ( q0: (0,0), q1: (4,0) ), style: ( transition: (curve: 0) )) ] === ID, ID 转移符号 ID 瞬时描述: $(q, w, gamma) in Q times Sigma^* times Gamma^*$ 分别表示: 状态, 剩余输入串, 栈符号串. ID 转移符号: $tack.r_P space tack.r_P^*$ 用于表示 ID 的转移 $"ID"_1 tack.r_P "ID"_2$ === PDA 接受的语言 终态接受和空栈接受, 两者可以相互转换.
https://github.com/BreakingLead/note
https://raw.githubusercontent.com/BreakingLead/note/main/Math/uncategorized/formulas.typ
typst
#import "../template-mathnote.typ": * $ P(n): forall a_n >= 0, ((a_1+a_2+...+a_n)/n) >= root(n,a_1+a_2+...+a_n) $ 想要证明 $P(n)$ 对任意
https://github.com/francescoo22/masters-thesis
https://raw.githubusercontent.com/francescoo22/masters-thesis/main/vars/proofs/push.typ
typst
#import "../../config/proof-tree.typ": * #import "../../config/utils.typ": * #let template = prooftree( axiom($$), rule(label: "", $$), ) #let push-1 = prooftree( axiom($push(this\: unique borrowed, value: unique): shared {...}$), rule(label: "M-type-1", $mtype(push) = unique borrowed, unique -> shared$), axiom($push(this\: unique borrowed, value: unique): shared {...}$), rule(label: "M-args", $args(push) = this, value$), rule(n:2, label: "Begin", $dot tr begin_push tl this: unique borrowed, value: unique$), ) #let push-2 = prooftree( axiom($r != this$), axiom($r != value$), axiom($r in.not dot$), rule(n:2, label: "Not-In-Rec", $r in.not value: unique$), rule(n:2, label: "Not-In-Rec", $r in.not this: unique borrowed, value: unique$), rule(label: "Decl", $this: unique borrowed, value: unique tr var r tl this: unique borrowed, value: unique, r: top$), ) #let push-3 = { let a1 = $this."root" subset.sq.eq.not r$ let a2 = $Delta(r) = top$ let a3 = $Delta(this."root") = unique borrowed$ let a4 = $unique != top$ let a5 = $(dot = borrowed) => (unique = unique)$ let a6 = $Delta[this."root" |-> top] = Delta, this."root": top equiv Delta_1$ let a7 = $Delta tr sp(this."root") = dot$ let a8 = $Delta_1 [r |-> unique] = Delta'$ prooftree( stacked-axiom((a1,a2,a3,a4, a5), (a6, a7, a8)), rule(label: "", $Delta equiv this: unique borrowed, value: unique, r: top tr r = this."root" tl this: unique borrowed, value: unique, r: unique, this."root": top equiv Delta'$), ) }
https://github.com/WShohei/presentation
https://raw.githubusercontent.com/WShohei/presentation/master/lab/0515/slide/templates/metadata.typ
typst
#let beamer_format = (16, 9) #let theme_background = blue.darken(30%) #let theme_text = white #let font = "Times New Roman" #let presentation_title = "Pytorch チュートリアル" #let presentation_subtitle = "" #let author = "<NAME>" #let date = "2024-05-15"
https://github.com/MilanR312/ugent_typst_template
https://raw.githubusercontent.com/MilanR312/ugent_typst_template/main/template/methods/table_notes.typ
typst
MIT License
#let global_table_counters = state("gtc", (:)) #let global_table_state = state("gts", (:)) #let note(body, caption: none) = { [\_internalNoteMarker#(caption)internalsplitpoint#body] } #let init_note_tables(body) = { show table: t => context { let table_num = counter(figure.where(kind: table)).get().first() global_table_counters.update(s => { s.insert(str(table_num), counter(str(table_num))) s }) global_table_state.update(s => { s.insert(str(table_num), (:)) s }) t align(left, text(size: 10pt)[ #context{ for (idx,note) in global_table_state.final().at(str(table_num)).pairs() { if note == [] { continue } [#idx: #note] linebreak() } } ] ) } show table.cell: c => context { if not c.body.has("children"){ return c } let children = c.body.children if children.len() < 2 { return c } if not (children.at(0) == [\_] and children.at(1) == [internalNoteMarker]){ return c } let remaining = children.slice(2) let split_index = remaining.position(c => c == [internalsplitpoint]) let caption = remaining.slice(0, split_index).join() let text = remaining.slice(split_index+1).join() let table_num = counter(figure.where(kind: table)).get().first() global_table_counters.get().at(str(table_num)).step() let x = global_table_counters.get().at(str(table_num)).get().first() global_table_state.update(s => { let data = s.at(str(table_num)) data.insert(str(x+1), caption) s.insert(str(table_num), data) s }) let note_block = place.with(top + right) table.cell( align: c.align, breakable: c.breakable, colspan: c.colspan, fill: c.fill, inset: c.inset, rowspan: c.rowspan, stroke: c.stroke, x: c.x, y: c.y )[ #pad(right: 10pt, top: 2pt)[#text] #note_block[#(x+1)] ] } body }
https://github.com/funnyboy-roks/school
https://raw.githubusercontent.com/funnyboy-roks/school/2024-fall/STAT-405/exam-1.typ
typst
#import "@preview/lemmify:0.1.5": * #let notin = math.class( "relation", $cancel(in)$, ) #let choose(top, bottom) = $mat(top; bottom)$ #let my-thm-style( thm-type, name, number, body ) = grid( columns: (1fr, 3fr), column-gutter: 1em, stack(spacing: .5em, [#strong(thm-type) #number], emph(name)), body ) #let my-styling = ( thm-styling: my-thm-style, thm-numbering: _ => none ) #let ( definition: def, theorem, proof, lemma, rules, example ) = default-theorems("thm-group", lang: "en", ..my-styling) #show: rules #let ( exercise, prop, rules ) = new-theorems("thm-group", ("exercise": "Exercise", "prop": "Proposition"), ..my-styling) #show: rules #show thm-selector("thm-group"): box.with(inset: 0.8em) #show thm-selector("thm-group", subgroup: "theorem"): it => box(it, fill: rgb("#eeffee")) #let frame(stroke) = (x, y) => ( right: if x == 0 { stroke } else { none }, bottom: if y == 0 { stroke } else { none }, ); #set table( stroke: frame(1pt + rgb("666675")) ) = Exam 1 == Chapter 1 #def(name: "Population")[The total listing of all possible subjects in an expirament] #def(name: "Sample")[A small portion (subset) of population] #def(name: "Variable")[The item / quality / quantity being observed] #def(name: "Branches of Statistics")[Descriptive vs Inferential] We present data: - chart/list (i.e., spreadsheet) - graphs - Histogram - Dot Plot - Stem and Leaf - Pie - Venn diagrams - Box and whisker We are conserned with two things: 1. Centre - three methods for getting the centre - Mean - Sample mean ($overline(x)$) - Population mean ($mu$) - Median - "Middle" value - Mode - most repeated value 2. Spread - Box and whisker plot - 5 Score summary - Low 25th percentile - Median 50th percentile - Top 75th percentile - Range: $"High" - "Low"$ - Variance\* - Sample: $S^2 = sum(x-overline(x))^2/underbracket(n-1, "deg of freedom") = S_(x x)/(n-1)$ - $sqrt(S^2) = S$: standard deviation - pq: $sigma^2 = sum(x-overline(x))^2/n$ == Chapter 2 Complement = (if $E$ is our dataset) $E'$ or $E^C$ \ Union = $union$ \ Intersection = $sect$ \ Emptyset = $emptyset$ \ Properties of probability 1. $0 <= p(E) <= 1$ 2. $sum p(E) = 1$ 3. For discrete data: $p(E) = (n E)/(n S)$ 4. $p(E') = 1 - p(E)$ 5. $p(A union B) = p(A) + p(B) - p(A sect B)$ since $p(E) = (n E)/(n S)$, counting becomes essential: 1. List/chart all possibilities (Venn diagram) - Flip 3 coins: sample space is the 8 possibilities: HHH, HHT, HTH, HTT, ... 2. Multi property: if $m$ separate events each with $n_i$ outcomes, then total number of possible outcomes is product of $n_i$ (aka: $product ^m n_i$) 3. permutation: $attach(P, bl: n, br: r)$ - number of ways $n$ items may be ordered, taken $r$ at a time: $n! / (n - r)!$ 4. Order does _not_ matter: combination: $attach(C, bl: n, br: r) = choose(n, r) = n!/(r! (n-r)!)$ Conditional Probability $P(A | B)$: Probability of $A$ occurring given $B$ has occurred. This has the effect of reducing sample size to the total outcome for $B$. #example[ #table( columns: (auto, auto, auto), table.header([], $B$, $B'$), $A$, $2$, $6$, $A'$, $1$, $9$, ) Prob Good: $P(B) = (n B)/(n S) = 3/18 = 1/6$ \ Prob good given from $A$: $P(B | A) = (n B)/(n S) = 2/8 = 1/4$ $ P(B | A) = P(B sect A) / P(A) $ $ P(B sect A) &= P(B | A) dot P(A) \ P(B union A) &= P(B) + P(A) P(B sect A) $ ] If two events, $A$ and $B$ are independent, $P(A sect B) = P(A) dot P(B)$ == Chapter 3 Random Variables 2 types: 1. Discrete 2. Continuious Random variable values have their onw probabilities We asseble (distribute) these probabilities in P.D.F. (Probability Distribution Function/Probability Density Function), where: $ x: "Variable" \ P(X): "PDF" $ PDFs are represented: - Charts - Graphs - Function #example[ Flip 3 coins (\#heads = x) \ $ 0 &=> "TTT" &=> 1/8 \ 1 &=> "HTT", "THT", "TTH" &=> 3/8 \ 2 &=> "HHT", "HTH", "THH" &=> 3/8 \ 3 &=> "HHH" &=> 1/8 \ $ OR: #table( columns: 5, table.header($x$, $0$, $1$, $2$, $3$), $P(x)$, $1/8$, $3/8$, $3/8$, $1/8$ ) ] #example[ Six boxes of components are ready to be shipped by a certain supplier. The number of defective components in each box is as follows: #table( columns: 7, table.header([Box], $1$, $2$, $3$, $4$, $5$, $6$), [Number of defectives], $0$, $2$, $0$, $1$, $2$, $0$ ) PDF: #table( columns: 4, table.header($x$, $0$, $1$, $2$), $P(x)$, $3/6$, $1/6$, $3/6$ ) $P(0) = 3/6 = 1/2$ Cumulative distribution function: if $f(x)$ is PDF $P(x: X)$ CDF: #table( columns: 4, table.header($x$, $0$, $1$, $2$), $C(x)$, $3/6$, $4/6$, $6/6$ ) CDF: $F(X) = p(x <= X)$ ] #example[ #table( columns: 6, table.header($x$, $1$, $2$, $4$, $8$, $16$), $P(x)$, $0.05$, $0.1$, $0.35$, $0.4$, $0.1$ ) $P(2 <= x <= 4) = 0.1 + 0.35 = 0.45$ ] For Discrete random vars: Expected value (centre) $mu = sum (x dot p(X)) = E(x)$ (weighted avg) Spread: Standard Deviation: $sigma = sqrt(V(x))$ $ V(x) = sum (x - mu)^2 dot P((x) = E[(x-mu)^2] $ (Refer to lecture video for example) Alternative method (potentially faster): $ V(x) = E(x^2) - [E(x)]^2 $ Algebra of expected values: $ E(a x + b) &= E(a x) + E(b) = a E(x) + E(b) = a mu + b \ V(a x + b) &= V(a x) + V(b) = a^2 V(x) + 0 \ $ #example[ if $E(x) = -5$ and $V(x) = 5$, what is $E[(4+2x)^2]$? $ E(16 + 16x + 4x^2) &= E(16) + 16 E(x) + 4 E(x^2) \ &= 16 + 16(-5) + 4(E(x^2)) $ if $ V(x) &= E(x^2) - [E(x)]^2 \ 5 &= E(x^2) -[-5]^2 \ 5 &= E(x^2) - 25 \ 30 &= E(x^2) $ $==>$ $ E(16 + 16x + 4x^2) &= E(16) + 16 E(x) + 4 E(x^2) \ &= 16 + 16(-5) + 4(E(x^2)) \ &= 16 + 16(-5) + 4(30) $ #line(length: 100%, stroke: 0.5pt + rgb("666675")) $ V(2 + 5 x) = a^2 V(x) = 5^2(5) = 125 $ ] === Chapter 3.4 Binomial PDF (Bernoulli) 1. The expirment consistes of a sequence of $n$ smaller experiments called _trials_ where $n$ is fixed in advance of the experiment 2. Each triel can result in one of the same two possible outcomes (dichotomous trials), which we generically denote by success ($S$) and failure ($F$). 3. The trials are independent, so that the outcome on any particular trial does not influence the outcome on any other trial 4. The probability of success $P(S)$ is constant from trial to trial; we denote this probability by $p$ Bernoulli (Binomial) Distribution: $ b(x; n, p) = choose(n, x) p^x (1 - p)^(n-x) $ #example(name: [(Inherit from coins)])[ $ b(x; 3, 1/2) &= 3!/(x!(3-x)!) (1/2)^x (1-1/2)^(3-x) \ b(0; 3, 1/2) &= 3!/(0!(3)!) (1/2)^0 (1-1/2)^(3) = 1/8 \ $ ] #example(name: [Gas pump oil problem from HW])[ (1/8 cars need oil, 4 cars pass) $n = 4$ \ success: need oil \ $P = 1/8$ $P(x = 1) = b(1; 4, 1/8) &= choose(1, 4) (1/8)^1 (7/8)^3 \ &= 4!/(1!3!) (1/8) (7/3)^3 \ &= 0.335$ ] for binomial distrubtion: $E(x) = n p$ \ $V(x) = n p (1 - p)$
https://github.com/persello/Serifian
https://raw.githubusercontent.com/persello/Serifian/main/README.md
markdown
# Serifian Serifian is a Typst client for iPadOS.
https://github.com/OverflowCat/BUAA-Data-and-Error-Analysis-Sp2024
https://raw.githubusercontent.com/OverflowCat/BUAA-Data-and-Error-Analysis-Sp2024/neko/project-2/main.typ
typst
#import "./regression.typ": regression, transpose #import "./cuda.typ": roman #import "./helper.typ": hr, r0 #import "./vendor/lib.typ": round #import "./private.typ": * #import "@preview/pinit:0.1.4": * #import "@preview/unify:0.5.0": num, qty #set text(lang: "zh", cjk-latin-spacing: auto, font: "Noto Serif CJK SC") #show heading.where(level: 1): set text(font: "Noto Sans CJK SC", size: 1.2em) #show heading.where(level: 2): set text(size: 1.1em) #show "。": "." #show heading.where(level: 3): set text(font: "Noto Sans CJK SC", size: 1.05em) #show "Romanovsky": "罗曼诺夫斯基准则" #show "3sigma": [$3 sigma$ 准则] #import "@preview/touying:0.4.0": * #let s = themes.metropolis.register(aspect-ratio: "16-9") #let s = (s.methods.info)( self: s, title: [局部放电检测系统的数据分析和处理], subtitle: [*误差理论与数据处理* 第二次讨论课], author: author_info, date: datetime( year: 2024, month: 5, day: 14, ), institution: [北京航空航天大学], toc: none ) #let (init, slides, touying-outline) = utils.methods(s) #show: init #let (slide, empty-slide) = utils.slides(s) #show: slides // = 第二次大作业 == 选题依据及理由 局部放电普遍存在于变压器、电力电缆、开关柜、等电力设备的运行过程中,设备的局部放电会伴随各种电、光、声等复杂的现象。而电气设备绝缘故障早期阶段通常表现为局部放电,对局部放电进行实时在线检测,尽早识别并能迅速准确找到局部放电发生位置是保障电力设备乃至电网安全运行所迫切需要解决的问题。 #figure(caption: "电力电缆绝缘故障引发火灾", stack( image("./fire-1.png", height: 8cm), image("./fire-2.jpg", height: 8cm), dir: ltr, spacing: .2cm ) ) 按照实现的技术手段和检测方法的基本原理进行分类,局部放电的检测方法分为直接法和间接法。直接法的理论基础是经典电路理论,如脉冲电流法,间接法就是基于以上物理现象逐渐衍生出的多种局部放电检测方法,如化学法、光学法、电磁法、声波法、热扫描法和测温法等,常用的局部放电检测方法特性如@comparison 所示。 #import "@preview/tablem:0.1.0": tablem #figure( caption: "局部放电检测方法特性比较", tablem[ | *检测方法* | *优点* | *缺点* | *可达精度* | *实际应用* | |---|---|---|---|---| | 脉冲电流检测法 | 方法简单,灵敏度高 | 不能在线检测 | 5 pC | 早期应用较多 | | 超高频法 | 灵敏度高,在线检测 | 造价高 | $0.5"~ "#qty(0.8, "pC")$ | 应用多 | | 超声波 | 不受电磁干扰 | 信号衰减大,距离有限 | $<#qty(2, "pC")$ | 应用多 | | 化学法 | 不受电磁干扰 | 灵敏度差,不能长时间监测 | 差 | 极少应用 | | 光检测法 | 不受电磁干扰 | 灵敏度差,需多个传感器 | 差 | 极少应用 | ] )<comparison> /* 常见的局部放电检测方式有: - 脉冲电流法 - 超高频检测法 - 介质损耗分析法 - 无线电干扰电压法 - 局部放电光纤传感检测法 */ 脉冲电流法通过检测局部放电在接地线上产生的电流来检测局部放电,能及时发现电力设备的缺陷;可以评估缺陷损坏程度;校准方法比较有效,能对局部放电定量分析。 根据脉冲电流法测局部放电,可以得到放电量与电压的关系。但是其中会存在误差需要修正,我们选择这个题目分析误差源并且得到更精准的测量方案。 == 测量方案 #let scheme = image("./diagram.png", height: 80%) #figure(caption: "局部放电测试系统框图", scheme) == 原始数据 // 放电量 #let x = (50, 200, 300, 500, 800) // 电压 #let y = ( (0.17, 0.16, 0.19, 0.20, 0.19, 0.19, 0.28, 0.23, 0.20), (0.31, 0.44, 0.40, 0.34, 0.33, 0.44, 0.38, 0.28, 0.33), (0.68, 0.48, 0.65, 0.66, 0.93, 0.64, 0.65, 0.82, 0.62), (1.05, 0.88, 0.92, 0.60, 1.02, 1.00, 1.40, 1.15, 1.07), (1.93, 1.50, 1.97, 2.30, 1.86, 1.80, 2.00, 1.99, 1.92), ) #let m = 9 #table(columns: range(m+1).map(_ => auto), table.header( table.cell(rowspan: 2)[放电量#"\n"$"/pC"$], table.cell(colspan: m, align: center)[电压$"/V"$], ..range(m).map(x => [#(x+1)]) ), ..y.enumerate().map(group => ([#x.at(group.at(0))], ..group.at(1).map(x => r0(x)))).flatten() ) // y 的数据还需要预处理去掉粗大误差 == 粗大误差的剔除 #let alpha = .05 由于重复测量的数据组数小于10,数据不一定符合正态分布,无法使用 3sigma。 使用Romanovsky剔除粗大误差。选取显著度水平 $#sym.alpha=#alpha$。 每组数据都是等精度独立测量。 #"\n\n" #hr #let y_ = y #for (i, (x, group)) in x.zip(y).enumerate() { [当放电量为 #qty(x, "pC") 时,] let (content, group_) = roman(group, alpha) content y_.at(i) = group_ hr } == 剔除粗大误差后的数据 #table( columns: range(m+1).map(_ => 1fr), table.header("N", ..range(m).map(x => [#(x+1)])), ..x.zip(y_).map(((x, g)) => { let cells = g.map(c => r0(c) + " V") for i in range(m - g.len()) { cells.push(table.cell(align: center, line(length: 3.5em, angle: 14deg))) } (table.cell([#x pC], align: right), ..cells) }).flatten() ) #regression( x, y_, x_unit: "pC", y_unit: $upright(V)$ // https://github.com/typst/typst/issues/366#issuecomment-1868963477 ) == 误差源分析 #scheme #pagebreak() === 传感器导致的误差 - 由于在放电过程中存在放热现象,传感器并不能工作在稳定的环境内,由于温度变化,传感器温漂将会带来误差。 - 如果传感器的响应时间较慢,测得的电压值会小于局部放电的瞬时的电压峰值。 - 如果传感器的分辨力不足,将会导致测量值的精确度不够,使得误差增大。 === 数据传输和存储造成的误差 - RS485/232作为串口通信的功能,若没有选择校验方式,则接收到的数据流可能会因噪声、干扰、失真或比特同步错误而使流中的某一个或几个比特翻转。 #figure(caption: "RS485/232通信模块", image("./rs.jpg", width: 70%)) - 未使用 ECC 的 SRAM 存储器也有可能发生比特翻转,导致数据错误。 #figure(caption: "SRAM存储器的可能的比特错误发生方式", image("./sram-bit-error-e.svg", width: 61%)) === 放大器及滤波电路模块 由于环境中的电磁干扰带来的噪声影响,如果滤波器并未完全消除噪声,放大器将会增大噪声对于所测数据的影响,导致误差增大。 === ADC模数转换器 在采样过程中,由于采样频率低,采样周期长,对于电压信号的测量范围的覆盖不够全面,也会导致测量不到电压峰值,使测量值偏低。 === 环境因素带来的误差 环境条件由于放电过程所伴随的电、声、光、热等现象,会持续改变,由此导致环境因素的不稳定,系统将会受到影响,使得误差增大。 == 系统精度提高方案 === 选择合适的校验方式 奇偶校验能够检测出信息传输过程中的部分误码(1位误码能检出,2位及2位以上误码不能检出),使用简单,同时,它不能纠错。在发现错误后,只能要求重发。CRC循环冗余校验。检错和纠错能力强,可以用于实现差错控制。 === 改进采样方式 根据 Nyquist 采样定理,为了正确地重构一个信号,采样频率应至少为信号最高频率的两倍。如果采样频率低于这个标准,就会发生欠采样。因此,对于 ADC,可以增大采样频率,增大采样带宽,得到更多的数据量,保证信号峰值被测量到。 === 减少电磁干扰 确保所有设备都正确接地,使用屏蔽电缆和屏蔽组件。 === 更换传感器 选择更稳定的传感器,并在使用前校准。 === 选择更好的测量方案 局部放电光纤传感检测法是目前较为常见的检测方法。因其能够实现长距离、分布式、快速实时检测,且所用传感光纤具有本质安全,抗电磁干扰,铺设灵活等优点为局部放电的检测提供了新的思路。 自从Bucaro等人于1977年首次报道了使用光纤 Mach-Zehnder 干涉仪进行声检测以来,*光纤干涉传感器已成为声学测量的重要技术*。2007 年,IEEE 标准规定局部放电产生的超声波范围为 $50 "~ " #qty(300, "kHz")$。2014 年,王伟等人提出了一种基 Fabry-Perot 干涉仪的声传感器,并*验证了局部放电电荷量与局放超声信号幅值之间的关系*。 @sagnac 是基于Sagnac干涉仪的多点局部放电检测系统。 #figure(caption: "检测系统结构示意图")[ #image("./sagnac.png", width: 85%) ]<sagnac> 由于使用的光纤具有抗电磁干扰、绝缘性能极佳、体积小、布置方式灵活、灵敏度高、耐腐蚀等特点,工作状态不会受到影响。抗干扰能力更强。 /* = 例 #let x=(19.1, 25.0, 30.1, 36.0, 40.0, 46.5, 50.0) #let y=(76.30, 77.80, 79.75, 80.80, 82.35, 83.90, 85.10) #regression(x, y) #pagebreak() = 实验 #let x = (10, 15, 20, 25, 30, 35, 40, 45, 50) #let y = (-0.225, -0.288, -0.319, -0.350, -0.382, -0.445, -0.445, -0.476, -0.445) #regression(x, y, x_unit: "V", y_unit: [(m$dot$s$#h(0.01cm)^(-2))$]) = 5-1 // 正应力x/Pa #let x = (26.8, 25.4, 28.9, 23.6, 27.7, 23.9, 24.7, 28.1, 26.9, 27.4, 22.6, 25.6) // 抗剪强度y/Pa #let y = (26.5, 27.3, 24.2, 27.1, 23.6, 25.9, 26.3, 22.5, 21.7, 21.4, 25.8, 24.9) #regression(x, y, x_unit: $"Pa"^(-1)$, y_unit: $"Pa"^(-1)$, estimate: 24.5) #pagebreak() = 5-5 #let x = (20.3, 28.1, 35.5, 42.0, 50.7, 58.6, 65.9, 74.9, 80.3, 86.4) #let y = (416, 386, 368, 337, 305, 282, 258, 224, 201, 183) #regression(x, y, x_unit: "%", y_unit: sym.degree.c, estimate: 60.0, control: (310, 345)) = 5-7 #let x = ( 5, 10, 15, 20, 25, 30, ) #let y = ( (7.28, 8.06, 8.90, 9.98, 10.8, 11.5), (7.23, 8.08, 8.97, 9.91, 10.7, 11.8), (7.26, 8.15, 9.00, 9.86, 10.8, 11.6), (7.25, 8.15, 8.94, 9.84, 11.5, 11.9), (7.23, 8.16, 8.94, 9.91, 10.7, 12.2), ) #regression(x, y, x_unit: "g", y_unit: "cm") */ #pagebreak() = 敬请批评指正
https://github.com/TimPaasche/Typst.Template.Thesis
https://raw.githubusercontent.com/TimPaasche/Typst.Template.Thesis/main/template/style.typ
typst
MIT License
// +-------------------------------------------+ // | STYLE OF THE HEADER | // +-------------------------------------------+ #let setHeader(title: [], subtitle: [], authors: ()) = { set text(font: "Cascadia Mono", size: 10pt, weight: "bold", fill: rgb("#288733")) locate(loc => if calc.odd(loc.page()) { grid( columns: (25%,50%,25%), gutter: 0%, [ #set align(left); ], [ #set align(center); #title; #linebreak(); #subtitle ], [ #set align(right); #image("./../images/logos/HKA_EIT_Logo.jpg", height: 1cm) ]) } else { grid( columns: (25%,50%,25%), gutter: 0%, [ #set align(left); #image("./../images/logos/HKA_EIT_Logo.jpg", height: 1cm) ], [ #set align(center); #title; #linebreak(); #subtitle ], [ #set align(right); ]) } ) } // +-------------------------------------------+ // | STYLE OF THE FOOTER | // +-------------------------------------------+ #let setFooterRoman(title: [], subtitle: [], authors: ()) = { set text(font: "Cascadia Mono", size: 10pt) locate(loc => if calc.odd(loc.page()) { grid( columns: (20%,60%,20%), gutter: 0%, [ #set align(left); ], [ #set align(center); #for author in authors { author.name if(authors.last() != author){ " - " } } ], [ #set align(right); #counter(page).display("I") ]) } else { grid( columns: (20%,60%,20%), gutter: 0%, [ #set align(left); #counter(page).display("I") ], [ #set align(center); #for author in authors { author.name if(authors.last() != author){ " - " } } ], [ #set align(right); ]) } ) } #let setFooter(title: [], subtitle: [], authors: ()) = { set text(font: "Cascadia Mono", size: 10pt) locate(loc => if calc.odd(loc.page()) { grid( columns: (20%,60%,20%), gutter: 0%, [ #set align(left); ], [ #set align(center); #for author in authors { author.name if(authors.last() != author){ " - " } } ], [ #set align(right); #counter(page).display("1") ]) } else { grid( columns: (20%,60%,20%), gutter: 0%, [ #set align(left); #counter(page).display("1") ], [ #set align(center); #for author in authors { author.name if(authors.last() != author){ " - " } } ], [ #set align(right); ]) } ) } #let getSupplement(it) = { // see in "View Example": https://typst.app/docs/reference/meta/ref/#parameters-supplement if it.func() == figure and it.kind == raw { [Sourcecode] } else { // keep original it.supplement } } // +-------------------------------------------+ // | SETTINGS OF THE DOCUMENT | // +-------------------------------------------+ #let loadStyle(doc, title, subtitle, authors) = { set text( font: "Roboto", size: 12pt, lang: "de", ) set heading(numbering: "1.1.1.") show heading.where(level: 1): it => block(width: 100%)[ #set text(18pt, weight: 1200, font: "Cascadia Mono") #smallcaps(it) #v(4mm) ] show heading.where(level: 2): it => block(width: 100%)[ #set text(16pt, weight: 1000, font: "Cascadia Mono") #smallcaps(it) #v(2mm) ] show heading.where(level: 3): it => block(width: 100%)[ #set text(14pt, weight: 800, font: "Cascadia Mono") #smallcaps(it) #v(2mm) ] set page( paper: "a4", margin: ( top: 3cm, bottom: 2cm, //left: 1.5cm, //right: 1.5cm ) ) set par( justify: true, leading: 0.52em, ) outline( indent: auto, ) // show figure : it => block(width: 100%)[ // #align(center)[ // #it.body // #v(1mm) // #getSupplement(it) // #it.counter.display(it.numbering): // #it.caption.content // ] // ] show figure : set figure(gap: 5mm) show figure.where( kind: raw ): set figure(supplement: "Sourcecode") show figure.where( kind: table ): set figure.caption(position: top) set page( header: setHeader(title: title, subtitle: subtitle, authors: authors), footer: setFooter(title: title, subtitle: subtitle, authors: authors) ) counter(page).update(1) doc } // +-------------------------------------------+ // | STYLE OF THE TITLEPAGE | // +-------------------------------------------+ #let titlePage( title: [], subtitle: [], authors: (), scientificSupervisor: [], technicalSupervisor: [], abstractUS: [], abstractDE: [], oath: false, doc, ) = { set align(center) set text(font: "Cascadia Mono", size: 12pt, lang: "de") v(4mm) image(alt: "HKA-Logo", width: 12cm, "./../images/logos/HKA_EIT_Logo.jpg") v(2mm) text(weight: "bold", size: 40pt, [#title]) v(0mm) text(weight: "bold", size: 28pt, [#subtitle]) v(8mm) for author in authors { table(columns: (50%, 50%), stroke: 0mm, align: (right, left), "Name:", author.name, "Matrikelnummer:", str(author.mnr) ) } v(1cm) if(scientificSupervisor != []){ table(columns: (50%, 50%), stroke: 0mm, align: (right, left), "Wissenschaftlicher Betreuer:", [#scientificSupervisor] ) } if(technicalSupervisor != []){ table(columns: (50%, 50%), stroke: 0mm, align: (right, left), "Fachlicher Betreuer:", [#technicalSupervisor] ) } table(columns: (50%, 50%), stroke: 0mm, align: (right, left), "Datum:", [#datetime.today().display("[day].[month].[year]")] ) pagebreak() set text(font: "Roboto") set align(left) set page( header: setHeader(title: title, subtitle: subtitle, authors: authors), footer: setFooterRoman(title: title, subtitle: subtitle, authors: authors) ) if(abstractUS != []){ par(justify: false)[ #heading(outlined: false, [ #set text(18pt, weight: 1200, font: "Cascadia Mono") Abstract #v(4mm) ]) #abstractUS ] pagebreak() } if(abstractDE != []){ par(justify: false)[ #heading(outlined: false, [ #set text(18pt, weight: 1200, font: "Cascadia Mono") Zusammenfassung #v(4mm) ]) #abstractDE ] pagebreak() } if(oath){ par(justify: false)[ #heading(outlined: false, [ #set text(18pt, weight: 1200, font: "Cascadia Mono") Eidenstattliche Erklärung #v(4mm) ]) <eidesstattliche-erklärung> Ich versichere, die von mir vorgelegte Arbeit selbstständig verfasst zu haben. Alle Stellen, die wörtlich oder sinngemäß aus veröffentlichten oder nicht veröffentlichten Arbeiten anderer entnommen sind, habe ich als entnommen kenntlich gemacht. Sämtliche Quellen und Hilfsmittel, die ich für die Arbeit benutzt habe, sind angegeben. Die Arbeit hat mit gleichem Inhalt bzw. in wesentlichen Teilen noch keiner anderen Prüfungsbehörde vorgelegen. #v(6mm) I declare that I have written this thesis independently. I have labelled all passages taken verbatim or in spirit from published or unpublished works by others as having been taken from them. All sources and aids that I have used for the work are indicated. The thesis has not been submitted to any other examination authority with the same content or in substantial parts. #v(3cm) #for author in authors { [ Karlsruhe, #datetime.today().display("[day].[month].[year]") #h(42mm) (#author.name) #line( start: ( 80mm, -3mm), length: 80mm, stroke: 1pt, ) #v(8mm) ] } ] pagebreak() } loadStyle(doc, title, subtitle, authors) }
https://github.com/leesum1/brilliant-cv
https://raw.githubusercontent.com/leesum1/brilliant-cv/master/modules_zh/pullrequst.typ
typst
// Import #import "@preview/brilliant-cv:2.0.2": cvEntry, cvSection #import "@preview/fontawesome:0.4.0": * #let metadata = toml("../metadata.toml") #let cvSection = cvSection.with(metadata: metadata) #let cvEntry = cvEntry.with(metadata: metadata) #cvSection("开源贡献") #cvEntry( society: [RT-Thread], title: link("https://github.com/RT-Thread/rt-thread/pull/7040")[ #fa-icon("code-merge") rt-thread/pull/7040], date: [2023.5.13], location: [RT-Thread is an open source IoT real-time operating system (RTOS)], description: list( [修复 qemu-riscv-virt64 bsp 中 smode 下无法启动的问题,提升了系统稳定性], ), ) #cvEntry( society: [Ibex], title: link("https://github.com/lowRISC/ibex/pull/2044")[ #fa-icon("code-merge") ibex/pull/2044], date: [2023.5.31], location: [Ibex is a small 32 bit RISC-V CPU core, previously known as zero-riscy], description: list( [为 Ibex 添加了 MTVEC 的 Direct Mode 支持,完善了处理器的功能], ), ) #cvEntry( society: [xmake], title: link("https://github.com/xmake-io/xmake/pull/3944")[ #fa-icon("code-merge") xmake/pull/3944], date: [2023.7.9], location: [A cross-platform build utility based on Lua], description: list( [修复了 xmake 对 Verilator 工程构建的支持, 添加了必要的说明文档], ), ) #cvEntry( society: [riscv-tests], title: link("https://github.com/riscv-software-src/riscv-tests/pull/549")[ #fa-icon("code-merge") riscv-tests/pull/549], date: [2024.4.17], location: [This repository hosts unit tests for RISC-V processors.], description: list( [修复了 riscv-tests 中 Debug 测试集中 GDB TEST 中的初始化程序错误, 提高了测试集的兼容性], ), )
https://github.com/drupol/master-thesis
https://raw.githubusercontent.com/drupol/master-thesis/main/src/thesis/theme/UMONS-fs-logo.typ
typst
Other
#import "./common/metadata.typ": * #import "./colors.typ": * #{ set text(font: "Liberation Sans") set par(leading: 6pt) box[#image("./UMONS_FS-logo.svg", height: 60pt)] box[ #v(.7em) #text(size: .3em, fill: umons-grey)[ Faculty of\ sciences ] ] }
https://github.com/jgm/typst-hs
https://raw.githubusercontent.com/jgm/typst-hs/main/test/typ/compute/construct-02.typ
typst
Other
// Error for values that are out of range. // Error: 11-14 number must be between 0 and 255 #test(rgb(-30, 15, 50))
https://github.com/Myriad-Dreamin/typst.ts
https://raw.githubusercontent.com/Myriad-Dreamin/typst.ts/main/fuzzers/corpora/layout/page-binding_00.typ
typst
Apache License 2.0
#import "/contrib/templates/std-tests/preset.typ": * #show: test-page #set page(height: 100pt, margin: (inside: 30pt, outside: 20pt)) #set par(justify: true) #set text(size: 8pt) #page(margin: (x: 20pt), { set align(center + horizon) text(20pt, strong[Title]) v(2em, weak: true) text(15pt)[Author] }) = Introduction #lorem(35)
https://github.com/kdog3682/2024-typst
https://raw.githubusercontent.com/kdog3682/2024-typst/main/src/numberline.typ
typst
#import "base-utils.typ": * #import "cetz-setup.typ": * #let numberline(n, items) = { hline(0, n, mark: attrs.get("double-sided-arrow-mark")) let h = 0.25 for i in range(1, n) { vline(-h, h, x: i) } for item in items { let p = (item.pos, 0.5) content(p, resolve-content(item.label)) } // draw some braces connecting various items // make it stroked or dotted // working } #{ let items = ( (label: "A", pos: 3), ( label: "B", pos: 4, linkage: ( target: "A", arrow: "to" ), ), ) canvas({ numberline(5, items) }) }
https://github.com/atareao/typst-templates
https://raw.githubusercontent.com/atareao/typst-templates/main/book/example/01-chapter-01.typ
typst
MIT License
= Chapter 01 #lorem(150) ```bash #!/bin/bash echo "Hello World!" ```
https://github.com/sitandr/typst-examples-book
https://raw.githubusercontent.com/sitandr/typst-examples-book/main/src/basics/tutorial/basic_styling.md
markdown
MIT License
# Basic styling ## `Set` rule ```typ #set page(width: 15cm, margin: (left: 4cm, right: 4cm)) That was great, but using functions everywhere, especially with many arguments every time is awfully cumbersome. That's why Typst has _rules_. No, not for you, for the document. #set par(justify: true) And the first rule we will consider there is `set` rule. As you see, I've just used it on `par` (which is short from paragraph) and now all paragraphs became _justified_. It will apply to all paragraphs after the rule, but will work only in it's _scope_ (we will discuss them later). #par(justify: false)[ Of course, you can override a `set` rule. This rule just sets the _default value_ of an argument of an element. ] By the way, at first line of this snippet I've reduced page size to make justifying more visible, also increasing margins to add blank space on left and right. ``` ## A bit about length units ```typ Before we continue with rules, we should talk about length. There are several absolute length units in Typst: #set rect(height: 1em) #table( columns: 2, [Points], rect(width: 72pt), [Millimeters], rect(width: 25.4mm), [Centimeters], rect(width: 2.54cm), [Inches], rect(width: 1in), [Relative to font size], rect(width: 6.5em) ) `1 em` = current font size. \ It is a very convenient unit, so we are going to use it a lot ``` ## Setting something else Of course, you can use `set` rule with all built-in functions and all their named arguments to make some argument "default". For example, let's make all quotes in this snippet authored by the book: ```typ #set quote(block: true, attribution: [Typst Examples Book]) #quote[ Typst is great! ] #quote[ The problem with quotes on the internet is that it is hard to verify their authenticity. ] ``` ## Opinionated defaults That allows you to set Typst default styling as you want it: ```typ #set par(justify: true) #set list(indent: 1em) #set enum(indent: 1em) #set page(numbering: "1") - List item - List item + Enum item + Enum item ``` Don't complain about bad defaults! `Set` your own. ## Numbering ```typ = Numbering Some of elements have a property called "numbering". They accept so-called "numbering patterns" and are very useful with set rules. Let's see what I mean. #set heading(numbering: "I.1:") = This is first level = Another first == Second == Another second === Now third == And second again = Now returning to first = These are actual romanian numerals ``` Of course, there are lots of other cool properties that can be _set_, so feel free to dive into [Official Reference](https://typst.app/docs/reference/) and explore them! And now we are moving into something much more interesting…
https://github.com/mem-courses/discrete-mathmatics
https://raw.githubusercontent.com/mem-courses/discrete-mathmatics/main/homework/week6.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 #6: Fundamentals of Counting", authors: (( name: "<NAME>", email: "<EMAIL>", id: "A10" ),), semester: "Spring-Summer 2024", date: "April 2, 2024", ) = 6.1 The Basic of Counting #hw("41")[ A palindrome is a string whose reversal is identical to the string. How many bit strings of length $n$ are palindromes? ][ For the first $ceil(n/2)$ numbers, they can be arbitrarily chosen between $0$ or $1$; And for the remaining $n-ceil(n/2)$ numbers, they can be determined by the property of palindromes. Thus, the answer is the product of $ceil(n/2)$ 2s. That's to say, the answer is $2^ceil(n/2)$. ] #hw("58")[ The name of a variable in the C programming language is a string that can contain uppercase letters, lowercase letters, digits, or underscores. Further, the first character in the string must be a letter, either uppercase or lowercase, or an underscore. If the name of a variable is determined by its first eight characters, how many different variables can be named in C? (Note that the name of a variable may contain fewer than eight characters.) ][ For the first character, there are $26+26+1 = 53$ choices. For the rest at most 7 characters, they have $26+26+1+10 = 63$ choices. The number of variables of length $1$ to $8$ is: $ S = sum_(i=0)^7 53 times 63^i = 53 times (63^8-1)/(63-1) = 212133167002880 $ ] #hw("70")[ (a) Suppose that a store sells six varieties of soft drinks: cola, ginger ale, orange, root beer, lemonade, and cream soda. Use a tree diagram to determine the number of different types of bottles the store must stock to have all varieties available in all size bottles if all varieties are available in 12-ounce bottles, all but lemonade are available in 20-ounce bottles, only cola and ginger ale are available in 32-ounce bottles, and all but lemonade and cream soda are available in 64-ounce bottles? (b) Answer the question in part (a) using counting rules. ][ #parts( a: align(center, image("./images/6-1 solution-70.jpg", width: 28%)), b: [ Using the sum rule, the answer is $6+5+2+4 = 17$. ] ) ] = 6.2 The Pigeonhole Principle #hw("12")[ Let $(x_i, y_i), space i = 1, 2, 3, 4, 5$, be a set of five distinct points with integer coordinates in the $x y$ plane. Show that the midpoint of the line joining at least one pair of these points has integer coordinates. ][ Pigeonholes: 4 holes representing pairs of the remainders of the coordinates module 2 as $(0,0),space (0,1),space (1,0)$ and $(1,1)$. Pigeons: 5 points representing 5 pigeons. By the pigeonhold principle, at least two points are put into the same pigeonhole, which means the differences of coordinates of two points are both even. That's to say, their midpoint has integer coordinates. ] #hw("40")[ Find the least number of cables required to connect eight computers to four printers to guarantee that for every choice of four of the eight computers, these four computers can directly access four different printers. Justify your answer. ][ For each printer: it should be connected with at least five computers directly. Otherwise, the selection of the remaining four unconnected computers is invalid. So the answer must be at least $4 times 5 = 20$. Here, we can provide a construction where the answer is 20: let $A,B,C,D$ denote four printers, and let $1,2,3,4,5,6,7,8$ denote eight computers. The connections are: (i) Connect $A$ with $1,2,3,4,5$; (ii) Connect $B$ with $2,3,4,5,6$; (iii) Connect $C$ with $3,4,5,6,7$; (iv) Connect $D$ with $4,5,6,7,8$. It can be proved that, for any selection of four computers, there exists an match that each computer directly connect with an unique printer. Therefore, the answer is $20$. ] #hw("44")[ Is the statement in Exercise 43 true if 24 is replaced by (a) 2? (b) 23? (c) 25? (d) 30? _Exercises 43:_ An arm wrestler is the champion for a period of 75 hours. (Here, by an hour, we mean a period starting from an exact hour, such as 1 P.M., until the next hour.) The arm wrestler had at least one match an hour, but no more than 125 total matches. Show that there is a period of consecutive hours during which the arm wrestler had exatly 24 matches. ][ Proof of _exercise 43_: Let $s_i$ denote the total matches of the first $i$ days. Then $s_0 = 0$ and $1 <= s_i <= 125$ for all $i in [1, 75]$. Let $H_i$ represents the $i$-th pigeonhole where $i=0,1,dots.c,23$. By the generalized pigeonhole principle, these exsits a hole $H_k$ with at least four $s_i$ in it. Since the $s_i$ is in the range $[1,125]$. So numbers in $H_k$ could only be chosen from ${k,24+k,48+k,72+k,96+k,120+k}.$ By the pigeonhole principle again, we can derived that we have to chose at least one pair of adjacent $s_i$ from the set. (Because we are choosing 4 from 6.) That's to say, there exists a pair of $s_i$ in $H_k$ such that their differences is exactly $24$. And for _exercise 44_, we can calculate the answer through the similar method: (a) True; (b) True; (c) True; (d) True. ]
https://github.com/ern1/typiskt
https://raw.githubusercontent.com/ern1/typiskt/main/templates/typiskt.typ
typst
#import "resume.typ": * #import "cover-letter.typ": * #import "util.typ" as util #import "icons.typ" as icons #import "colors.typ" as colors #import "fonts.typ" as fonts
https://github.com/Myriad-Dreamin/typst.ts
https://raw.githubusercontent.com/Myriad-Dreamin/typst.ts/main/fuzzers/corpora/meta/document_07.typ
typst
Apache License 2.0
#import "/contrib/templates/std-tests/preset.typ": * #show: test-page // // #box[ // // Error: 4-18 page configuration is not allowed inside of containers // #set page("a4") // ]
https://github.com/Myriad-Dreamin/typst.ts
https://raw.githubusercontent.com/Myriad-Dreamin/typst.ts/main/fuzzers/corpora/layout/clip_02.typ
typst
Apache License 2.0
#import "/contrib/templates/std-tests/preset.typ": * #show: test-page // Test clipping svg glyphs Emoji: #box(height: 0.5em, stroke: 1pt + black)[🐪, 🌋, 🏞] Emoji: #box(height: 0.5em, clip: true, stroke: 1pt + black)[🐪, 🌋, 🏞]
https://github.com/Myriad-Dreamin/tinymist
https://raw.githubusercontent.com/Myriad-Dreamin/tinymist/main/crates/tinymist-query/src/fixtures/goto_definition/label_indir2.typ
typst
Apache License 2.0
// compile: true #let test1(body) = figure(body) #test1([Test1]) <fig:test1> @fig:test1 #let test2(body) = test1(body) #test2([Test2]) <fig:test2> /* position after */ @fig:test2
https://github.com/sthenic/technogram
https://raw.githubusercontent.com/sthenic/technogram/main/src/presentation.typ
typst
MIT License
#import "palette.typ": DEFAULT-PALETTE, update-palette, generate-admonition-palette, table-fill, table-stroke #import "common.typ": get-text-color /* States */ #let _current-title = state("current-title", none) #let _outline-title = state("outline-title", true) #let _header(title: auto, logotype) = context { /* The page header contains the current title typeset to the left and optionally a logotype to the right. Since a title can potentially span multiple pages, we have a state to help make life easier. However, when we're asked to typeset the header for the first page the state has not been set. We resolve this by making a query looking for the next top-level heading. */ let after = query(heading.where(level: 1).after(here())) let title-text = if _current-title.get() != none { _current-title.get() } else if after.len() > 0 { after.first().body } else { panic("The presentation needs at least one top-level heading.") } grid( columns: (auto, 1fr, auto), align: bottom, if title == auto { /* The title is automatically generated from the current context (`title-text`). Whether or not it's outline depends on if this is the first time we encounter the title or not. */ [#heading( outlined: _outline-title.get(), bookmarked: _outline-title.get(), level: 1, title-text )<technogram-presentation-heading>] _outline-title.update(false) } else if type(title) in (content, str) { /* A custom title, specified as content. Not included in the outline. */ [#heading( outlined: false, bookmarked: false, level: 1, title )<technogram-presentation-heading>] }, none, logotype, ) } #let _generate-palette(col) = { let palette = (col, col.lighten(25%), col.lighten(50%)) palette.map(x => (background: x, text: get-text-color(x))) } #let _footer(document-name, classification, palette) = context { let palette = _generate-palette(palette.primary) set text(size: 50% * text.size) v(2.7em) grid( columns: (1fr, page.width * 25%, 1fr), align: (left + bottom, center + bottom, right + bottom), text(fill: palette.at(0).text)[#document-name], text(fill: palette.at(1).text)[#classification], text(fill: palette.at(2).text)[Page #counter(page).display("1 of 1", both: true)] ) } #let _title-page(title, subtitle, author, palette, logotype) = { set page(header: _header(title: none, logotype)) let author-content = if type(author) == array { author.join(", ", last: " and ") } else { author } align(center)[ #v(33% - 1.4em) #text(weight: "bold", size: 1.4em, fill: palette.primary)[#title]\ #v(0.3em) #text(weight: "bold")[#subtitle] #v(2em) #text(size: 0.8em)[ #author-content\ #datetime.today().display("[month repr:long] [day], [year]") ] ] } #let _background(palette) = context { let generated-palette = _generate-palette(palette.primary) set text(size: 50% * text.size) let height = 2em grid( columns: (1fr, page.width * 25%, 1fr), grid.cell(colspan: 3)[#rect(width: 100%, height: 100% - height, fill: palette.background)], rect(width: 100%, height: height, fill: generated-palette.at(0).background), rect(width: 100%, height: height, fill: generated-palette.at(1).background), rect(width: 100%, height: height, fill: generated-palette.at(2).background), ) } #let _outline(logotype) = context { show outline: set par(leading: 0.8em, first-line-indent: 0pt) show outline.entry: it => { strong(it.body) } /* The outline is typeset on a custom page without a heading that shows up in the outline. */ set page(columns: 2, header: _header(title: "Contents", logotype)) outline(title: none) } #let presentation( title: none, subtitle: none, author: none, classification: "Public", url: none, logotype: none, font: "Arial", monofont: "Latin Modern Mono", fontsize: 20pt, palette-overrides: none, show-outline: false, body, ) = { /* Merge the default palette with any user overrides. */ palette-overrides = DEFAULT-PALETTE + palette-overrides let document-name = title if subtitle != none { document-name += [ --- #subtitle] } /* Page */ set page( paper: "presentation-16-9", margin: ( left: 2cm, right: 2cm, top: 4cm, bottom: 2em, ), header-ascent: 2cm, footer-descent: 0em, header: _header(logotype), footer: _footer(document-name, classification, palette-overrides), background: _background(palette-overrides), ) /* Paragraphs */ set par(leading: 0.8em, spacing: 0.8em, justify: false) /* Fonts */ set text(font: font, size: fontsize) show raw: set text(font: monofont, size: fontsize) /* Equations */ set math.equation(numbering: "(1)") /* Links (we don't color references) */ show link: set text(fill: palette-overrides.primary) /* Tables and figures */ show table.cell.where(y: 0): strong set table(fill: table-fill, stroke: table-stroke, align: left, inset: (top: 0.65em, bottom: 0.65em)) /* Don't outline or bookmark the headings by default (we're going to hijack the syntax and move them into the slide headers). */ set heading(outlined: false, bookmarked: false) _title-page(title, subtitle, author, palette-overrides, logotype) pagebreak() /* Headings --- a top-level heading begins a new slide. */ set heading(numbering: none) show heading.where(level: 1): it => context { /* If the current title has yet to be set, we're dealing with the first one. Otherwise, we insert a pagebreak, but not before updating the title to allow the header to reflect the new title. Additionally, if the title changes we toggle the outline state so this heading location is included in the outline. */ if it.at("label", default: none) == <technogram-presentation-heading> { it } else { let insert-pagebreak = _current-title.get() != none if _current-title.get() != none and _current-title.get() != it.body { _outline-title.update(true) } _current-title.update(it.body) if insert-pagebreak { pagebreak() } } } /* Conditionally insert the outline. */ if show-outline { _outline(logotype) } /* Update the global palette and generate a matching one for admonition boxes. */ set raw(theme: "raw.tmTheme") update-palette(..palette-overrides) generate-admonition-palette(palette-overrides.primary, palette-overrides.secondary) body }
https://github.com/michel-steuwer/typst-acmart
https://raw.githubusercontent.com/michel-steuwer/typst-acmart/main/README.md
markdown
MIT License
# typst-acmart Typst template mimicking acmart latex class
https://github.com/polarkac/MTG-Stories
https://raw.githubusercontent.com/polarkac/MTG-Stories/master/stories/055%20-%20Murders%20at%20Karlov%20Manor/011_Episode%2011%3A%20Portents%20and%20Omens.typ
typst
#import "@local/mtgstory:0.2.0": conf #show: doc => conf( "Episode 11: Portents and Omens", set_name: "Murders at Karlov Manor", story_date: datetime(day: 14, month: 02, year: 2024), author: "<NAME>", doc ) Proft's footsteps echoed as he walked into the chamber currently occupied by Niv-Mizzet, the Firemind and Living Guildpact. Etrata's did not. She moved beside the detective as quietly as a ghost and looked amused when he shot her an irritated glance. Niv-Mizzet turned away from the massive platinum tome he had been studying, fixing the two smaller creatures with a look. "Ah, my guests," he said. "Getting an appointment was no easy feat," said Proft. "It isn't meant to be." "Considering you were the one who indicated a desire to speak with me, I would have expected at least a few shortcuts in the process." Niv-Mizzet made a motion with his neck, which might have been interpreted as a shrug coming from a smaller creature. Proft frowned. "I would have thought your former guild would be thrilled to know I unveiled a murderer and saved their current leader before she could have #emph[him] assassinated as well." Niv-Mizzet waved a claw. "Some, yes. Some, no. Chamberlain Maree might have been delighted by Zarek's death, given what it would mean for her position. She did tell me how clever you were. I was quite impressed, really." "To impress the Firemind is no small feat. Does it earn me the answer to a question?" "Perhaps. Ask, and I may answer." "How could you not know?" An infinitesimal change seemed to pass over the dragon's face. Proft went on. "Trostani was using the substance of Ravnica itself to kill people she deemed enemies of the city. You are the protector of all Ravnica. How could you not know? You must have seen her machinations. She isn't cleverer than you." "I was otherwise occupied," said Niv-Mizzet, somewhat stiffly. "Her little game was disinteresting, and so I focused on what mattered." "Ah. The project Kylox was working on for you." "What do you know about Kylox?" Etrata pulled on Proft's sleeve. "Remember how I'm supposed to keep you from dying? That includes stopping you from antagonizing the most powerful beings in Ravnica." Proft didn't move. "Not much, in the beginning. He was an ally. A friend, of sorts. Ours was a relationship built on favors and obligations, but I was fond of him all the same. And then he agreed to help you, didn't he? And he died for it. What project could possibly be worth his life? He was a careful man. He wouldn't take that sort of risk if he didn't feel it necessary." Niv-Mizzet said nothing. Proft took this as his cue to continue: "But he was working for you, and he died, and you don't like it when people break your things. Yet you didn't intercede after his death. That confused me, at first. Here you are, responsible for all of Ravnica, ignoring us in our hour of need—ignoring us when personal insult had been given to you. But as I considered it, I realized that the only reason you would stand back was because you were working on something bigger. Something you saw as a much larger and more existential threat than a few little murders. You've died and come back. You know death is an inconvenience more than an ending. I started making inquiries." Niz-Mizzet still said nothing. "Kylox wasn't the only one working for you. You have agents across all the guilds, hard at work on different aspects of the same project. You're not letting them communicate—why, if not because you fear someone figuring out how to exploit what you're still trying to understand?" "Proft," said Etrata with more urgency. "Maybe now is not the time to show off how clever you are to the #emph[Firemind] and is, instead, the time to tell him what you're hinting at before he eats us both." "Of course." Proft cleared his throat, focusing on Niv-Mizzet once more. "I recovered Kylox's cryptex from his lab when he was taken. I've had time to decode it, and I know what you're up to. "I know about the Omenpath Project." Niv-Mizzet blinked, slowly and deliberately. Etrata had never seen a blink look like a threat before. "What do you think you know?" he asked, his words like the creak and slam of a crypt door, heavy and immutable. "I know that following the invasion, rifts began to open in the fabric of the plane. All the planes, from what I've been able to gather. Your agents call them Omenpaths. A curious name. May I ask—?" "A phenomenon natural to the plane of Kaldheim. I've known many travelers from there. Now, please." There was a dangerous note in Niv-Mizzet's voice. "Do continue." "These Omenpaths have been opening all over the city. A lesser mind might take them as random, but you—you saw the pattern, and you set your agents to mapping them. Studying them. Understanding them. You want to control the Omenpaths." "They represent a way both off and onto our plane," said Niv-Mizzet. "As Living Guildpact, they're my responsibility. They could be used to exploit gaps in our security, stir up discontent, or smuggle in off-plane goods, undercutting Ravnican merchants." "And I'm sure your reasons are all that noble," said Proft. Niv-Mizzet narrowed his eyes. "Are you accusing me of something, Detective?" "Let's not antagonize the nice dragon," said Etrata. "You plan to map, monitor, and control every Omenpath in Ravnica," said Proft, unbothered by their interjections. "More than that—you plan to make Ravnica the center of this new, freshly connected Multiverse. The glorious hub of it all. Isn't that right? "Yes," said Niv-Mizzet simply. "Well, as you're most certainly making a mess of the process, I would like to offer our services," said Proft. For the first time, Niv-Mizzet looked genuinely surprised. Etrata put a hand over her face. "Your deductive skills would not be unwelcome," admitted the dragon, slowly. "Excellent. Now, there is the small matter of our fee—operating costs, you understand, inescapable with the economy in its current turmoil …"
https://github.com/sofianedjerbi/ResumeOld
https://raw.githubusercontent.com/sofianedjerbi/ResumeOld/main/projet.typ
typst
Apache License 2.0
#import "brilliant-CV/template.typ": * #show: layout #set text(size: 12pt) //set global font size #letterHeader( myAddress: [284 Avenue de Lyon \ 07500 Guilherand-Granges, France], recipientName: [UFR IM²AG], recipientAddress: [60 Rue de la Chimie, \ 38400 Saint-Martin-d'Hères, France], date: [10/03/2024], subject: "Candidature au Master d'Informatique à distance" ) Madame, Monsieur, Mon objectif professionnel est d'occuper un poste d'architecte technique spécialisé dans les technologies de cloud computing, un secteur clé de l'innovation technologique actuelle. Avec quatre ans d'expérience en conception de solutions logicielles et en développement de systèmes backend, j'ai acquis une expertise approfondie dans le codage, la gestion de données, et l'implémentation de services sur des plateformes comme AWS et Azure. Cette base solide, enrichie par une excellente maîtrise des langages et outils de développement modernes, m'oriente naturellement vers les opportunités et les défis présentés par le cloud computing. Pour atteindre mon objectif de devenir un architecte cloud spécialisé, je prévois de poursuivre un Master en informatique, avec une concentration spécifique en cloud computing et big data. Parallèlement à mes études, je compte travailler dans le domaine du cloud, initialement en tant que développeur. Cette approche me permettra d'appliquer les connaissances théoriques acquises au cours du master dans un contexte professionnel réel, tout en continuant à me familiariser avec les environnements et les technologies cloud les plus avancés. Je vous remercie pour l’attention que vous porterez à mon projet professionnel et reste à votre disposition pour toute information complémentaire. Cordialement, <NAME> #letterSignature("/src/signature.png") #letterFooter()
https://github.com/Myriad-Dreamin/typst.ts
https://raw.githubusercontent.com/Myriad-Dreamin/typst.ts/main/fuzzers/corpora/meta/heading_04.typ
typst
Apache License 2.0
#import "/contrib/templates/std-tests/preset.typ": * #show: test-page // Edge cases. #set heading(numbering: "1.") = Not in heading =Nope
https://github.com/tiddly-gittly/TiddlyWiki-Easy-Guide-And-TiddlyMemo-Edition
https://raw.githubusercontent.com/tiddly-gittly/TiddlyWiki-Easy-Guide-And-TiddlyMemo-Edition/master/原稿/TiddlyWiki简易指南.typ
typst
#set text(lang: "zh",cjk-latin-spacing: auto) #align(center + horizon)[#box[#image("./media/image1.png", width: 12%, height: 8%)#text(24pt)[TiddlyWiki(太微)简易指南]]]\ #align(bottom)[此文件所在的Github仓库:#link("https://github.com/tiddly-gittly/TiddlyWiki-Easy-Guide-And-TiddlyMemo-Edition")[tiddly-gittly/TiddlyWiki-Easy-Guide-And-TiddlyMemo-Edition]] #pagebreak() #align(center)[= 前言]\ 太微比普通的笔记软件拥有更加强大的灵活性(这种灵活性是需要知识来支撑)。太微就像《果宝特攻》里面的机甲,所有的功能(包括更改外观)都可以通过安装、卸载配置模块(插件)实现。太微同时也是文档与软件一体化工具。普通软件修改外观等于几乎打碎整个UI重做。在太微中最简的使用方式是仅在桌面端通过edge打开TiddlyStow页面,选一个太微模板就可以使用记录笔记或日志,数据会保存在本地。 对我来说,我喜欢主动性加各种对条目的整理与使用方式、思考、组织和检索方式。太微不适合收集信息,它只适合你去手动整理自己得到的信息,然后把它转换为自己的知识。这是一个非常重要的过程。而我喜欢这个过程。因为太微正如数学题未得出答案之前有很多可能性,我需要的是其中的一个确定的答案。在大家的共同努力下,花费了许多时间和精力制作了这篇线性指南,旨在以内容为中心、书写文本与显示文本的美观容易阅读、简化原本需要几个月的学习时间成本、授之以渔的自主学习策略(除非你用的到,否则不要轻易的增加需求)。 我们都知道信息和知识是完全不同的。信息只是在神经元之间流转了一遍,然后就存到浅层记忆区了,如果后面不反复刺激的话,甚至还会被自动修剪掉。然而知识是神经元的连接塑性。而知识的学习需要的是主动性,主动的获取某些知识,并不断加强对它的训练。就像学骑自行车一样,一旦掌握某项知识,可能一辈子都忘不掉。太微的【条目】正是提供了这一种对知识整理整合的载体。每一个条目都可以看做一个知识卡片,可以容纳非常丰富的信息,并且他们可以互相属于、链接。你可以在这些互相管理的“知识卡片”中发现知识。同样在不断整理它们的时候,你也会在这个过程不断思考逐渐进步。 有人说TiddlyWiki真的太难了,是的,因为它的功能比一般笔记软件更丰富但功能使用上比一般软件复杂,比程序设计语言简单。要是说没有简单使用的方式,这个观点持保留意见。比如markdown有的功能TiddlyWiki的WIkiText都有,MarkDown没有的功能WikiText也有。如果你感兴趣,这篇文章能够大概的让你了解并简单或进一步的使用TiddlyWiki。(这比之前要简单很多很多) 想看看比较惊艳的太微实例嘛?点击链接查看在线部署的太微: - #link("https://oeyoew.fun/")\ - #link("https://pimgeek.com/notes/")[🤓🌱 学习者的数字花园 — 记录我的学习与思考 (pimgeek.com)]\ - #link("https://tritarget.org/")\ - #link("https://xememex.com/ethicsatwes/")\ - #link("https://tiddlymemo.org/manual/zh-Hans")\ #pagebreak() #align(center)[#outline(indent: 2em, depth: 3)] #pagebreak() = 一、创建自己的知识库 很久很久以前,在一条河流里,生活着许多许多的小鱼儿(Tiddlers),它们快活地在故事河(Story River)里游来游去。这些小鱼儿每一个都有自己的名字(条目名),自己的种类(条目内容类型),它携带的信息组成了鱼儿美丽的身体与骨架,附加的字段构成了它美丽的鳞片。 == (一)TiddlyWiki 简介 TiddlyWiki 是一个宝藏软件,但可惜的是有些人没有体会到这一点就放弃了。我们把互联网看作一个巨大的知识库,它由每个网页组成。使用TiddlyWiki进行信息组织,就是编辑一个一个的网页(条目),这些网页(条目)组成自己的知识库。 「太微」是我们对 TiddlyWiki 的中文称呼。它是一款独特的非线性笔记本,用于捕获、组织和分享复杂信息。可用它来建立个人知识库,或者任务管理。记录闪过你大脑的每一个想法,或者建立一个灵动的自适应式的网站。 「太微」不适合【剪藏】一些信息,知识的学习是需要主动性的探索而被动的【剪藏】就像平静的水面泛起的水花转瞬即逝。不过,仍然有非常多成熟的软件可以完成【剪藏】。对于太微来说,我们需要自己的耐心去慢慢培育出一条条美丽的属于自己小鱼儿,让它们遨游在自己的故事河中,成为自己知识体系的一部分。 我们会使用TidGi(太记)作为本文的全部主线来为您介绍如何使用TiddlyWiki,您以后会见到各种各样的TiddlyWiki,比如:TiddlyMemo(墨屉)、TiddlyDesktop(TiddlyWiki官方的桌面启动器)、TiddlyWiki Xp(一个快速体验太微的「太微模版」)等等。这些都是不同愿景和功能的TiddlyWiki。其中TidGi(太记)是一个应用程序而非系统或框架,使用简单且功能丰富。 准备好了吗?那让我们开始吧! #image("./media/image2.png") == (二)下载与安装 TiddlyWiki(太微)是一份存储在本地的HTML网页文档!同时也是以另一种文件夹存储的方式运行于NodeJS的Web程序。请下载TidGi,然后创建打开你的第一份Wiki。 TidGi下载链接:#link("https://github.com/tiddly-gittly/TidGi-Desktop/releases")[Releases · tiddly-gittly/TidGi-Desktop (github.com)] #image("./media/image3.png") 如图所示,太微的布局在大概被分成两个部分,左边是由条目组成的信息流称为故事河,右边为按钮(页面工具栏)和侧边栏组成的工具区域。 == (三)太微的基本介绍 这部分的内容了解一下,有个印象就可以。 === (1)概念:模板、文件、条目 1.1太微模板与条目模板 太微模板是指预制的太微,相对于空白太微而言根据作者的需求和想法包含了一些功能性的插件和美观性的主题布景以及为了满足插件之间依赖关系或者整体性设计而封装的具有明显功能性的太微 条目模板是指预制的具有特定布局和样式的模板条目。它通常是为了美化和简化输入内容或瞒住特定需要的一种特殊的条目,比如在xp中你可以通过引用条目模板瞬间美化当前的条目使其变得好看,在墨屉中,通过引用问答或者填空模板进行渐进式学习。 1.2太微中两种通用文件格式 Tid文件是太微中条目文件的文件类型,一般只有在Nodejs(文件夹形式)的太微中才可以看到。单文件中的太微是看不到的,因为存储在HTML文件中了。 JSON文件是太微中常见的数据存储格式文件,一般都是使用它保存太微中封装好的插件(未封装的插件用条目保存),TWPUB格式的书籍也会使用它存储数据。不过导出一个或多个笔记时,使用它也是不错的选择。其它的插件也会使用它存储导出的数据,比如TiddlyMap会使用JSON格式保存图文件。 1.3太微中条目的类型 #strong[普通条目],包含:tile 条目标题、tag 标签、text 条目内容、type 内容类型、field 栏位 + tag 标签包括系统标签以及普通标签,其中系统标签被【太微】用来给条目提供特殊的行为。 + field 栏位包含field name 字段名、field value 字段值。条目字段:可以想象成一个个的空位,能够放置除了文本信息之外的内容,即自定义的拓展的小鱼内容。 #strong[系统条目]:如果Tiddlers的标题以特殊字符串开头,则将其归类为系统Tiddlers。系统条目大致有一下几种类型。插件、默认、模板、样式、配置等等。 - 插件(条目组):在内部,插件是一些条目被打包成可被安装、拷贝、禁用或删除的单一条目。插件中的个别条目呈现为影子条目。插件可以包含JavaScript模块、样式表和模板。插件也可以用于散布普通的文本、图片或其他内容。 (扩展内容:插件机制) - 默认条目:或者说影子条目(ShadowTiddlers)是来自插件内加载的条目。默认条目可以被具有相同名称的普通条目复写,成为影子条目。如果随后删除了该条目,则将自动还原为原始的默认条目。来自插件内加载的条目本身不可删除不可修改。因此删除了影子条目就意味着删除了对默认条目复写。 - 模板条目:标题为,\$:/templates/\<用途-备注\> - 样式条目:标题为,\$:/\<name\>/stylesheet/\<name\>。为条目添加样式表系统标签(系统标签:\$:/tags/Stylesheet),在里面写的 CSS 就会自动应用到全局样式上,并覆盖别的 CSS ,详细说明访问太微中文教程:添加css样式。 - 配置条目:标题为,\$:/config/\<name\> - 调色板条目,标题为\$:/palettes/\<name\>,需要添加\$:/tags/Palette系统标签使其生效。 可选的知识:#link("https://tw-cn.netlify.app/#%E5%AD%97%E6%AE%B5%E5%88%B0%E5%BA%95%E6%98%AF%E4%BB%80%E4%B9%88%E5%91%A2%EF%BC%9F")[字段到底是什么呢?——是什么组成了条目。] === (2)太微的布局和控制面板 在TidGi中,你可以通过拖动侧边栏的左侧边缘的一个可拖动的边框,当鼠标移动到左侧边缘时会看到这个边框。拖动这个边框可以改变侧边栏的宽度,拖动到靠近窗口右侧边缘时就会自动收起侧边栏。 如果你使用空白版的太微,而你觉得空白版的太微页面的左右比例看起来太别扭,你可以通过以下步骤调整页面左右的比例。如图所示,点击开启控制台按钮。在控制面板->视觉外观->主题调整->侧边栏布局。侧边栏布局改为:#strong[浮动故事固定侧边栏。] 图表 1关于侧边栏选项卡的知识。 #image("./media/image4.png") 你可以打开视觉外观 - 主题调整 - 选项 - 设置【置顶标题】。使条目名称"黏着"于浏览器窗口的顶端。 这对修改编辑时非常有用,不然如果写的文章非常长的时候,你就要经常性的手动滚动到条目顶端的标题位置点击保存或者取消按钮。 主题是对页面工具栏、侧边栏、故事河等所有UI界面的整体布局。对新用户来说,主题是一个常用的功能,足够的稳定和简单的主题能够让用户放松,把更多的时间用在写作与内容的组织上。主题可以用来适应不同的使用/应用场景。 我们为你介绍这两款主题:Readonly(只读主题)、Centralised(居中主题) + Readonly(只读主题)它隐藏了编辑和新建按钮,你可以应用在只希望别人查看或者网站不支持实时修改的地方。 + Centralised(居中主题),它使得故事河的整体的布局为居中显示。 在默认的【Vanilla】与【Snow White】布景主题中,你可以设置“固定侧边栏,浮动故事”缩小侧边栏的大小,以让故事所占的区域变大一些。而Sidebar Resizer插件则可以让你通过拖拽调整侧边栏的大小。 #image("./media/image5.png") 你可以在控制面板 - 视觉外观 -【工具栏】看到每一个图标的具体名称和作用。也可以设置它是否在对应的位置显示。工具栏有四个位置,分别是编辑工具栏、编辑器工具栏、页面工具栏、查看工具栏。 #image("./media/image6.png") - 编辑工具栏在条目编辑状态下右上角,分别对应删除、取消和确定。 - 编辑器工具栏是在条目编辑状态下的文字加粗、标题格式等快捷按钮。 - 页面工具栏,就是上图中标注的。默认有三个按钮,分别是新建条目、控制台按钮、保存按钮。页面工具栏的下面是搜索框,搜索框的下面就是侧边栏。 - 侧边栏默认由开启、最近、工具、更多等选项卡组成。 - 查看工具栏对应条目显示状态下右上角的三个按钮所在的区域。分别是更多、编辑和关闭。你可以选择性的添加这些按钮。 设置网站图标:将图标导入后,命名为 \$:/favicon.ico 覆盖原有文件。 安装好的插件,如果需要配置插件,一般是在 控制面板 - 插件 -相关的插件条目中的config或setting选项卡,或者在控制面板的 设置 - 插件名选项卡中配置插件。也有部分会放置在控制面板的视觉外观选项卡,工具栏组。 #image("./media/image7.png") 在控制面板的信息选项卡,你可以查看条目的总数,【一般条目数量】就是你写的笔记条目的数量,也称为标准或者普通条目。其它则是系统条目。在这里,你也可以设置TIddlyWiki的一般性信息,比如标题、副标题、、编辑者署名、默认打开的条目等信息。 #image("./media/image8.png") 在信息选项卡的高级组,你可以查看已加载的样式表、条目栏位、级联等信息。要注意的是现在不要太过于关注它们,仅需要了解即可,等到需要使用的时候在学习也不迟。 === (3)太微的查看模式 - Classic:经典模式,打开条目是从上往下的动画,关闭是往左移动直到消失的动画关闭 - POP:弹出模式,pop打开条目是从大缩小的动画,关闭条目是继续缩小直到看不见,这两个他们都是多个条目同时在的,往下翻可以看到多个条目。 - Zoomin:缩放视图模式:这个模式只能看到一个条目,往下翻没有更多条目 详细链接: #link("https://tw-cn.netlify.app/#查看模式") #image("./media/image9.png") === (4)配置新的主题配色 点击页面工具栏的小齿轮按钮(控制台)打开太微控制面板,在视觉外观选项卡 - 调色板组选择你喜欢的主题配色。最后点击页面工具栏的保存更改按钮保存你的太微。 #image("./media/image10.png") 可选的知识:调色板的主题配色是一个系统条目,条目名通常以\$:/palettes/\<name\>命名,几乎所有太微可见部件的配色都可以通过创建或修改此类条目生效。 === (5)中文插件库的安装使用 5.1如何安装CPL插件库? 打开链接:#link("https://tw-cpl.netlify.app/#Welcome"),打开欢迎页面,拖动【太微中文社区插件源(大陆加速版) 】链接到你的太微,点击导入即可。 5.2如何安装CPL中的插件? 点击控制台按钮打开控制台。在控制台 - 插件选项卡 - 点击获取更多插件按钮 - 在弹出的对话框中选择【太微中文社区插件源】 - 点击开启插件程式库按钮 ,这这里你可以选择更新插件、安装插件及布景主题。 #image("./media/image11.png") #strong[重要:]#underline[插件要尤为注意插件之间的依赖关系,缺少依赖将会导致功能性错误或者其它的不可知问题。安装插件之前请谨慎备份自己的TiddlyWiki。] #image("./media/image12.png") 太微的控制面板,是太微配置所有设置的窗口页面。一般的个性化配置都可以在控制面板找到,极少部分会在有相关功能的特定的条目中找到。 在控制面板的信息选项卡 - 高级组中点击【样式表】,可以看到所有系统预设或者自己自定义的样式,你可以快速在此处找到自己创建的样式并修改。 === (6)不同功能多样性的太微模版 #block[ #set enum(numbering: "1)", start: 1) + 官方空白版太微。 + TiGi(开箱即用发行版)与ItonNote Wiki模板 + TiddlyWiki Xp(快速体验TiddlyWiki) + TiddlyMemo墨屉(渐进学习与记忆) + TiddlyWiki Grok ] TiddlyStow:https://twpub-book.netlify.app/tiddlystow.html TiddlyStow(Github):#link("https://btheado.github.io/tiddlystow/TiddlyStow-ZH.html") Tiddlywiki-xp 主页:#link("https://keatonlao.github.io/tiddlywiki-xp/") #strong[墨屉关于英文原著的知识自建单词库。] 墨屉版太微可以导入twpub版英文原著,你可以使用墨屉渐进阅读英文原著,并使用注释功能注释生词,被注释的生词会显示单词查询结果,同时会加入到渐进学习的队列,当你阅读完成后,你可以使用渐进学习功能复习注释过的生词。这样的过程可以让你不断积累自己的生词库,然后把生词在复习加阅读的理解性输入的处理下变成熟词。 - 墨屉主页:#link("https://tiddlymemo.org/manual/zh-Hans") tiddlyhost,只需要注册一个账号就可以使用的在线网站。 Tiddlyhost主页:https://tiddlyhost.com/ #pagebreak() = 二、开始使用知识库 == (一)创建第一个条目笔记 #image("./media/image13.png") 在太微中,一个条目相当于一个文件,点击页面工具栏的新建条目按钮(十字形)创建一个新的条目。 我们为新建的条目取一个新名字——“开始使用知识库”。 #strong[掌握少量的快捷键有助于提高效率。] #underline[关于条目的快捷键:alt-N(新建)、ctrl-Enter(保存条目)、Esc(取消保存)] #underline[保存wiki快捷键:Ctrl + S、从条目标题跳转到条目内容快捷键:TAB] #underline[双击编辑条目插件:2click2edit] 让我们开始书写属于自己的第一篇笔记吧。不过,首先我们要知道两条基本的WikiText语法——标题与段落。这非常简单。 为了快速使用,我们仅仅挑选了常用且简单的功能,更详细的资料情查看文档:https://keatonlao.github.io/tiddlywiki-xp/\#WikiText === (1)指定标题 标题由一个或多个前导 ! 字符指定 #align(center)[#table( columns: 1, align: (col, row) => (auto,).at(col), inset: 6pt, [输入此条目的内容], [! 这是一级标题 !! 这是二级标题 !!! 这是三级标题 ], ) ] #align(center)[#table( columns: 1, align: (col, row) => (auto,).at(col), inset: 6pt, [显示效果], [#strong[这是一级标题] #strong[这是二级标题] #strong[这是三级标题] ], ) ] === (2)段落格式 要在 #link("https://keatonlao.github.io/tiddlywiki-xp/#TiddlyWiki")[TiddlyWiki] 中标记段落的末尾,您需要输入 enter 两次以创建空行。 无论两段之间的空行有多少,默认解释为两个段落,可以使用使用 \<br\> 强制换行 #align(center)[#table( columns: 1, align: (col, row) => (auto,).at(col), inset: 6pt, [输入此条目的内容], [这是第一段。 这是第二段。 \<br\>\<br\>\<br\> 这是第三段 ], ) ] #align(center)[#table( columns: 1, align: (col, row) => (auto,).at(col), inset: 6pt, [显示效果], [这是第一段。 这是第二段。 这是第三段 ], ) ] 现在,你可以自由的书写自己的笔记了,是不是特别简单!不过,如果需要处理像诗歌一样的文本时,这样的按 enter不断换行也太过于麻烦了,为了解决这个问题,我们将为你介绍新的Wikitext语法——硬换行。 === (3)硬换行内容块 处理诗歌等材料时,可以将内容块标记为包含硬换行,内容块使用三个英文状态下的双引号"""开头和"""结尾 #align(center)[#table( columns: 1, align: (col, row) => (auto,).at(col), inset: 6pt, [输入此条目的内容], [""" ''沁园春·雪'' [现代] 毛泽东 北国风光,千里冰封,万里雪飘。 望长城内外,惟余莽莽; 大河上下,顿失滔滔。 山舞银蛇,原驰蜡象,欲与天公试比高。 须晴日,看红妆素裹,分外妖娆。 江山如此多娇, 引无数英雄竞折腰。 惜秦皇汉武,略输文采; 唐宗宋祖,稍逊风骚。 一代天骄,成吉思汗,只识弯弓射大雕。 俱往矣,数风流人物,还看今朝。 """])] #align(center)[#table( columns: 1, align: (col, row) => (auto,).at(col), inset: 6pt, [显示效果], [#strong[沁园春·雪] \[现代\] 毛泽东 北国风光,千里冰封,万里雪飘。 望长城内外,惟余莽莽; 大河上下,顿失滔滔。 山舞银蛇,原驰蜡象,欲与天公试比高。 须晴日,看红妆素裹,分外妖娆。 江山如此多娇, 引无数英雄竞折腰。 惜秦皇汉武,略输文采; 唐宗宋祖,稍逊风骚。 一代天骄,成吉思汗,只识弯弓射大雕。 俱往矣,数风流人物,还看今朝。 ], ) ] 你会发现,【沁园春·雪】 这个标题被加粗了,这是因为在WikiText语法中''两个英文单引号'' 用于 #strong[粗体文本] (#strong[B]) 你已经掌握了标题、段落、硬换行以及加粗的WikiText语法,这真的太酷了。请试着写一些东西看看吧。下面我们将会为您介绍与加粗相关的文字的格式化WikiText语法:斜体、下划线、上标、下标以及删除线。 === (4)格式化字体 现在我们将为你展示如何在太微中写一篇毛泽东的沁园春·雪 #align(center)[#table( columns: 1, align: (col, row) => (auto,).at(col), inset: 6pt, [输入此条目的内容], [//北国//风光,\_\_千里冰封\_\_,万里雪飘。 望长城''内外'',惟余莽莽; 大河^^上标^^上下,顿失滔滔。 山舞银蛇,原驰蜡象,,下标,,,欲与天公试比高。 须晴日,看红妆素裹,~~分外~~妖娆。 ], ) ] #align(center)[#table( columns: 1, align: (col, row) => (auto,).at(col), inset: 6pt, [显示效果], [#emph[北国]风光,#underline[千里冰封],万里雪飘。 望长城#strong[内外],惟余莽莽; 大河#super[上标]上下,顿失滔滔。 山舞银蛇,原驰蜡象#sub[下标],欲与天公试比高。 须晴日,看红妆素裹,#strike[分外]妖娆。 ], ) ] 在编辑模式下,我们可以使用编辑工具栏的按钮设置我们需要的格式,也可以使用快捷键设置(控制台按钮-快捷键) #image("./media/image14.png") #align(center)[#table( columns: 1, align: (col, row) => (auto,).at(col), inset: 6pt, [#strong[斜体],//两个斜杠// 用于 #emph[斜体文本] ( #emph[#strong[I]] ) 条目内容://斜体文本// 显示效果:#emph[斜体文本] ], [#strong[下划线],\_\_两个英文下划线\_\_ 用于 #underline[下划线文本] ( #strong[#underline[U]] ) 条目内容:\_\_下划线文本\_\_ 显示效果:#underline[下划线文本] ], [#strong[上标],^^两个英文上角符号^^用于 #strong[#super[上标]] 文本 ( #strong[X#super[2 ]]) 条目内容:^^上标^^文本 显示效果:#strong[#super[上标]] 文本 ], [#strong[下标]:,,两个英文逗号,, 用于 #sub[下标] 文本 ( #strong[X#sub[2 ]]) 条目内容:,,下标,,文本 显示效果:#sub[下标]文本 ], [#strong[删除线]:~~两个波浪线~~ 用于 #strike[带删除线] 文本 ( #strike[#strong[S]] ) 条目内容:~~带删除线~~ 文本 显示效果:#strike[带删除线] 文本 ], [#strong[突显文本:]\@\@突显文本\@\@ 用于创建突显文本 条目内容:\@\@突显文本\@\@ 显示效果:突显文本 ], ) ] 需要更加丰富的功能?没问题,下面让我们为你介绍段落格式,如何使用项目列表、引述块、水平分割线破折号以及最为有用和重要的双链功能——#strong[嵌入和链接](显示入链和出链功能需要安装插件,我们将会在下一节为您介绍)。 对于程序员来说,我们还为你介绍代码块的使用方法。现在让我们一起来看一下吧。 === (5)段落格式 ==== 1)项目列表与引述块的简单介绍 为了文档的简易性,我们只列举项目列表与引述块比较常见的使用方式。详细的用法可以访问链接查看:#link("https://keatonlao.github.io/tiddlywiki-xp/#WikiText") 项目列表分为#strong[有序列表]与#strong[无序列表。] #strong[无序列表]:使用 \* 字符创建无序列表。 - 第一个列表项 - 第二个列表项 - 一个子项目 - 第三个列表项 #strong[有序列表]:使用 \# 创建有序列表。 + 第一个列表项 + 第二个列表项 + 第三个列表项 #strong[引述块]的简单介绍 #image("./media/image15.png") 您也可以像这样#strong[嵌套引述] #image("./media/image16.png") ==== 2)水平分隔线、破折号、数学公式、代码块 #strong[破折号:]您可以使用两个 hyphen(连字符)-- 创建一个 n-dash(连接号),并使用三连字符 --- 创建一个 m-dash(破折号)。 例如: – 这是一个例子 — 这也是 #strong[水平分隔线:]在一行上用三个或更多破折号,您可以划一条水平线。 #strong[数学公式:]使用一对 #strong[\$\$] 包裹起来的katex公式。需要tiddlywiki/katex插件,太记默认预装。 $ mat(delim: "[", a, b; c, d) $ #strong[代码块:]段落使用 #strong[\`\`\`] 开头和 #strong[\`\`\`] 结尾作为代码块,行内代码使用 \`代码内容\`。注:【 #strong[\`] 】输入方法为英文状态下tab上面的按键。 这是正确的写法: 这是错误的写法: 在太微中,你可以插入更加丰富的功能,比如音频、视频、地图、HTML 代码、样式和类、宏、小工具、变量等等。这些都可与WikiText混合使用。它们可以动态的为你组合并显示更加丰富的内容。但这并不是本文的重点,因此只是在此列举一二。 ==== 3)自定义样式段落块、类型段落块 #strong[自定义样式段落块:]使用\@\@以定义的CSS名称或具体CSS样式属性,例如 color,每个后跟 ; 分号,可以在开头的 \@\@ 之后立即引入。这样做可以让被包裹起来的元素应用定义的CSS样式表,使段落表现起来更好看或具有特定显示风格。 附加:硬换行CSS,相当于硬换行内容块一样的效果: white-space: pre-wrap; #strong[类型区块(类型文本块):]可以用明确的内容类型呈现文本区块,像这样。 === (6)WikiText表格 #link("https://keatonlao.github.io/tiddlywiki-xp/#TiddlyWiki5")[TiddlyWiki5] 使用垂线字符来格式化表格,如下所示: 感叹号用于指示标题单元格。 该示例呈现为: #align(center)[#table( columns: 2, align: (col, row) => (auto,auto,).at(col), inset: 6pt, [#strong[单元1]], [#strong[单元2]], [单元3], [单元3], ) ] 更多的功能与需求例如单元合并、单元格垂直对齐、单元合并等内容不在详细介绍,需要的时候可以查阅tiddlywiki xp文档。(渐进学习) === (7)书写与显示文本 WikiText即TiddlyWiki书写文本。书写文本与显示文本又名书写风格——使笔记变得简洁易懂。为了使WikiText在视觉上变得简洁、易懂。一些好的规范的书写习惯是有必要的。另外在书写时,编辑区上面的编辑按钮将会提供非常大的助力,点击它们会为你自动插入一些标记符。 在输入标题这样一般性的WikiText格式文本时,一般不会使文本变得难以阅读,只有在某些情况下WikiText文本才会变得难以阅读。但是这不妨碍显示文本的效果,显示文本是依然是井井有条的。让我们一起养成一些能够让书写文本看起来舒服简约的写作规则吧。 一般性的标题、列表、文字格式、在视觉上不太会对书写文本的阅读产生较大的影响,当你熟悉之后反而会有一种显示文本的既视感。 不过一些特殊的格式、特殊的需要,需要我们规范一下它的写法,以便于在修改书写文本时不至于找不到北。目前并没有特殊的要求,自己写的舒服好看就可以了。目前也没有特别好的补充,如果你有欢迎分享你的想法。 总而言之,合理规范自己的WikiText书写文本的书写风格是非常有必要的,它能让你在过后几个月完全忘记后依然可以看懂自己当时写的什么。 === (8)WikiText的解析器模式 为了显示条目(通常是条目内容 ,即text 字段),Wiki文本解析器有三种模式,对条目内容( text 字段)中的wiki文本符号,应用维基文本规则读取和解释内容。 比如【#strong[加粗]、#underline[下划线]】(文本格式)就是内联模式,书写的时候对应使用内联模式的书写规则。【标题】属于区块模式,书写时应该对应使用区块模式的书写规则。只有这样书写的文本才能被正确的显示,你可以理解为#strong[书写规则]。 - #strong[编译指示模式] - 解析器将仅识别编译指示模式维基文本符号 - #strong[区块模式] - 解析器将仅识别区块模式维基文本符号 - #strong[内联模式] - 解析器将仅识别内联模式维基文本 此条目仅做简要介绍,更详细的描述请查看#link("file:///D:\\\\Dropbox\\\\10-TODO\\\\TiddlyWiki\\\\%E5%A2%A8%E5%B1%89TiddlyWiki%E7%AE%80%E6%98%93%E6%8C%87%E5%8D%97.html#TiddlyWiki")[TiddlyWiki]舞中文文档:#link("https://bramchen.github.io/tw5-docs/zh-Hans/#WikiText%20Parser%20Modes") 区块解析器模式 + 区块模式维基文本的共同特征:至少需要一整行来分隔维基文本。结束符号必须位于行的末尾(在某些情况下,行尾即是结束符号。) + 属于区块解析器模式的维基文本符号:标题、段落、表格、引言、硬式换行、水平分隔线、代码区块、定义、清单、样式及 CSS 类别、类型区块。 + 维基文本符号例子说明:标题 ,文本符号整行以 ! 开头的 内联解析器模式 + 这些维基文本类型,可以在没有整行文本的情况下表达。它们不需要全部在一行上,只是它们在一行中表示。因此,单一行中可以出现多个。 换句话说,当解析器尝试查找特定维基文本的开始和结束位置时,不涉及行尾,当解析器处于内联模式时,它将识别这些维基文本类型的符号: + 属于内联解析器模式的维基文本符号:文本格式、破折号、图片、链接、嵌入、宏调用、小工具、样式及 CSS 类别、HTML、变量 维基文本符号例子说明:文本格式中的加粗,文本符号 '' 两个英文单引号' '' 编译指示模式(不常用) + 编译指示是 #link("file:///D:\\\\Dropbox\\\\10-TODO\\\\TiddlyWiki\\\\%E5%A2%A8%E5%B1%89TiddlyWiki%E7%AE%80%E6%98%93%E6%8C%87%E5%8D%97.html#WikiText")[#emph[WikiText]] 的一个特殊的组件,提供操控剩余的文本解析的方式。通常用于宏的定义。 + 编译指示位于行首为 \\,他们只能出现于内文的起始处,编译指示之间允许空白的行。如果编译指示出现在内文的主体,会被当作是普通的文本一样处理。 + 常见的编译指示文本例如:\\define(定义一个宏)、\\whitespace trim(裁减文本的起始和结尾的空格)。 === (9)删除单个条目 #image("./media/image17.png") 扩展的知识:更多按钮下,我们常用的功能分别是:信息、新建子条目、导出、相对链接等功能。 == (二)“文件目录”侧边栏 TiddlyWiki中文件目录的层级结构是使用的Locator插件实现的。在太微中条目的隶属关系是通过【同名条目的标签】实现的。一般来说子条目通常有父条目同名的标签表明隶属关系。比如:子条目名为文件夹,父条目名为目录。只要文件夹打上目录的标签,那么文件夹就隶属于目录,这样层级结构就建立好了。 TidGi的文件目录层级结构如图所示——显示在侧边栏的文件目录选项卡。 #image("./media/image18.png") - 如何使用如此简单的文件目录层级结构呢? 在太记中默认创建了Index作为根文件夹条目。空白版太微,仅需要新建一个条目作为根文件夹,条目的内容作为根文件夹的描述,然后为该条目添加一个名为目录的标签,现在你已经拥有了第一个文件夹。 - 那怎么在文件夹中创建文件呢? 在太记中,点击上图标识的添加子条目按钮,或者在空白Wiki中点击编辑条目旁边的更多动作按钮,选择添加子条目就可以在此文件夹中创建文件。 - 删除或导出文件夹下所有文件 TidGi预安装了bimlas/kin-filterr插件,你可以在 “高级搜索(快捷键:Ctrl+shift+A)- 筛选”选项卡中输入筛选表达式,然后点击旁边的按钮执行批量删除,如下图所示。 表达式:\[kin::to\[条目文件夹\]\] 表达式说明:这将会连同【条目文件夹】以及条目名称下的所有子条目全部筛选出来。 #image("./media/image19.jpg") == (三)筛选器与双链功能 === (1)嵌入和链接(双链,重要) #link("https://keatonlao.github.io/tiddlywiki-xp/#WikiText") #strong[1.1嵌入(Transclusion):{{两个花括号}}] 您可以使用嵌入符号将一个条目的内容合并到另一个条目的内容中: {{MyTiddler}} 嵌入一个单独的条目,结果是 MyTiddler 条目的 text 字段(文本字段,即主要内容字段)的内容,被呈现在当前条目内。 #strong[1.1.1嵌入文本引用] 您也可以用一个#link("https://keatonlao.github.io/tiddlywiki-xp/#TextReference")[TextReference](文本引用)代替条目标题: + {{MyTiddler!!field}} 嵌入指定条目的指定字段 + {{!!field}} 嵌入当前条目的指定字段 + {{MyTiddler\#\#index}} 嵌入指定#link("https://keatonlao.github.io/tiddlywiki-xp/#DataTiddlers")[数据条目]的指定索引属性 + {{\#\#index}} 嵌入当前#link("https://keatonlao.github.io/tiddlywiki-xp/#DataTiddlers")[数据条目]的指定索引属性 #strong[1.1.2通过筛选后的嵌入] 可以使用类似的语法来嵌入与指定过滤器匹配的条目列表 {{{ \[tag\[mechanism\]\] }}} #strong[1.2 链接(Linking):\[\[两个方括号\]\]] #link("https://keatonlao.github.io/tiddlywiki-xp/#WikiText")[WikiText]的关键功能是能够链接到其他条目或外部网站。 手动链接,按标题链接给一个条目: 链接到条目并指定链接显示的文本: 您还可以从编辑器工具栏创建链接。 点击#strong[链接],然后搜索并选择一个条目。 #strong[1.2.1驼峰式(CamelCase)链接] 对于符合#link("https://keatonlao.github.io/tiddlywiki-xp/#CamelCase")[CamelCase]规则(大写字母出现在单词中部)的条目标题,只需键入标题不用带双方括号即可自动创建链接。 你可以通过在前面加 ~来阻止被自动识别为驼峰式链接。 例如: - HelloThere 不是一个链接 - http://google.com/ 是一个链接 #strong[ \ ] #strong[1.2.2外部链接] 要链接到外部资源 ,如网站或文件,请键入其#emph[完整] #link("https://en.wikipedia.org/wiki/URL")[URL],包括URI方案,如协议(例如http://、file://)或mailto: 为了使此语法正常工作,URL必须被识别为URL。 否则,它将被视为条目标题。 因此,如果你要想使用相对路径链接到可定位的资源,请使用扩展语法: 扩展语法当然也适用于完整的URL,但在这种情况下,它不是必需的: === (2)嵌入、链接宏筛选器以及小部件之间的异同 嵌入是#strong[{{两个花括号}}],链接是#strong[\[\[两个方括号\]\]]、宏是#strong[\<\<两个尖括号\>\>]、筛选器#strong[\[操作符\[参数\] step step\]]、小部件是#strong[\<\$xxx\>]标记的名称前包含一个 \$ 符号的HTML标签#strong[\</xxx\>] - 嵌入是从另一条目 "B" 引用条目 "A",此 "A" 内容出现于 "B" 的处理过程。 - 链接是仅插入条目的超链接,或者插入其它网站的网络地址,或者本地文件的URL。 === (3)图像的使用 TiddlyWiki的拖动资源功能可以让你将任意的资料拖放进wiki。比如条目、图片、Json格式的TiddlyWiki插件等等。 - 把图片拖进编辑模式的条目里:将图片放入Wiki,并在编辑器里添加对图片的引用。 - 把别人Wiki里的条目链接、标签链接拖入自己的Wiki:复制对方的条目到自己的Wiki里 拖完之后要确认导入。 在编辑条目的状态下,你可以通过拖动图片到太微的编辑区插入一个图片,确认插入之后,在编辑器中将会自动填入图片嵌入的表达式。例如 \[img\[Motovun Jack.jpg\]\]。 #image("./media/image20.png") #strong[复用已导入的图片]:你可以点击编辑栏-插入图片按钮引用已经导入到太微的图片资源。 #strong[移动端导入或使用图片:]可以通过侧边栏 - 工具 - 导入或者添加图像按钮,添加图片、JSON等文件,还可以手动绘制图形。图片可以通过曲别针(导入)按钮导入,然后再编辑栏用插入图片按钮引用。 如果你觉得现在图形的大小不太合适,可以图片的引用表达式张红添加width参数并设定合适的大小,例如这样:\[img width=128 \[tx.jpg\]\] 较大的位图会显著降低 TiddlyWiki的性能。例如,现代智能手机拍摄的图像经常会是 5 MB或更多。所以尽可能的使用外部图像。 在TidGi中,因为已经预制一些程序自动化处理这些任务,比如懒加载图片、\[img\[file://\<path\>\]\](file://文件协议)等等,所以放心用。 TidGi默认预装Shiraz(设拉子)插件,所以你可以使用插件提供的宏实现图文混排,就像在Word里面做的那样,不过在TiddlyWiki中我们是使用语言去描述图片的显示效果。 image-basic宏的使用语法如下: \<\<image-basic img width:"" align:"" caption:"" tooltip:"" alt:""\>\> #align(center)[#table( columns: 3, align: (col, row) => (auto,auto,auto,).at(col), inset: 6pt, [#strong[属性]], [#strong[类型]], [#strong[描述]], [img], [必填], [图像的 URL 或图像提示者的标题], [width], [可选], [图像宽度,高度自动设置,默认值为30%], [align], [可选], [left、、、 和图像的对齐方式,默认值为right center none none], [caption], [可选], [图像标题显示在图像下方], [tooltip], [可选], [在图像上显示的工具提示], [alt], [可选], [与图像关联的可选文字], ) ] 例子:此处显示了如下所示的简单图像。你可以把宏写在段落的开头或者结尾,然后就可以看到显示效果啦。 \<\<image-basic "秋季01.jpg" caption:"Figure 1. This is a basic image." align:"right" tooltip:" demo of image-basic macro"\>\>#image("./media/image21.png", width: 1.2090277777777778in, height: 1.6125in)这是一只火狐狸。这是一只火狐狸。这是一只火狐狸。这是一只火狐狸。这是一只火狐狸。这是一只火狐狸。这是一只火狐狸。这是一只火狐狸。这是一只火狐狸。这是一只火狐狸。这是一只火狐狸。这是一只火狐狸。这是一只火狐狸。这是一只火狐狸。这是一只火狐狸。这是一只火狐狸。这是一只火狐狸。这是一只火狐狸。这是一只火狐狸。这是一只火狐狸。这是一只火狐狸。这是一只火狐狸。这是一只火狐狸。这是一只火狐狸。这是一只火狐狸。这是一只火狐狸。这是一只火狐狸。这是一只火狐狸。这是一只火狐狸。 === (4)条目的批量操作 + 筛选出含有关键字的所有条目:\[!is\[system\]search\[#emph[关键字]\]\] + 按字段与字段值筛选出符号条件的条目:\[search:字段名\[字段值\]\] + 在太记中你可以使用kookma/commander插件对条目进行批量操作。 #image("./media/image22.png") - #strong[批量从一个太微到另一个太微转移数据]:如果你想批量的转移数据到新的太微中,也可以把旧有的太微文档直接拖进新的太微中,然后选择需要的条目导入,注意,请谨慎选项要导入的系统条目(以“ \$:/ ”开头的条目。) - #strong[转移数据到新的TiddlyWiki。] 使用kookma/commander功能,输入筛选器表达式\[!is\[system\]sort\[title\]\]自动筛选出所有非系统条目,然后点击Export tiddlers选项卡-导出条目按钮,选择JSON文件格式保存到本地。导出条目文件会保存原有的结构(条目的隶属关系、双向链接以及固定的文本内容图片等不会改变,图片等在条目中使用相对路径引用的文件注意在导入到新的TiddlyWiki中要保持图片的相对路径不要改变。) 拖动导出的JSON文件到新的TiddlyWiki中,单击导入完成条目的转移工作。条目的转移工作不包含之前的用户设置,仅包含普通条目内容,即用户自己编写的全部内容。 === (5)嵌入在线视频 你可以嵌入一些在线视频。并且可以文本在线视频混排。有时候这非常有用,不是吗(\* ̄︶ ̄)。 #image("./media/image23.png")我们使用小破站作为例子,如图所示,在小破站的转发功能 - 点击嵌入代码,提示已经复制到剪贴板。 正如下面的内联框架标签。你可直接新建一个条目,把复制好的直接粘贴到条目中,保存,就可以看到插入的在线视频了。 #image("./media/image24.png") 你可以使用iframe标签的两个属性,height和width调整插入视频的高度和宽度。单位可忽略,默认单位为pixels(像素)。 === (6)常用的筛选器表达式 - 如何筛选出含有特定名称标签的条目? 说明:\[all\[tiddlers\]!is\[system\]\] 通常可以被简写。表示筛选出所有非系统条目。 - 如何筛选出同时拥有某些标签交集的条目? 说明:筛选出同时具有“标签A”和“标签B”的条目。 - 如何筛选出同时拥有标签A或标签B的所有条目? 说明:筛选出只要有“标签A”或“标签B”的条目都会被筛选出来。注意两个表达式之间有空格。 - 如何筛选出标签大于等于两个的条目? 说明:\[all\[tiddlers\]!is\[system\]\] 限定条目为普通条目,compare:number:gteq\[2\] 限定标签条件大于2,可以自行修改。这个表达式可以有变形式,限定标签在一定的范围或小于固定值,请查阅compare筛选器操作符。 - 条目总量如何显示?数字化呈现? 说明:表达式在高级搜索里检索出来的结果为#strong[显示出来的数字],这就是条目的总数。在控制台 – 信息 – 基础选项卡的最末尾处有显示各类条目的数量。 其它的常用筛选表达式可以在高级搜索(快捷键ctrl-shift-A)筛选选项卡的搜索框旁边的功能按钮找到。 - 时间轴 说明:仅需要在条目中添加这段文字即可按照时间排列显示条目。可以把该条目的标题设置为时间轴。 - 删除未使用的图片 说明:需要安装Relink插件,支持 \[img\[\]\]、\<\$link to =“”\> 等引用,可能引用图片的系统条目:\$:/Import 导入时 #pagebreak() = 三、如何使用TiddlyWiki构建笔记系统? #strong[工具VS内容] 本节主要说明如何运用好【条目】这个信息载体,它可以是卡片,可以是一篇文章,可以是信息节点,可以是一个自动化的信息处理工具等等。如何使用TiddlyWiki因人而异,所以本节内容只提供一个参考和灵感的来源并做一个简单的介绍。相信朋友们的创造力为MAX! 起初,我对太微内容如何组织挺迷茫的,担心放进去的内容我会找不到,担心没有结构、大纲会不知道骨架,从而无法掌握全貌。换句话说,我不会用太微写东西,仅仅是熟悉这个工具,没有对原本的【记录并组织内容】负责。【记录】是为了【读取】使用。【组织】是为了更加简便的【复用】。有时候也是为了【组合】生成新的【维基小鱼】。太微是一个非线性的笔记,也是一种条目形式的卡片笔记,我觉得应该回归笔记记录并使用的这个上面来。而其它的特性也是微为了内容而服务,以内容作为中心。如果对于整本书来说,写作的类型不一样,那组织方法应该也不一样。而对于一篇文章来说也是这样。 == (一)时间序列记录法 + 时间序列第一种用法 最简单是使用方式是每天记日志、账目。条目会自动按照创建时间排序。 你可以通过这种方式查看,在侧边栏点击最近,可以看到按时间修改顺序排列的小鱼儿(条目),如果是创建的日志条目,那么可以看到创建的时间日期。 #block[ #set enum(numbering: "1.", start: 2) + 时间序列第二种用法 ] 你可以用来记录读书笔记或者一些灵感顿悟之类的文字、记录想法,并打上【时间序列】的标签,这样做便于筛选出此类条目,为之后的自动化工作提供基础。 然后你可以选择性的为创建的条目起名字,写内容,内容可以是三言两语,也可以是一两百字的段落,写完之后,凭借你的感觉,对内容进行类别的评估,并把评估的结果——大致的类别,写到条目的标签上。建议不超过两个。最好是一个类别。 #image("./media/image25.png") 在不断流动的时间长河中,随着你不断的记录、记录、记录,条目数量会不断增加,从开始的寥寥几条,到最终的几百条。你会发现,他们有些部分是非常相似的,这种相似的部分可以大致分成几个群组。而这个群组我们可以称之为主题或者元素。 元素或主题是你有意识的主动的按照一定的维度和界限划分的,元素的名字是这一群条目的中心,它有非常强大的磁力,与该元素含义越贴近则磁力越强,反之着越来越弱,元素名字总是吸引和它相关的条目把它们聚集起来就像磁铁一样。 也可以是在不断的累积想法条目的过程中发现一些规律随后将它们分组成为元素或主题。 需要解决的问题是,如何聚类成为元素。这个将此过程简化、减压。我们将在元素渐构笔记法中讲到这部分内容。 #strong[一个有趣的以标签和标题为线索的整理方式:] 使用标签作为线索,线索分为两段,第一段是层级隶属关系,第二段是线索隶属关系。 条目作为文件夹(分类),200-201书籍-20101待读书籍。(这一段是文件夹层级隶属关系),20101中包含书籍列表。书籍列表使用标签标记从属关系,不使用文件夹的从属关系。 == (二)主题渐构笔记法 元素渐构笔记法就是关于马的东西放到以马为名称的小卡片中、归类整理即聚类与分类。这个过程就是聚沙成山的过程,滴水石串的累积。这也是运用自己学到的零散或系统知识打造成一柄柄趁手的武器的过程。也是不断扩展自己认知边界发现以前从未发现的探索之旅,对于我们来说,在认知之外事物,由于超出感知与想象的范围,所以基本等价于不存在。元素渐构笔记法,无非就是在不断的累积之中扩展自己的认知圆圈的半径。就像哲学家芝诺说,他曾画了一个圆圈,圆圈内是已掌握的知识,圆圈外是浩瀚无边的未知世界。知识越多,圆圈越大,圆周自然也越长,这样它的边沿与外界空白的接触面也越大,因此未知部分当然显得就更多了。#strong[#underline[元素渐构笔记法就是描述这种从点到圆的渐进过程。]] 其实读者可以通过这篇指南感受到,这里的每一个知识点都是慢慢的汇聚形成的,你可以尝试不看这篇指南感受一下同时对比看这篇指南感受一下这两者之间的差别。不光思想可以汇聚,物理生物和化学中也可以用这种角度去观察,你可以发现一些有意思的现象,虽然原理可能不是这样,比如化学中的多元素的不断组合然后经过物理的空间折叠形成蛋白质,然后发挥它的功能,但是组成蛋白质的元素是不能够发挥蛋白质的作用的,人们也无法用它做蛋白质做的事情。 元素渐进笔记法是来源于程序设计中的面向对象思维的启发,修改形成的,我一直需要一个方法可以帮助我描述自己感知到却无法言说的事物,还有感知不到却依然存在的事物,比如你从来没有学过化学也不知道水的分子式,如果我不给你说水的分子式,你就永远也不知道【原子】的存在,原来还有更小的物质组成更大的物质,这一认知是人们一生也无法认识到的,尽管我们每一刻都在使用水。如果你知道了【原子】的存在,那意味着可以做更多的事情,这些事情需要你自己去思考,去感受,语言的描述和表达也将会更加清晰。 元素(继承、组合、多态、基本)(聚类,分类),图式、索引分类,索引条目,条目与条目之间有逻辑关系存在。这些词是元素渐进笔记法中的概念性描述词和一些想法的概括,可以作为了解。 元素几何:非线性的笔记需要一些线索和视图,细胞。元素几何的名字由来是因为节点与节点之间的连接是一个几何的形状。我一般把它作为一种全局视角。 元素几何的实现方式就是用太微的链接、嵌入、字段(标题、标签、内容、空字段)以及设置中心节点、层级的元素节点图的局部和全局视角来实现。 条目的继承关系:条目的隶属关系是通过同名条目的标签实现的。一般来说子条目通常有父条目同名的标签表明隶属关系。这种隶属关系的创建方式有两种: + 可以通过父条目的创建子条目来实现。 + 在父条目内容中链接子类,通过链接创建的子类,手动赋予父类标签。 + 用典可以使用:链接。链接不存在隶属关系。 子条目也可以通过一个插件自动化的显示在条目底部声明。inverse-link-and-folder。 可以使用标签作为线索,使用时间序列这个标签标出需要整理的想法。使用具体的元素标签标出将要合并到某条元素笔记。 条目-标签这种隶属关系不仅仅是层级之间的隶属关系,而是一个网状的隶属关系,层级的隶属关系只是网状隶属关系的一部分。 收集想法可以使用【时间序列】,然后用元素聚集高度相关信息。完成关系的连接和整理。 想法是自己对输入潜意识处理的结果,假如有二十条想法(或者说批注),没有时间只能对想法做一个简单的归类。如果想法很多,主题也很多,那么毫无疑问,需要慢慢花时间去消化,这其实就是增量的过程。需要不断查资料来不从,确定概念术语的表达。你需要对想法做很多道工序的处理,这就像做菜,对食材的处理一样。最基本的是验证逻辑性质,有无基本的逻辑错误。无论主题是否存在已知笔记体系中,笔记整理到最后都会慢慢呈现出一个主题来。 一开始整理笔记,或许不知道如何整理了。这些是因为你缺少了相应的内容补充,也就是少了程序或者插件。举个例子,比如涉及到近现代的西方美学转向问题,那么就需要一定基础对西方绘画艺术有所了解。具体例子比如绘画和摄影。照相机刚发明出来的时候没有人去思考两者内部的关系,只是觉得照相机可以替代绘画了,以后的人不用学画画了。但画画还在发展,20世纪典型代表人物就是毕加索。颠覆了很多艺术之前的准则。那现在就出现了问题,为什么呢?画画和摄影之间的关系是什么呢?摹仿论最早可以追溯到亚里士多德,在绘画领域长时间占据着重要影响,正因为摹仿论,当时才会认为绘画已经被照相机给终结了。但现代主义的画家们纷纷要求改变这一思想,表现更为复杂的现实和人的心理活动。 主题就是一个以你自己主观想要研究的比较感兴趣的关键词,比如研究生命科学的,可以是很大的,人体啊。也可以是研究某一类型的昆虫的生物价值。 想法的产生的大概原因是来源于输入 + 问题 + 反思(思考)。输入就是你读过的、见过的、感受过的等等的任意的事物或信息。这些信息会在我们潜意识进行处理,与已有的知识和经验进行关联,当一个问题暂时无法处理时,一直没有头绪,不妨放一放,等一等。可以画画思维导图,或者在笔记上写出关键词,然后看看关键词之间的联系。等差不多的时候,就去睡觉,不用管了。等到第二天或者第三天。或许你就突然的明白是怎么回事了。 元素亦或叫主题,通常由以上四种格式构成,元素本身,元素本身在不同环境下的多样性,元素与元素之间的组合,以及元素的实际例子。这些只是我的初步探索和使用,尚有不完备的地方,需要时间的修饰和打磨。不过自认为或许是一个不错的想法,至少知识在成长的成长过程,从点不断增大半径已形成大圆的过程是我们每一个人都要经历的。 == (三)关系图谱或图数据结构 图是一种数据结构,节点可以称为顶点。其中,一个节点可以有零个或多个相邻节点,节点之间的连线称为边。 #image("./media/image26.png") 太微中的图结构 太微中,实现可视化的插件有两种可使用,第一个是Echart,第二种是TiddlyMap。其中Echart可以不仅实现条目关系的可视化,还可以实现各种excel可以实现的图表。TiddlyMap可以实现思维导图或关系图谱的信息组织形式。 与当前条目相关的节点图谱——TheBrian(可视化) TiddlyMap - 思维导图-关系图谱 (不适配移动端视图,视图被判断太小不能用,需要附加组件Vue.js插件,不装一定会出错。) 从大到小是由 全局设置 - 视图(许多画布) - 图谱(实时节点图) ;一个视图就是一个画布。#image("./media/image27.png") #image("./media/image28.png") #image("./media/image29.png") 控制按钮区域的按钮从左往右依次是:打开菜单、更改显示层级、打开Map导出按钮、改变Map中的方格背景,其中在编辑Map中最常用的的打开菜单按钮和更改显示层级按钮。 创建新画布,单击打开菜单按钮 - 创建一个新画布,输入新视图名称,点击完成创建画布 在画布中【双击】创建新的节点。创建节点间关联,点击Add Edge按钮,选中开始始节点并拖放到目标节点完成关联(其中会提示填写边类型,你可以自定义)。 创建的节点会在太微中以条目的形式存储,同样新建条目也是在Map中新建节点,节点之间的联系同样可以使用条目顶部的按钮实现关联,所以TiddlyMap即是关系图谱又是思维导图。它的边和节点的样式都是可以修改的。 控制按钮区域的打开菜单按钮 - 全局配置 或者 Map中 关于边和节点的解释。 Edge-Type:边的类型(边的样式),就是决定边上显示的文字,完全自定义,比如:被引用或者引用。 Node-Type:节点的类型(节点样式),规定节点显示的样式的。就是节点的样式表。 View configuration视图配置,可以配置节点过滤器,用于过滤显示节点。 #underline[更改显示层级按钮的的解释] Neighbourhood traversal:邻域遍历 Neighbourhood scope:邻域范围 Both、Outgoing、Incoming、Inter-neighbour edges == (四)线性写作的形式 写作的类型不一样,组织方法应该也不一样。比如说倒叙,插叙,正序等等。 条目即文章,一个条目就是一篇文章的组织方法。 一个条目可以当做一个卡片。每个卡片之间可以相互嵌入对方的内容,也可以使用链接引用。形成相互关联的卡片关系网,你可以使用Echart的TheBrian视图观察条目节点之间的联系(全局视图与局部视图),也可以通过目录宏生成像目录一样的关系图。也可以对一个条目中的全部标题生成目录,你可以使用标题插件Gk0Wk/page-toc对一个条目卡片生成标题或者使用Section Editor(部分编辑)根据标题编辑内容。这两个插件在TOC自动化插件里已经介绍过了。 自上而下,先写后拆,拆分后嵌入。 多个条目的组织方法。这是与【条目即文章】相对而言思路相反的方式。你可以在某个条目中建立大致的目录结构,将这个条目等价为论文中的目录页。然后使用链接创建占位符,比如“\[\[前言\]\]”,当年点击链接时会创建此条目,然后你就可以在这个条目中写具体的内容了。当然你可以使用嵌入(transclude),嵌入已经存在的条目,比如某一条已经写好的名人名言,正好可以拿来引用一番(要注意的是,在美没有导出之前,请不要删除被嵌入的条目,删除之后就无法显示了)。 在建立条目小鱼的时候,如果你遇到不懂的字词短语(整体的概念关键词),你可以以用在字词短语上套用链接创建小小鱼(子条目)不断逼问它是什么。这样你就会不断深入理解并且收获新的知识。 == (五)渐进写作(增量写作) 简单的说,渐进式阅读的过程是逐步解构/分解,而渐进式写作则是逐层建构/重铸。渐进式阅读和渐进式写作两者相辅相成,结合起来则形成了毁灭和创造的循环。 其实我现在用的可能就是,一种想法的产生,把一个大概的结构写一下,然后写一下想法。然后补充一下,还不完整。然后新的信息输入,想法产生,结构调整。然后以旧的文章不断的迭代。有时候有了新的建议就标记下来,等待时间的打磨。实践的调整。 渐进写作相关链接: 渐进写作:https://blog.effie.co/%e6%b8%90%e8%bf%9b%e5%bc%8f%e5%86%99%e4%bd%9c/ 非线性写作的4条建议:#link("https://zhuanlan.zhihu.com/p/399187853") == (六)自动化无压记录 双链或间隔重复无压记录,作者:林一二 #strong[01.关于 RR 的双链无压记录] 看过 【双向链接时代的快速无压记录:https://www.yuque.com/deerain/gannbs/ffqk2e】 的同学可能都知道,roam research 之所以能带火 \[\[双链|反向链接\]\] ,是因为它宣传: 输入的时候可以彻底的不整理,就完全堆在日志条目里 然后用 \`\[\[\]\]\` 打个标记,然后用双链的一些特性,试图让后续需要整理的时候压力也不至于很大。 有些东西可能很长一段时间都用不到,那你不去整理它,后续整理的成本也就不用支付了。开始就是随意堆放的,输入成本也很低,就很赚。 #strong[02.太微的自动化无压记录] roam 的选择是把未整理的内容堆放到日志条目里,这在太微里做起来也不难例如我们的添加新想法按钮,点一下之后创建新条目,就能往里输入: \<\<reuse-tiddler "快速创建新笔记按钮"\>\> 例子: + 点击快速创建想法按钮,自动创建出一个带「想法」标签的新卡片 + 输入标题「变量:显示或隐藏空节点」,加上标签「logseq/配置」,输入内容 \`:ui/show-empty-bullets?\` (也可以在里面加入 \`\[\[logseq/配置\]\]\` 来产生双链,看你是标签党还是双链党,反正都可以实现同样的效果) 两次操作即可保留内容,与之相比较的复杂折腾的情况,详见【双向链接时代的快速无压记录:https://www.yuque.com/deerain/gannbs/ffqk2e】。 #strong[03.太微的间隔重复放心记录] 但我的判断是,这种情况下一两下点击的差别其实不大(一下点击打开日志,或者两下点击创建新想法及其标题),重点是心理上放心这个内容不会丢。这种放心感才是 rr 双链系统的核心,只要有这种放心感,交互上区别其实可以忽略。 而之所以有信心就算随便堆放的信息,自己也能再找到,是因为【钓鱼插件】,能够定期让我们回顾收件箱中的内容。(详见 #link("https://zhuanlan.zhihu.com/p/442485060")[为临时性的和不完整的笔记设置写作收件箱 - Thoughts Memo 汉化组译制]),这是太微远超 roam research 和 Obsidian 的地方: 钓鱼插件可以配置为自动提醒我们回顾加了「想法」标签的所有卡片(详见\[\[提供自动化聚合整理的能力,让你从更抽象的角度上整理笔记,而不用亲手整理\]\]),这也就实现了科学的低成本输入+内容不会丢的放心感。 过滤器,宏、小部件。 == (七)随手记录,动态生成 这个是太微独有的。因为有很多小部件和宏啊。都可以直接在WikiText中的书写文本使用。(例如:教程主页就是动态生成的,你可以随手打开条目编辑看看。都是现成的案例可以学习。) == (八)卡片笔记写作法 知乎作者:亦明Reading #strong[卡片笔记写作法,实际上就是碎片系统化。]一个卡片就相当于一个条目。条目卡片小鱼。小鱼之间的相互引用。 它能起作用,靠的是围绕主题进行持续性自然积累。 所谓自然积累,即是想到了遇到了就随手记录一下,不需要专门花大块时间。这样也就最大程度的降低了参与门槛。 持续这个动作必然会带来数量上的累积与查找上的麻烦。前者是优势,后者是问题。解决这个问题,靠的是“检索”。 == (九)PARA个人知识管理 它提供了一种:“将信息内化成知识,并以项目为导向,将知识整合输出为实际内容,获得反馈,从而实现闭环”的方法论。 再摊牌点说,PARA的思想是,以完成一个又一个的项目为目标去记笔记 。 P.A.R.A. 代表#strong[项目(Projects)— 领域(Areas) — 资源(Resources) — 档案(Archives),]四个顶级类别, 包括您在工作和生活中可能遇到的每种类型的信息。 == (十)书籍与书籍的分卷 关于书籍的分卷的两个插件相关插件。 + Searchwikis Plugin(搜索维基插件):通过索引搜索多个维基 主页:#link("https://kookma.github.io/TW-Searchwikis/") 安装Searchwikis 插件的TiddlyWiki可以作为一个检索工具,只有在需要检索的时候才使用它。 #block[ #set enum(numbering: "1.", start: 2) + 在Nodejs中可以使用TiddlyServer,点击链接查看#link("https://bramchen.github.io/tw5-docs/zh-Hans/#TiddlyServer%20by%20Arlen%20Beiler")[TiddlyServer]的具体介绍。 ] 主页:#link("https://arlen22.github.io/tiddlyserver/") == (十一)分享和发布功能 TiddlyWiki最大的一个特性是一个HTML文件,笔记数据会首先保存到HTML文件中。这意味着发布一个静态的网站就像打印一篇公告一样简单。只需要把它放到公告栏的位置。比如GitHub的gh-pages(GitHub 页面)。然而你也可以把它发给别人直接打开。 TiddlyHost,一个在线的站点可以允许用户编辑保存,仅需要注册账号即可使用,你可以把它当做发布页。 分享wiki的一条笔记可以选择导出为HTML文件,如果对方有太微,可以选择JSON格式文件,方便对方导入。如果是多条笔记,可以使用筛选器,筛选出符号条件的条目导出。 == (十二)数据安全性与备份 TiddlyWiki的数据安全性措施有草稿功能自动保存功能,简单的说,只要你确认保存了就不用担心数据会突然丢失,改动会写入文件内,就算是插件导致的功能性损坏不可用,也可以找回来,除非这个文件被删除或物理损坏。要保证的是,改动一定存到文件系统上了才行。 不过也有备份的措施比如:TidGi(太记)的历史版本工具、TiddlyDesktop的备份管理,然后是桌面端的KopiaUI自动定时备份。 === TidGi的历史版本工具 Git的两种可视化工具: - Source Tree :#strong[https://www.sourcetreeapp.com/] - Github Desktop :#strong[https://desktop.github.com/] 林一二:太记应该不容易丢,可以打开git工具看看是不是真存到硬盘上了,看到类似这种就稳了。 #align(center)[#table( columns: 2, align: (col, row) => (auto,auto,).at(col), inset: 6pt, [#image("./media/image30.png")], [#image("./media/image31.png")], ) ] WhiteFall:但是一般性的太微呢,比如单文档的那种,或者使用webdav的呢? 林一二:那种因为都是在 html 内写,不涉及文件系统,所以改动肯定会存到 html 内,不用担心。那 html 有没有存到文件系统上就得自己检查了。 === Git分支是什么? 分支是为了将修改记录的整体流程分叉保存。分叉后的分支不受其他分支的影响,所以在同一个数据库里可以同时进行多个修改。 #image("./media/image32.png") === Git 提交更改(Commit Changes) 当文件被更改后,一般会显示在这里。然后你可以使用Add(添加)将变更的文件添加到暂存区,在使用Commit(提交)将更改(Changes)放入版本库(Repository)的当前分支上。在GithubDesktop中只需要在summary中输入总结并点击 Commit to master按钮即可完成这两步——将更改的文件放入版本库的当前分支上。之后就可以在History(历史记录)中查看刚刚提交的修改。 === Git 历史记录(History) 历史记录(History)中保存着每一次的Commit(提交),通过这些提交记录,你可以追踪每一次的修改,看看每次修改都做了什么。你可以通过历史记录对这些提交进行还原(revert)、回退(reset)、合并、彻底全部清除等等操作。在GithubDesktop中,撤销(Undo)提交即仅仅在本地提交了但没有推送到Github,这时可以在History中右单击刚提交的Commit,选Undo commit即可撤销。 #pagebreak() = 四、为知识库拓展新的功能与特性 太微独一无二的优势就是生来即是网页,可以无需额外软件发布给任何人,寿命与前端三件套齐长。自由度非常高,只要你想,连标记文本都是可以由用户定义的。因此也可以把TiddlyWiki看做对知识进行管理的操作系统,TiddlyWiki插件作为系统的应用,而底层数据就是条目。 要十分注意的一点就是,在安装插件的时候要注意备份一份你的太微文档,这是一个好习惯。如果安装后没有任何问题,可以把备份删掉。其实通常是某些极个别的插件会出现冲突问题或者相互不兼容问题,大部分的插件都没问题,不会引起插件冲突导致的程序错误。 本节将为你介绍:中文插件库的安装使用以及插件安装的注意事项、常用的插件的使用说明。太微控制面板的使用介绍。你可以先大概浏览一下,并不需要即刻安装它们,当你需要的时候再来查看安装也不迟。 #strong[如无必要,勿增实体。功能越多,问题越多。简单实用稳定就是最好的。] == (一)Markdown插件 在官方库搜索Markdown插件,点击安装。然后再CPL搜索Markdown-Export,点击安装。注意 ,这两个插件是都要装的,不然导入的markdown文件无法正常显示。 可以把新建Markdown的按钮放在侧边区域的页面控制栏,设置可以在控制台 - 视觉外观 - 工具栏 - 页面工具栏启用【添加Markdown条目】 == (二)反向链接插件 在CPL搜索 inverse-link-and-folder (反向链接插件),安装后条目底部会出现【此文件夹中的文件】以及【子条目的标签】 #image("./media/image33.png") == (三)TOC自动化目录插件 在CPL搜索 Gk0Wk/page-toc ,点击安装,在控制面板 - 视觉外观 - 工具栏 - 查看工具栏 勾选Page TOC。 #image("./media/image34.png") #image("./media/image35.png") ToC generic:在CPL搜索ToC generic,点击安装。插件描述:将扩展的目录添加到条目的底部。 #image("./media/image36.png") Section Editor插件,在标题上对大条目进行分段,直接编辑,创建,折叠和管理部分。创建拼凑的条目,将碎片编织在一起以呈现叙事故事。 简单的使用方法:创建一个条目;添加字段: se-type,值可以为空;开始写你的长条目不要忘记添加一些标题 使用 ! and !! 将 tiddler 分成几个部分。保存你的条目。 演示与教程主页:#link("https://kookma.github.io/TW-Section/") #image("./media/image37.png") 安装Section Editor插件,请注意备份你的文档。。 == (四)回收站插件 在CPL中搜索Trashbin,点击安装。 Trashbin插件背后的概念是有一个简单的机制将已删除的tiddlers移动到Trashbin,并能够在需要时恢复它们。 #image("./media/image38.png") == (五)随机漫游条目与快照插件 随机漫游条目插件 RandomTiddlerButton:https://sonephetr2.github.io/ random:#link("https://tobibeer.github.io/tw5-plugins/#random") 说明:kiasu/RandomTiddlerButton、tobibeer/random两个插件都需要安装,安装后请刷新wiki。 TiddlerSets快照插件,只需单击一下,即可创建并打开Tiddler集合 TiddlerSets:https://tiddlersets.tiddlyhost.com/TiddlerSets == (六)与SuperMemo互动 你可以在SuperMemo中导出HTML文件,在浏览器中经过简单的处理,就可以导入太微中,构建自己的小鱼。 #align(center)[#table( columns: 2, align: (col, row) => (auto,auto,).at(col), inset: 6pt, [#image("./media/image39.png")], [#image("./media/image40.png")], ) ] 你可以使用SuperMemo的导出功能导出网页文件,然后用浏览器打开,如图中所述复制整个网页文本,然后在太微中新建一个条目,粘贴到条目中,点击保存就可以完成导入啦。是不是特别简单。 #image("./media/image41.png") 导入的内容你可以按照自己的喜好,使用钓鱼系列的插件学习复习,摘录并做笔记之类的。 #pagebreak() = 五、帮助与更多 你可以在以下三个站点找到丰富的资源教程,或者在知乎或B站找到实用的使用方式。我们对新人的建议是,学无止境,够用就好。太微的上限很高,达到一个比较好的效果就可以暂时性的不用学习新的知识。等到有新的功能需求,自己再去探索未知领域。 #align(center)[#table( columns: 3, align: (col, row) => (auto,auto,auto,).at(col), inset: 6pt, [#image("./media/image42.png")], [#image("./media/image43.png")], [#image("./media/image44.png")], ) ] #link("https://keatonlao.github.io/tiddlywiki-xp/") #link("https://tw-cn.netlify.app/") #link("https://bramchen.github.io/tw5-docs/zh-Hans/") #link("https://groktiddlywiki.com/read/") #strong[致谢] #quote[ 感谢CREATOR(keatonlao)的wikitext教程、suan、FSpark、TomZheng、凹夫几、林一二、葫芦12、sugarhope、少年游、机杼提供的意见和想法以及每一位太微爱好者的支持,非常感谢! ] #strong[TiddlyWiki(太微)相关资源:中文教程、插件源、论坛、桌面应用] + #strong[太微中文教程: #link("https://tw-cn.netlify.app/")] + #strong[社区插件源: #link("https://tw-cpl.netlify.app/")[https://tw-cpl.netlify.app]] + #strong[TW唯一论坛: #link("https://talk.tiddlywiki.org/")] #block[ #set enum(numbering: "1.", start: 4) + #strong[桌面版应用 TiddlyGit (太记):https://github.com/tiddly-gittly/TiddlyGit-Desktop] + #strong[太记介绍和教程地址: #link("https://zhuanlan.zhihu.com/p/140473235")] + #strong[太微思维导图(六大主题):]https://www.zhixi.com/view/70759713 ] #strong[希望大家都能爱上TiddlyWiki! QQ群:946052860] 关于需要了解的HTML知识(可选):HTML标签、盒子、选择器、属性与内容、HTML结构、应用CSS到元素的概念以及常用的功能。 == (一)桌面端Timimi的安装使用 太微有非常多的保存方式,有一种保存方式Timimi,你可以把它们当做文档与保存文档软件的关系。Timimi仅需配置一次且使用起来几乎感受不到存在。有一个好主意是,你可以使用TiddlyStow搭配Timimi并把它们作为一种日常使用太微单文件版的方式。其中TiddlyStow作为创建太微的角色,Timimi作为保存太微文档的工具。如果担心会丢失数据可以使用Kopia定时备份。 安装流程概述:1.安装浏览器插件(注意,启用选项,允许来自其它应用商店的扩展)、2.打开允许访问文件URL、3.安装主机伺服软件。 请点击下载地址链接,笔者使用Edge浏览器作为演示,其它浏览器安装流程点击相应的浏览器即可看到,请按照步骤操作完成安装。 #image("./media/image45.png") 点击对应的浏览器可以看到不同浏览器的安装流程,不会英文?没关系!使用网页翻译试试? #image("./media/image46.png") 第一步,允许来自其它应用商店的扩展:设置及其它(Alt+F7)\> 扩展 \> 管理扩展 #image("./media/image47.png") 第二步:下载并安装Timimi插件 #image("./media/image48.png") 第三步、设置Timimi并允许它访问文件URl:设置及其它(Alt+F7)\> 扩展 \> Timimi \> 详细信息 #image("./media/image49.png") 第四步:下载并安装本机伺服程序(与Timimi插件配套使用,缺一不可) #image("./media/image50.png") #image("./media/image51.png") 现在,你可以在任意位置保存和备份你的TiddlyWiki文件,并且浏览器将不再会#strong[下载一份更新后的太微。] == (二)配置太微的中文语言 有时候我们才从官方下载的太微是英文状态的,那么如何配置它的中文语言呢? 现在,我们将为你配置太微的中文语言。点击页面工具栏的小齿轮按钮(控制台)。在左边找到Plugins(插件)选项卡,点击Get more plugins(获取更多插件按钮) #image("./media/image52.png") 在弹出的窗口中,如图所示进行操作。 #image("./media/image53.png") 你真的是太棒了,让我们进行最后一步吧! 在太微控制面板 – Info选项卡 – 基本组 ,往下滑找到 “Hello! Current language” 设置,下拉列表选择 Chinese(Simplified)选项完成中文汉化设置。如图所示。 #image("./media/image54.png")
https://github.com/ngoetti/knowledge-key
https://raw.githubusercontent.com/ngoetti/knowledge-key/master/template/utils.typ
typst
MIT License
#import "@preview/codelst:2.0.1": sourcecode #import "@preview/tablex:0.0.8": tablex #let sourcecode = sourcecode.with(frame: (code) => block( radius: 4pt, fill: luma(255), stroke: luma(230), inset: 2pt, text(size: 4pt, code) ))
https://github.com/YunkaiZhang233/a-level-further-maths-topic-questions-david-game
https://raw.githubusercontent.com/YunkaiZhang233/a-level-further-maths-topic-questions-david-game/main/further-mechanics-1.typ
typst
#import "template.typ": * #import "shortcut.typ": * #let title = "FM1 Topic Questions" #let author = "<NAME>" #let course_id = "Further Mechanics" #let instructor = "<NAME>" #let school_name = "David Game College" #let written_time = "Spring 2024" #show: assignment_class.with(title, author, course_id, instructor, school_name, written_time) #set enum(numbering: "a)") #set heading(numbering: "1.1.") #outline(indent: auto) #pagebreak(weak: false) #problem_counter.update(0) #preface
https://github.com/EpicEricEE/typst-quick-maths
https://raw.githubusercontent.com/EpicEricEE/typst-quick-maths/master/tests/template.typ
typst
MIT License
#import "/src/lib.typ": shorthands #set page(width: 4cm, height: auto, margin: 1em) #show: shorthands.with()
https://github.com/polarkac/MTG-Stories
https://raw.githubusercontent.com/polarkac/MTG-Stories/master/stories/048%20-%20Dominaria%20United/003_Episode%203%3A%20The%20Locked%20Tower.typ
typst
#import "@local/mtgstory:0.2.0": conf #show: doc => conf( "Episode 3: The Locked Tower", set_name: "Dominaria United", story_date: datetime(day: 12, month: 08, year: 2022), author: "<NAME>", doc ) #figure(image("003_Episode 3: The Locked Tower/01.jpg", width: 100%), caption: [Art by: <NAME>], supplement: none, numbering: none) Karn wished to be alone. He wished to be working on research—if only he could lose himself in a mathematical formula's crispness, if only he could forget how it felt to have oil and blood drying on his body. But he could not escape. He was locked into New Argive's watchtower, in a small circular upper room ringed in steel-shuttered windows. The dim yellow glow of the powerstone overhead illuminated a pedestal with a control panel beneath it. Only he had the key that would end the tower's lockdown, and he would not use it, not until they'd captured the Phyrexian, and not until he knew for certain his companions—Jodah and Jaya, Teferi and Stenn—were free from New Phyrexia's influence. "Where's the sylex?" Jaya asked. "Safe," Karn replied. He turned away so that the others could not see his face. He needed a cloth but could not generate one. He held out his hands and drew particles from the aether, creating a small wire brush, identical to the one he'd used so many years ago, to clean himself after Urza sent him to war. His palms fizzed with magic as metal accrued. "Why not tell us where it is now?" Jaya asked. Teferi craned his head as if still searching the ceiling for the Phyrexian spy-creature. "Even Planeswalkers can be corrupted now. Karn's the only one with immunity to the oil." While Karn appreciated that Teferi defended him, he did not like being spoken of as if he weren't in the room, as if he were an object. But he supposed old habits died hard. Teferi had been Urza's student before Karn's birth. "I'm not a spy." Jaya seemed insulted. "You wouldn't know if you were," Stenn said. "I have a plan to find and defeat Sheoldred," Karn said. "I will tell you what it is once we have secured the tower." Jodah rubbed his temples, looking irritable and drawn. Karn suspected portaling them all had strained the mage's capacity. Jodah said, "I'll trust you. I should have done so sooner, anyway." "I can't say I like the idea of jumping through hoops to prove myself to you, Karn," Jaya said. "I can understand why you think we have to do it. But I don't like it. My circus days are over, and I was never all that interested in performing tricks." "We need to find the Phyrexian creature first," Jodah said. "Splitting up will be the most efficient way to search for the creature," Karn said. "Jaya and I can take the upper floors," Jodah said. "Teferi and Karn can take the lower." "That leaves me alone for the basement level." Stenn grimaced. "I suppose that's just as well. It's mostly one big boiler room. I'm liking this plan less and less." #v(0.35em) #line(length: 100%, stroke: rgb(90%, 90%, 90%)) #v(0.35em) Karn led Teferi down the narrow metal stairs. The grating creaked underfoot, designed to accommodate a light human frame, not a ton of metal. The hall on the third floor was narrow, the stone gray. A click, and mechanical lamps flickered into dim life. "The toggle that controls the lights is next to the door," said Teferi, pleased. "It may have passed this direction." Karn touched his fingers to a blood-and-slime trail on the wall at his shoulder height. "Let us follow it." The trail terminated at a door labeled "STORAGE: WATERWORKS." Blobs of slime coated the hinge as if the creature had squeezed through the gap. Teferi crouched. He did not touch it, but his hand hovered over the goop. He looked up at Karn. "Should we call the others?" "Not yet." Karn paused. "We don't know if the creature is still here." Teferi opened the door a crack, then paused. When nothing jumped through the gap, Teferi swung it open and stepped through. Karn followed. Tall racks of unused copper pipes loomed to one side. The other side had steel shelving that held wooden crates brimming with gears, flanges, and valves. Karn could see no further sign of the creature's passage. Nonetheless: "Teferi, let us search the room." The tight passages between the storage racks were designed to admit humans. Karn felt large and unwieldy. His elbows clanged against pipes, and he jostled boxes when he pressed through the narrow aisles. He paused, then knelt, ducking awkwardly under a low-hanging steam pipe. Blood dripped from the underside of a shelf. He traced the fluid upward, to its source. It looked as though several pipes were~ bleeding? A throbbing chunk of meat had attached itself, barnacle-like, to the copper. It released a gout of acid, dissolving the metal, and then it regurgitated a metallic barb from its side. Karn reached out to the fleshy deposit and crushed it. "Karn, I need you to come over here." Karn traced Teferi's voice and found Teferi standing in the corner near a wooden rack with tubs of sealant stacked upon it. Teferi pressed his fingers to his lips and tilted his head in a "listening" gesture. "I don't like this." Jodah's voice carried through the pipes, clear. "Don't like what?" said Jaya. Karn frowned at Teferi. Teferi pointed at a vent. "That Karn is having us search before telling us his plan." Jodah sounded bothered. "Shouldn't we talk this through together, work out the details as a team?" Karn traced the vent with his gaze. The pipes disappeared into the ceiling. Despite Jaya's earlier objection to jumping through hoops, Karn heard her low laugh. "Oh, so you're assuming #emph[your] way is the only way to do this? Remind you of anyone?" "Jaya, it's not like—" "Go on." Jaya's laugh rang. "Protest some more. That'll really make your case." The voices faded. Karn contemplated the overhead vent. "It seems possible that the Phyrexian spy can use these vents to travel between floors." Teferi pointed, without touching, at black oil on the vent's corner, then down to a vent on the floor. Karn crouched to view it. It looked as though the metal had been cannibalized, or possibly transformed, into an eyeball, ringed with small vicious teeth rather than lashes. Small additional eyes nestled beside it, opening and closing. Overhead, a skittering noise, then the click of metal claws ringing along the vents. Teferi craned. "What do you think we should do?" Karn pivoted, seeking the noise's source. It stopped. He'd lost it. "Unlike the others, you don't seem to take issue with my unilateral creation of a plan." "Urza used you like a tool," Teferi said. "I never questioned it. I should have, and recently~ Niambi got me thinking. I wish I'd been more thoughtful when I was younger. More observant. And that I'd treated you better." Karn traced a #emph[ting-ting-ting] along the pipes. He pursued it into the storeroom's corner and then located a small vent in the floor. Slime and blood slid down between the metal slots, thick and clotting. "We must proceed back to the stairs, then down to the second floor." Karn led Teferi back into the stairwell. The metal creaked under his weight but did not bend. The bolts fixing it to the stone held. Teferi's words had fallen short of an apology but had been heartfelt. Karn understood that what he was about to do was manipulative given their current conversation. But he felt he had little choice. "Thank you, Teferi. I need your help. Even I cannot watch the sylex continuously using the scryer. I have hidden it in a sea cave by Tolaria West." Teferi nodded, solemn. "I honor your trust in me. I can help you guard it." A shout reverberated down the stairwell: Jodah. Karn reversed course. He sprinted up the stairs, the grate rattling under his footsteps. Teferi ran after him, a touch slower due to his human limitations. Karn located Jodah and Jaya on the fourth floor in a small office located off the main corridor. Jodah flung the squid-like Phyrexian off him, and it splatted into a wall. Jaya pressed her hands together and blasted it with white-hot flame—and the creature split into halves, avoiding the fire. Each half sprouted multiple multijointed legs from its gory insides. Hungry mouths bloomed along its carapace, ringed in tiny razor-sharp teeth. Jaya parted her hands, dividing her flame, to pursue each half. The creature split again, this time into four small chittering beasts with dozens of legs growing from central gobs of flesh twined around with cables. The creatures scattered, each going in a differing direction. #figure(image("003_Episode 3: The Locked Tower/02.jpg", width: 100%), caption: [Art by: <NAME>], supplement: none, numbering: none) Karn stomped on one that attempted to squeak past him out the door. Jaya brought her hands together, trapping one between sizzling gouts of flame. "I wouldn't eat them," she said, "but they sure do fry up nice." The creature cried out as it died, a high-pitched noise that subsided into a bubbling whine. Jodah gathered more white energy between his hands, but the other creatures had skittered away. Teferi arrived, panting, at the door, hands held at the ready—just in time to see the creatures squeeze themselves through the cracks in the stone, leaving behind nothing but glistening oil and mucus as a sign of their escape. The four of them stared at the destroyed office: the smoldering papers, the shattered chair. Stenn arrived, dripping with sweat. He tried to peer around Teferi, then stepped back, bending over. He wiped his forehead against his sleeve. "Too many stairs," he huffed. "If they split like that," Teferi said, "then we can't know how many are in the building." Karn lifted his foot to examine the pulp beneath it. "Interesting." "While some people might find fighting an unknown number of opponents that can seep through walls and attack at any time #emph[interesting] ," Jaya said, "I can think of a good hundred other ways I'd like to spend the evening." "Karn," Jodah said, "please~ just tell us your plan—and the sylex's location." Teferi, carefully, didn't look at Karn. "After all these years, Karn," Jodah said, "can you trust none of us?" "No." "Wise," Stenn said. "If Sheoldred knew the sylex's location, she would stop at nothing to attain it. Since any of us could be a sleeper agent, we can't risk having that become common knowledge—and we don't know how well that~ that #emph[thing] can listen." "You must be the most stubborn, inflexible—" Jodah said. "Just like some people I know." Jaya sighed. "The least we can do is develop a way to locate the creature. It's doing us no good searching for it blindly." "We have biological samples," Karn said. Jodah knelt to examine the goop and sighed. "If I developed a~ tracker, of sorts, using that material, it could follow organisms with similar tissue. But it wouldn't be some~ Phyrexian detector. It would only be able to locate that one creature and whatever it's split into." "Sounds better than nothing," Jaya said. Jodah looked up at Karn. "Could you generate impenetrable metal shells around the material? I don't want to risk handling it, but we'll need to have the organic matter with us to guide and power the spell." "Yes," Karn said. "Do you have further guidance regarding the object's construction?" Jodah considered, then added, "Put a needle on it. I'll enchant that directly to guide us." "Similar to a compass," Karn said. Jodah nodded. Karn created the metal items to Jodah's specification. He created each one to be the size of a clamshell, small enough to fit human hands, and built it up around a gob of Phyrexian flesh. He handed them to Jodah. While Jodah grasped them and muttered, weaving his radiant spells, Karn stepped off to the side. In a small nook between crates, he kept his back to the others and generated a miniature scrying device, similar to the one he had made in Oyster Bay but smaller. When he was done, he intended to hang it on the chain around his neck alongside the #emph[Weatherlight] beacon. He missed Ajani and wished the leonin was here to help him. A haze filled the amulet's crystalline surface. Karn frowned. Ajani—where was he? The scryer stuttered, then resolved. Ajani seemed to be fighting. Karn could not make out the shadowed forms that Ajani exchanged blows with, but he suspected them to be Phyrexian, which explained the scryer's difficulty focusing on them. The image clarified, and Karn saw Ajani speaking with a young Capashen knight, a woman with a brash set to her shoulders. He sought the sea caves by Tolaria West. No Phyrexians searched the coast; the area seemed serene. If Teferi was a spy, he had not yet reported to Sheoldred. Karn frowned. #figure(image("003_Episode 3: The Locked Tower/03.jpg", width: 100%), caption: [Art by: <NAME>], supplement: none, numbering: none) "Karn, I—" Jaya stopped. Frustration clouded her face. "What's that?" Stenn peered around her. "Yes, what #emph[is] that?" Karn hung it from the necklace. "It is not of concern." "Jodah finished your amulet." Jaya handed it to him. "He's almost done." Karn inspected it. Its locator needle swung, bobbing between two points as if confused. Jodah pocketed his. "I'm going to return to checking the upper floors." Jaya moved to go after him, but Karn lifted a hand to stop her. "Your long-standing friendship aside, I do not think your quick tongue has a calming effect." "True," Jaya conceded. "Stenn, given this creature can ooze through walls, are there maintenance areas we should be checking for infestation? Crawl spaces?" "Yes, actually," Stenn said. "There's an elaborate venting system to allow air to escape from the lower levels, should the city need to retreat into the earth for defensive reasons." Teferi whistled, clearly impressed. "I'll go with Jodah." "Then I shall take the basement alone," Karn said. "Better you than me," Stenn said, fervent. "That room is disconcerting. There's so much noise from the boilers that you'd never be able to hear something sneaking up on you." Karn waited until Stenn, Jaya, and Teferi had left the room. He headed down into basement level, the locator in his palm. If Jodah were compromised, would the enchantment even work? The basement level consisted of a short but broad corridor edged with pipes. Unlike the pipes in storage above, these were live: hissing with steam, their shutoffs cranked open, their valves leaking. The rooms held boilers and hydraulics constructed with intricate beauty from copper and steel, each rivet lovingly set and integrated with Thran technology. "Ah, Karn!" Jodah entered the boiler room, shouting to be heard over the din. Teferi followed him. "I've been looking for you. I think I need to recalibrate the locators so that the needle only points toward the nearest creature. It's also having a hard time differentiating up from down. If you could—" Jaya and Stenn opened the door. "Just who I was looking for," Jaya said. "This thing you made isn't working, Jodah. It's useless. Keeps on pointing, then moving, like it can't make up its mind." But Jodah stared at her. "Are you bleeding?" Jaya clutched her arm. Her eyes narrowed. "Never seen a flesh wound before?" "Why didn't you tell us?" Jodah asked. He glanced over at Karn, meaningfully. Karn handed Jodah his locator. "Why would I? I'm not five years old." Jaya sounded insulted. "It's just a scrape." "That's not what I meant." Jodah stretched his fingers over the locator, pulling up a meshed spell network from the device and tweaking it. He flicked his fingers down, and the spell settled back into the metal. Jodah returned the locator to Karn. "What if glistening oil has gotten inside you?" "It didn't," Jaya said, icy. "If that's true," Jodah said, "then why hide it?" "I wasn't hiding it," Jaya said. "It just wasn't important." In the floors above, a rattling—then a boom. It sounded like something had overturned one of the racks filled with pipes. Karn calculated that several dozen pipes must be rolling on the floor to create such a din. "It must be upstairs. Teferi, Stenn, you investigate with Jaya." Teferi nodded, his face solemn and his eyes on Jaya. Perhaps he thought Karn intended for him to watch Jaya, due to her wound. Karn did not think glistening oil could infect so quickly, and yet~ how could he be sure? Jodah handed a locator to Karn. "Could you change the needle so it rests on a bearing? Or at least something that can pivot? I think it should be able to point up and down as well as in a circular motion." Karn nodded and set to work at altering the mechanisms. Jodah leaned over the locators. He drew his hands over them, pulling up the spells so they hovered midair in delicate glowing magical networks. He tinkered, altering how the nodes and colors connected. Normally Karn enjoyed working at someone's shoulder on a mechanical task. It was peaceful. But not so with Jodah. Jodah leaned back on his heels and pushed his unkempt hair back from his face. He wore a rueful expression, its ageless quality at odds with his apparent youth. "You've seemed~ different since your return from New Phyrexia." When Karn had returned to find that Jodah and Jhoira had been involved while he was away, he'd been~ startled. And uncomfortable. Even though Jodah and Jhoira's relationship had not continued, its aftereffects had. Karn considered responding more tactfully. But who knew what a moment of honesty might reveal here? "Recently, the way you offer advice has reminded me of Urza." "Ah, and I, the ancient, wise, and powerful wizard~ may have grown arrogant over the eras." Jodah pressed his hands into the spells, pushing the magic back into the metal. "Jhoira sees you as vulnerable. It made me feel like I had to look out for you, for her sake." The needles in the locators quivered. Each swung wildly, spinning in differing directions. "I would prefer to be your partner in this venture," Karn said. "Partners confide in each other," Jodah said. Karn pretended to hesitate. He nodded, slowly. "If you were compromised, I don't believe that you would be so obvious in your anger and impatience. The sylex is located in a warehouse in Estark." Jodah laughed at that. "Well. Thanks for that, I suppose." The needles pointed in different directions. All directions. Jodah stared at the locators, dismayed. "How could I get this wrong twice?" "You did not," Karn said. The walls rustled with sudden movement. Creatures flung themselves at Karn and Jodah, cables outstretched and mouths seeking. Jodah attempted to ready his magic, but the light around his hands was dim, flickering. He had exhausted himself from portaling them to the tower, then again from creating the locators. A half-dozen more creatures launched themselves at Jodah, wet and fluttering. Karn adjusted his stance to defend Jodah. He seized a creature from the air and ripped it in half. He flung it outward at the other creatures. He swiped another from the air. But there were too many—some got through. Jodah seared one with a blast of pale light, then fell to his knees in exhaustion. Creatures had started to climb up his body, their probing mouths searching for his skin. Even though Karn's instincts cried out for him to watch the walls, he turned to Jodah. He peeled off the creatures, ripping clinging tentacles in the process, and flung them aside. The disconnected tentacles bound to Jodah in clots. The clusters began to grow sucking mouths. Flame roared throughout the room. The roar deafened Karn. Heat rushed through the room, sterilizing it, and poured over his body in sheets. It felt pleasant, warm and ticklish. The flames poured forward and licked at Jodah, gently. The creatures lodged on his body bubbled. Karn reached forward, and this time was able to remove the remaining clinging creatures one at a time. The limbs drooped free. He pulled the rest from Jodah's prone body, then turned to face their rescuer: Jaya. Her fire centered around her, white-hot, and illuminated her face. Its light cast the lines worn into her skin into relief, and the heat rippling the air caused her white hair to lash around her. Her eyes reflected the firelight. She smiled, her lips tight. Stenn ran into the room. Jaya's blast wrapped around him, not touching him, but repelling his Phyrexian attackers. He stabbed a small creature crab-skittering around the floor, pinning it. It writhed, legs outstretched and twitching, and he used a dagger to bisect it. "He okay?" Jaya nodded at Jodah. "Yes," Karn said. "The good news is that your locators appear to be working correctly." Karn peered over at the locators. They pointed upward, but their needles did not quiver with tension as they had in the moments before the attack. He picked up his locator, then turned to the walls to see how the Phyrexian creatures had crept up on them. He could find no hints as to how so many had approached undetected. Inside the walls, Thran technology glistened gold. It probably connected to the powerstone and powered the hydraulics. "What a relief." Jodah's laugh turned into a cough. "Where's Teferi?" Stenn asked. "You'd think he would have heard the commotion." The silence descended into discomfort. What if this mass attack had been but a distraction so that Teferi could try to transmit the sylex's location to the Phyrexians? What if the Phyrexians even now searched Tolaria West, laying waste to its coast? Karn wished to look in his scryer but dared not give his advantage away. "I'll go look for him," Jaya said. Karn moved to join her, placing himself at her side. Perhaps he would have an opportunity to examine his scryer. "And I as well." Stenn crouched near Jodah. "I'll stay here. He's~ not looking so great." Jodah waved Stenn away, weakly. "I need a minute to recoup my strength. Go on. If Teferi is alone, and he suffers an attack like the one we just suffered, the results could be dire. He could be compleated. Or killed." "And you're too weak to fight off a second attack alone," Stenn said, reasonably. "You're too proud, old man," Jaya said. "Learn how to accept help." From how Jodah's face pinched, Karn guessed this was an old argument between him and Jaya, one that he had not been privy to. Jaya waved Karn along with her, and the two left the basement, returning to the rattling staircase. They climbed upward in silence. Karn's footsteps, despite his care, seemed loud, metal against metal. Jaya ascended spritely as a cat. "Your magic is extremely effective against the Phyrexian creatures," Karn said. Though Karn could not see Jaya's face, he could hear the grin in her voice. "Have to say, controlled pyromania is the best part of being a fire mage. You do get a feeling for what burns." "Your fire seems to sterilize them," Karn said. "As if it is inimical." Jaya held up her hand, gesturing for silence. Karn fell still. Jaya's shoulders tensed. He could hear nothing. Jaya shook her head and continued upward. "I cannot believe that anyone with such magic would be a Phyrexian spy," Karn said, though he could, indeed, believe it. A Phyrexian would be capable of any subterfuge. "You have killed more of those creatures than the rest of us combined. If something happens to me, someone must know where the sylex is, so it can be deployed." "You finally decided you could trust me?" Jaya laughed. "I'm flattered." "Yes," Karn said. "It is hidden in Suq'Ata." Jaya didn't pause. "About time you told me that. Keeping the sylex's location in one mind is dangerous. Venser's spark or not, no one is invulnerable. Not even you." She had a point. In the upper stories, Teferi shouted, and both of them took off at a sprint. They found Teferi pinned to floor by a Phyrexian monstrosity that loomed over him like a hungry spider. Blood soaked his robes from a slash in his gut. Karn tore the creature from Teferi's body—even though its claws, hooked into his flesh, took muscle with it. He slammed it against the wall, pulverizing it. Jaya ran into the room. "Get down!" Karn pivoted and hunched his body over Teferi to protect him. Jaya bathed the room in fire. Phyrexian monstrosities—dozens of them, too many—screeched in agony. The cries died into despairing bubbling, into whimpering, then silence. The flames roasted Karn's back, scorching the blood and guts onto his metal body. "Clear," Jaya said. Karn lifted himself to his feet. "Karn, thank you." Teferi patted the top of his hair and found it unsinged. Jodah, his arm slung over Stenn's neck, joined them. Jodah seemed drained. He scanned the debris in the room—it had once been an office, complete with filing cabinets. "This involves far, far more than one creature," Jodah said. "You're right." Stenn slunk out from under Jodah's arm. "We use a lot of Thran technology in Argivia, and it looks like the Phyrexians have~ co-opted it somehow. Integrated into it. The thing's tendrils have spread throughout the entire watchtower." Karn examined Teferi's wound. He needed medical attention. "Perhaps we must consider lowering the barrier in order to obtain a physician for Teferi. He is gravely wounded." "Have you determined that we're all safe?" Teferi asked. "Can he afford to?" Jodah said. "He could wait. He could second-guess himself forever. He could test us all a thousand times. How could he ever know? How could anyone?" Jaya said, "I think we should eradicate any Phyrexians within the tower before lowering the barrier. If that creature so easily integrated itself into a single tower, what might it do to a city?" "What do you think we should do?" Stenn asked. "Go to the powerstone," Jaya said. "Let's root this out. At its source." Teferi grimaced. "If someone can get me up there, I'm game to follow Jaya's plan. We might as well try." "I can carry you," Karn said. Teferi gave him a long look, then sighed. "It's decided," Jodah said. Jaya cackled. "Oh, you've been waiting all night to be the one to say that, haven't you?" Jodah still had enough energy left in him to look annoyed. Karn shook his head at their exchange and knelt to lift Teferi—carefully. In the uppermost chamber, the powerstone's glow dominated the claustrophobic space, shining directly down into the central pedestal's control panel and filling the small circular room with its sickly yellow light. The arched windows ringing the room were still tightly shuttered with steel. Karn wished he could open one and feel the night's cool air on his body. He found a metal access panel and popped it open. The powerstone seemed integrated into a wire nest, which no doubt connected to the lockdown system, the boiler room, the vents, and everything else in the tower. Stenn pressed himself close to the panel to look. "It's worse than I thought." Karn glanced at Stenn. He had told each Planeswalker a false location for the sylex, but he had not yet tested Stenn. He spoke, low enough that the others would not hear. "I need to confide the sylex's location. If I am damaged and cannot reach it, the knowledge cannot be lost." "I understand," Stenn said, solemn. He did not seem at all perturbed. His focus lay on the wires in the walls. "Should that happen," Karn said, "you are to determine which among the Planeswalkers you can trust so that the sylex can be brought to New Phyrexia in order to destroy the Phyrexians at their center. I hesitate to ask this, as it would involve asking a Planeswalker to sacrifice themselves to repair my mistake~" "It would be an immense responsibility," Stenn said. Karn pretended reluctance, then spoke. "I concealed it in the ruins of Trokair, on Sarpadia." "That's all I needed," Stenn said. His voice, a sudden hiss, sounded horribly familiar. Stenn threw his robes from his shoulders. Surgery lines, previously invisible, deepened in his skin. The buttons on his shirt popped free as his chest seemed to swell and swell—only to burst, butterflying open, ribs splayed. Iron cords poured from his torso's cavity rather than intestines, weeping mucus and blood. His face, before all this horror, seemed ecstatic—as if he had finally found his purpose and fulfilled it. He raised his head, his eyes focused upward, his lips moving as in prayer. Hand-like claws emerged from his eyes and reached around his skull, to grip it. His metallic intestines slithered across the floor, hooking into the Thran powerstone, and his entire body stiffened. The powerstone's light throbbed, then dimmed, as Stenn consumed its energy. His mouth gaped, frozen in a voiceless whisper. He had converted his entire body into an antenna, Karn realized, and transmitted his hard-won knowledge to Sheoldred, confiding in her the sylex's location. Its false location. "Stop him," Teferi grunted. He clutched at his gut wound, and his eyes brightened with anger. "Don't let him—" Jaya lunged forward, her hands outthrust. Fire blazed. Stenn did not spare her a glance. His bloody wires reared up from the ground, debris sticking to their gore, and wrapped themselves around her like anacondas, binding her hands and pinning them to her sides. Jaya, unable to use her magic without searing herself, struggled against Stenn to free her hands. But she couldn't breathe. Her face blued. Karn charged toward her. Fast as he tore fibers away from her body, more writhed into place. Small tight lines threaded themselves between his fingers, defying him. Jaya's eyes seemed so wide, so panicked. Teferi sat up and readied his magic, but his spell, cast in such a weakened state, did little more than flicker into a nebulous blue haze before fading. Teferi moaned and sagged back onto the floor. The blood soaking his garments deepened in color as it wicked through the cloth. Jodah ran to Teferi's side, muttering a healing spell under his breath. "We have to get out of here!" Jodah shouted. Karn agreed. The control panel had a straightforward layout. He inserted the key Stenn had given him into the pedestal. He opened up a metal lid, then flipped the toggle. The steel shutters jolted upward, the chain within the walls rattled, and gears ground. Cool night air poured into the tower. But along with that fresh air came noises: gibbering and shrieks, from the city below. Karn could not free Jaya from the cables writhing around her, so he turned. He dismembered Stenn—no, not Stenn, the Phyrexian who had killed Stenn, who had compleated him and taken his place—with efficiency. He tried not to think about his actions: he removed bones from sockets, and tossed the pieces aside, as easily as stripping a chicken at a banquet. Jaya inhaled, her breath a rasp that carried through the dark, and then blasted not-Stenn with a gout of scarlet flame. The fire poured over Karn and sizzled across not-Stenn's flesh, frying his organic components. The Phyrexian sagged to the floor, a collection of blackened metal and crisped organics. Jodah looked up at Jaya. His hands lay outstretched over Teferi's stomach. "I'm too exhausted to heal him. I can keep him from bleeding out, but that's about it. We need help." "It is time that I call the #emph[Weatherlight] ," Karn said. "Why don't we give it a few more minutes? Until things are really desperate?" Jaya said. Karn opened the summoning amulet like a locket. He flipped the toggle inside. Shanna's voice, quiet and tinny, piped up. "What is it, Ajani?" "This is Karn. Jodah, Teferi, Jaya, and I need to be brought to safety. Teferi is wounded." There was a pause from the other end. "Your location?" "Argivia. In the watchtower. Under attack by Phyrexians." "Phyrexians?" Karn could hear the #emph[Weatherlight ] creaking in the winds. When she spoke again, her voice sounded calm and determined: "You're in luck—we're not far. If the winds favor us, we'll be there soon." "Understood." "See you soon. Shanna out." The Phyrexian noises seemed to be getting closer; echoing through the vents, between the walls, squeaks and burbles punctuated mechanical clicks and fleshy rustles. The entire tower was infested—perhaps even the entire city. Stenn had overseen rooting out Phyrexian agents in Argivia. It was fair to assume he had done the exact opposite. "Teferi is too wounded to move. We must hold out until Shanna arrives," said Karn. "Jaya, you seem to be in the best shape among us. You will lead. I will take up a central position as I must defend Teferi. Jodah, keep watch at the rear." Jodah opened his mouth. Jaya lit two fireballs in her hands. She weighed them and raised her eyebrows at Jodah. Jodah, abashed, closed his mouth. After a moment, he spoke, mild: "I was going to say that this is an excellent plan."
https://github.com/typst/packages
https://raw.githubusercontent.com/typst/packages/main/packages/preview/game-theoryst/0.1.0/README.md
markdown
Apache License 2.0
# Game-Theoryst A package for typesetting games in Typst. Full manual available [here](./doc/gtheoryst-manual.pdf) Work in progress -- _coming soon!_ ## Overview #### Simple Example The main function to make strategic (or **normal**) form games is `nfg`. For a basic 2x2 game, you can do ```typ #nfg( players: ("Jack", "Diane"), s1: ($C$, $D$), s2: ($C$, $D$), [$10, 10$], [$2, 20$], [$20, 2$], [$5, 5$], ) ``` <img alt="Basic Example" src="doc/gallery/simple-example.png" width="400"> ### Importing Simply insert the following into your Typst code: ```typ #import "@preview/game-theoryst:0.1.0": * ``` This imports the `nfg()` function as well as the underlining methods. If you want to tweak the helper functions for generating an `nfg`, import them explicitly through the `utils/` directory. #### Full Example ```typ #nfg( players: ([A\ Joe], [Bas Pro]), s1: ([$x$], [a]), s2: ("x", "aaaa", [$a$]), pad: ("x": 12pt, "y": 10pt), eliminations: ("s11", "s21", "s22"), ejust: ( s11: (x: (0pt, 36pt), y: (-3pt, -3.5pt)), s22: (x: (-10pt, -12pt), y: (-10pt, 10pt)), s21: (x: (-3pt, -9pt), y: (-10pt, 10pt)), ), mixings: (hmix: ($p$, $1-p$), vmix: ($q$, $r$, $1-q-r$)), custom-fills: (hp: maroon, vp: navy, hm: purple, vm: fuchsia, he: gray, ve: gray), [$0,vul(100000000)$], [$0,1$], [$0,0$], [$hul(1),1$], [$0, -1$], table.cell(fill: yellow.lighten(30%), [$hful(0),vful(0)$]) ) ``` <img alt="Full Example" src="doc/gallery/full-example.png" width="525"> ### Color By default, player names, mixed-strategy parameters (called _mixings_), and elimination lines are shown in color. These colors can be turned off at the method-level by passing `bw: true`, or at the document level by running the state helper-function `#colorless()`. `nfg` accepts custom colors for all of the aforementioned parameters by passing a `dictionary` of colors to the `custom-fills` arg. The keys for this dictionary are as follows (`<defaults>`): - `hp` -- "horizontal player" (red) - `vp` -- "vertical player" (blue) - `hm` -- "hor. mixing" (#e64173) - `vm` -- "ver. mixing" (eastern) - `he` -- "hor. elimination" line (orange) - `ve` -- "ver. elimination" line (olive) ## Cell Customization Since the payoffs are implemented as argument sinks (`..args`) which are passed directly to Typst's `#table()`, underlining of non-math can be accomplished via the standard `#underline()` command. Similarly, any of the payoff cells can be customized by using `table.cell()` directly. For instance, `table.cell(fill: yellow.lighten(30%), [$1, 1$])` can be used to highlight a specific cell. ### Padding There are edge cases where the default padding may be off. These can be mended by passing the optional `pad` argument to `nfg()`. This should represent how much **_additional_** padding you want. The `pad` arg. is interpreted as follows: - If a `length` is provided, it assumes you want that much length added to all cell walls - If an array of the form `(L1, L2)` is provided, it assumes you want padding a horizontal (`x`) padding of `L1` and a vertical padding (`y`) of `L2` - If a `dictionary` is provided, it operates identically to that of the array, but you must specify the `x`/`y` keys yourself ### AUtomatic Cell Sizing Cell are automatically sized to equal heights/widths according to the longest/tallest content. If you want to avoid this behavior, pass `lazy-cells: true` to `nfg`. This behavior can be combined with the custom `padding` argument. ## Semantic Game Theory Features ### Underlining The package imports a small set of underlining utility functions. The primary functions for underlining are - `hul()` -- _Horizontal Underline_ - `vul()` -- _Vertical Underline_ - `bul()` -- _Black Underline_ These can be wrapped around values in math-mode (`$..$`) within the payoff matrix. The underlines for `hul` and `vul` are colored by default according to the default colors for names, but they accept an optional `col` parameter for changing the color of the underline. `bul()` produces a black underline. ```typ #nfg( players: ("Jack", "Diane"), s2: ($x$, $y$, $z$), s1: ($a$, $b$), [$hul(0),vul(0)$], [$1,1$], [$2,2$], [$3,3$], [$4,4$], [$5,5$], ) ``` By default, these commands leave the numbers themselves black, but boldfaces them. _Full Color_ versions of `hul` and `vul`, which color the numbers and under-lines identically, are available via `hful()` and `vful()`. Like their counterparts, they accept an optional `col` command for the color. Both of the colors can be modified individually via the general `cul()` command, which takes in content (`cont`), an underline color (`ucol`), and the color for the text value (`tcol`). For instance, ```typ #let new-ul(cont, col: olive, tcol: fuchsia) = { cul(cont, col, tcol) } ``` will define a new command which underlines in olive and sets the text (math) color to fuchsia. ### Mixed Strategies You can optionally mark mixed strategies that a player will in a `nfg` using the `mixing` argument. This can be a `dictionary` with `hmix` and `vmix` keys, or an `array`, interpreted as a dictionary with the aforementioned keys in the `(hmix, vmix)` order. The values/entries here should be arrays which mimic `s1` and `s2` in size, with some parameter denoting the proportion of time the relevant player uses that strategy. If you would like to omit a strategy from this markup, pass `[]` in it's place. For example: ```typ #nfg( players: ("Chet", "North"), s1: ([$F$], [$G$], [$H$]), s2: ([$X$], [$Y$]), mixings: ( hmix: ($p$, $1-p$), vmix: ($q$, [], $1-q$)), [$7,3$], [$2,4$], [$5,2$], [$6,1$], [$6,1$], [$5,4$] ) ``` <img alt="Mixed Parameter Example" src="doc/gallery/mix-ex.png" width="400"> ### Iterated Deletion (Elimination) of Dominated Strategies You can use the `pinit` package to cross out lines, semantically eliminating strategies. `pinit` comes pre-imported with `game-theoryst` by default. You can tell `nfg` which strategies to eliminate with the `eliminations` argument and the corresponding `ejust` helper-argument. The `eliminations` argument is simply an `array` of `strings` of the form `"s<i><j>"`, where `<i>` is the player -- 1 or 2 -- and `<j>` is player `i`'s `<j>`th strategy, in left-to-right / top-to-bottom order _starting at 1_. These strategy strings represent the rows/columns which you want to eliminate. For instance, `("s12", "s21")` denotes an elimination of player 1's second strategy as well as player 2's first strategy. Due to `context` dependence, the lines typically need manual adjustments, which can be done via the `ejust` arg. `ejust` needs to be a dictionary with keys of matching those strings present in `eliminations` (`s11`, `s21`, etc.). The values of one of these dictionary entries is itself a dictionary: one with `x` and `y` keys. Each of these keys needs an array consisting of 2 lengths, corresponding to the starting/ending `dx/dy` adjustments from `pinit-line`. For example, one such `ejust` argument could be `("s12": (x: (5pt, -5pt), y: (-10pt, 3pt)))`. This says to adjust the "s12" elimination line by `5pt` in the x direction and `-10pt` in the y direction for the starting (strategy-) side of the line, and adjust by `-5pt` in x and `3pt` in y on the ending (payoff-) side of the line. ```typ #let just-arr = ( "s12": (x: (0pt, 10pt), y: (-3pt, -3pt)), "s13": (x: (0pt, 10pt), y: (-3pt, -3pt)), "s14": (x: (0pt, 10pt), y: (-3pt, -3pt)), "s21": (x: (-6pt, -8pt), y: (3pt, 8pt)), "s22": (x: (-4pt, -8pt), y: (3pt, 8pt)), "s23": (x: (-4pt, -8pt), y: (3pt, 8pt)), ) #nfg( players: ("A", "B"), s1: ([$N$], [$S$], [$E$], [$W$] ), s2: ([$W$], [$E$], [$F$], [$A$]), eliminations: ("s12", "s13", "s14", "s21", "s22", "s23"), ejust: just-arr, [$6,4$], [$7,3$], [$5,5$], [$6,6$], [$7,3$], [$2,7$], [$4,6$], [$5,5$], [$8,2$], [$6,4$], [$3,7$], [$2,8$], [$3,7$], [$5,5$], [$4,6$], [$5,5$], ) ``` <img alt="Elimination Example" src="doc/gallery/elim-ex.png" width="400"> ### Debugging If you want to see all of the lines for the table, including the ones for a players, strategies, and mixings, set the following at the top of your document. ```typ #set table.cell(stroke: (thickness: auto)) ``` Note that cells are always present for mixings, they just have 0 width/height when no mixings of a specific variety are provided. ## License game-theoryst Copyright © 2024 <NAME> This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more details. You should have received a copy of the GNU Affero General Public License along with this program. If not, see <http:www.gnu.org/licenses/>.
https://github.com/alberto-lazari/cv
https://raw.githubusercontent.com/alberto-lazari/cv/main/readme.md
markdown
# My CV My personal Curriculum Vitae, made with the [Brilliant CV](https://typst.app/universe/package/brilliant-cv) template PDF is available [here](https://github.com/alberto-lazari/cv/tree/main/alberto-lazari-cv.pdf) ## Compile it Compile it with ```sh typst compile alberto-lazari-cv.typ --font-path fonts ``` ## Credits - [Typst](https://github.com/typst/typst): amazing new open-source typsetting programming language - [Brilliant CV](https://github.com/mintyfrankie/brilliant-CV): [@mintyfrankie](https://github.com/mintyfrankie)'s CV template - [Awesome-CV](https://github.com/posquit0/Awesome-CV): original LaTeX template that inspired Brilliant CV
https://github.com/alberto-lazari/cns-report
https://raw.githubusercontent.com/alberto-lazari/cns-report/main/device.typ
typst
= Device virtualization <device_virtualization> In order to achieve a good level of scalability and efficient testing in a controlled environment, we opted for device virtualization, leveraging the capabilities of the Android emulator from the Software Development Kit (SDK). The emulator easily integrates with a virtual camera, a feature that can be implemented through a simple command line switch. This allowed us to simulate scanning scenarios without the need for physical devices. Moreover, emulators do not require a graphical user interface (GUI), enabling tests to be performed on a server environment. Each testing setup benefited from a clean Android environment, ensuring consistent and reliable results. This reproducibility is crucial for accurate testing and analysis Virtualization also provides complete control over the Android operating system version and build. This flexibility allows to test across different Android versions and configurations. Finally device virtualization eliminated the need for physical hardware, reducing logistical complexities and costs. Moreover, by no longer depending on the hardware potential differences in results attributable to varying hardware or vendor-specific configurations are eliminated.
https://github.com/csimide/SEU-Typst-Template
https://raw.githubusercontent.com/csimide/SEU-Typst-Template/master/init-files/bachelor_thesis.typ
typst
MIT License
#import "../seu-thesis/lib.typ": bachelor-conf, bachelor-utils #let (thanks, show-appendix) = bachelor-utils /* 使用模板前,请先安装 https://github.com/csimide/SEU-Typst-Template/tree/master/fonts 内的所有字体。 如果使用 Web App,请将这些字体上传到 Web App 项目的根目录中。 */ // 由于教务处模板没有严格规定代码块的字体,为了美观,在此设定代码块字体 #import "@preview/sourcerer:0.2.1": code #show raw.where(block: false): set text(font: ("Fira Code", "SimHei")) #let code = code.with( numbering: true, radius: 0pt, text-style: (font: ("Courier New", "SimHei")), ) #show: doc => bachelor-conf( student-id: "00121001", author: "王东南", school: "示例学院", major: "示例专业", advisor: "湖牌桥", thesis-name: "示例论文标题\n此行空白时下划线自动消失", date: "某个起止日期", cn-abstract: [ 摘要内容独立于正文而存在,是论文内容高度概括的简要陈述,应准确、具体、完整地概括论文的主要信息,内容包括研究目的、方法、过程、成果、结论及主要创新之处等,不含图表,不加注释,具有独立性和完整性,一般为400字左右。 “摘要”用三号黑体加粗居中,“摘”与“要”之间空4个半角空格。摘要正文内容用小四号宋体,固定1.5倍行距。 论文的关键词是反映毕业设计(论文)主题内容的名词,一般为3-5个,排在摘要正文部分下方。关键词与摘要之间空一行。关键词之间用逗号分开,最后一个关键词后不加标点符号。 在本模板中,摘要在参数中添加,例如 `cnabstract: [我的摘要]` 。关键词添加的方法类似,例如 `cnkeywords: ("关键词1", "关键词2")`。有关这一部分的信息,可参考 demo 文档的写法。 ], cn-keywords: ("关键词1", "关键词2"), en-abstract: [ 英文摘要应与中文摘相对应,250个实词左右。采用第三人称介绍该学位论文内容,叙述的基本时态为一般现在时,确实需要强调过去的事情或者已经完成的行为才使用过去时、完成时等其他时态。 ABSTRACT为三号Times New Roman加粗居中。 英文摘要正文为小四号Times New Roman,固定1.5倍行距。英文关键词“KEY WORDS”大写,其后的关键词第一个字母大写,关键词之间用半角逗号隔开。 #lorem(100) // 添加一段英文乱语,供排版预览效果。 ], en-keywords: ("Keywords1", "Keywords2"), doc, ) = 绪论 == 课题背景和意义 绪论部分主要论述选题的意义、国内外研究现状以及本文主要研究的内容、研究思路以及内容安排等。 章标题为三号黑体加粗居中;一级节标题(如,2.1 本文研究内容):四号黑体居左;二级节标题(如,2.1.1 实验方法):小四号宋体居左。 正文部分为小四号宋体,行间距1.5倍行距,首行缩进2个字符。 有时,首行缩进不起作用(Typst 的已知问题)。此时,可以使用 ```typ #h(2em)``` 手动插入两个汉字长度的空间,“手动”首行缩进。如果打开 demo 源文件,可以发现本小节的第一段是用这种方式手动缩进的。*请注意,在成文后,需要自行检查首行缩进是否工作正常。* == 研究现状 #strike[目前,由于宋体(SimSun)、黑体(SimHei)均是单一字重字体,而 Typst 0.10.0 尚未加入伪粗体的支持,本文档的中文部分暂时无法加粗。章节大标题等需要加粗的地方也未加粗。因 https://github.com/typst/typst/pull/2970 已经合并了改善字体描边功能的 PR,预计在之后的版本中即可直接或间接使用伪粗体,届时本模板亦将相应修改。] 在 0.11.0 中,Typst 提供了间接实现伪粗体的方式。本模板亦已通过 cuti 包加入粗体相关支持。如需使用粗体,可以用 ```typ *``` 包裹需要加粗的文字,或者使用 ```typst #text(weight: "bold")```。比如,*这是一段加粗文字的示例。* == 本文研究内容 文章的首页内容,也就是题目、学号、姓名等,都是通过参数传入模板的。请参考 demo 源代码修改。 = 第二章标题 具体研究内容每一章应另起页书写,层次要清楚,内容要有逻辑性,每一章标题需要按论文实际研究内容进行填写,不可直接写成第二章 正文。研究内容因学科、选题特点可有差异,但必须言之成理,论据可靠,严格遵循本学科国际通行的学术规范。 中文为小四号宋体,英文及数字为小四号Times New Roman,首行缩进2个字符,行间距为1.5倍。正文一般不少于15000字。 == 插图格式要求 插图力求精炼,且每个插图均应有图序和图名。图序与图名位于插图下方,图序一般按章节编排,如图1-1(第一章第1个图),在插图较少时可以全文连续编序,如图10。 插图居中排列,与上文文本之间空一行。图序图名设置为五号宋体居中,图序与图名之间空一格。 本模板采用按章节编号的方式。如果需要插入带自动编号的图片,需要使用`#figure`。例如,使用下面的代码插入带编号的图片: #code( ```typst #figure( image("./demo_image/24h_rain.png", width: 8.36cm),// 宽度/高度需要自行调整 caption: [每小时降水量24小时均值分布图] ) <​每小时降水量24小时均值分布图> ``` ) #figure( image("./demo_image/24h_rain.png", width: 8.36cm), caption: [每小时降水量24小时均值分布图] )<每小时降水量24小时均值分布图> #h(2em) 通常情况下,插入图、表等组件后,后续的首个段落会丢失首行缩进,需要使用 ```typ #h(2em)``` 手动补充缩进。您也可以尝试使用 `indenta` 包来完成缩进。 如一个插图由两个及以上的分图组成,分图用(a)、(b)、(c)等标出,并标出分图名。目前,本模板尚未实现分图的字母自动编号。如需要分图,建议使用 ```typ #grid``` 来构建。例如: #code( ```typst #figure( grid( columns: (3.83cm, 5.51cm), image("./demo_image/2-2a.png") + "(a) 速度障碍集合", image("./demo_image/2-2b.png") + "(b) 避免碰撞集合" ), caption: "速度障碍法速度选择" ) ``` ) // 上面这处代码请不要直接复制 // 因为为了规避渲染报错,加了一个零宽度空格 #figure( grid( columns: (3.83cm, 5.51cm), image("./demo_image/2-2a.png") + "(a) 速度障碍集合", image("./demo_image/2-2b.png") + "(b) 避免碰撞集合" ), caption: "速度障碍法速度选择" ) #h(2em) 实际使用中,网格划分、网格大小调整需要自行操作。 如果需要在文中引用这些图表,应当先给对应部分打 label ,再到需要引用的地方使用 ```typ @``` ,注意引用公式、图表需要添加相应的前缀,如 ```typ @tbl:``` ```typ @fig:``` ```typ @eqt:```。例如,上面的@fig:每小时降水量24小时均值分布图 中使用 ```typ <>``` 添加了 label ,然后,使用```typ @fig:每小时降水量24小时均值分布图```引用,即可得到“@fig:每小时降水量24小时均值分布图”。 == 表格格式要求 表格的结构应简洁,一律采用三线表,应有表序和表名,且表序和表名位于表格上方。表格可以逐章单独编序(如:表2.1),也可以统一编序(如:表10),采用哪种方式应和插图及公式的编序方式统一。表序必须连续,不得重复或跳跃。 带编号、表名的表格需要使用 ```typ #figure``` 包裹,才能自动编号。方式与上方图片相仿,或者查看下面的代码说明。表格本身建议使用函数 `table` 或第三方库 `tablem` 库绘制。使用 `tablem` 库时,`#figure` 可能会认为其包裹的内容不是 `table` 类型,而编号“图X-X”。可以通过添加 `kind: table` 声明这是一个表格。 表格无法在同一页排版时,可以用续表的形式另页书写,续表需在表格右上角表序前加“续”字,如“续表2.1”,并重复表头。请注意:目前此模板内,```typ #figure``` 包裹的单个表格强制显示在同一页上,不会发生跨页现象。如果按照 https://github.com/typst/typst/pull/1121 启用了 ```typ #show figure: set block(breakable: true)```,那么跨页表格第二页暂时不会显示“续表”与表名。#strong[由于在教务处给出的Word模板中,跨页表格并没有加注“续表”,也没有给出“续表”的格式样例,因此本模板暂未实现相关功能。]如果使用 `table` 声明表头的特性,第二页会重复表头。 表格居中,边框为黑色直线1磅,中文为五号宋体,英文及数字为五号Times New Roman字体,表序与表名之间空一格,表格与下文之间空一行。#strong[在教务处给出的Word模板中,文字说明是表格边框为黑色直线1磅,但示例的表格边框是0.5磅,自相矛盾。请自行根据需求与格式要求调整框线粗细。] 在Typst中,绘制三线表的方法一般是设置 `table` 的 `stroke` 为 `none`,再通过 `table.hline()` 手动绘制横向分割线。可以使用 `table.hline(stroke: 0.5pt)` 类似的方法指定线条宽度,默认是 `1pt` (1磅)。 #code( ```typst #figure( { //show table.cell.where(y:0): set text(weight: "bold") // 取消这一行的注释可以首行加粗 table( columns: 13, rows: 1.8em, align: center + horizon, stroke: none, table.header( table.hline(), [], table.cell(colspan: 4)[Stage 1 (>7.1 μm)], table.cell(colspan: 4)[Stage 2 (4.8-7.1 μm)], table.cell(colspan: 4)[Stage 3 (3.2-4.7 μm)], table.hline(stroke: 0.5pt, start: 1), // 调整线条粗细 [], [Con], [Low], [Medium], [High], [Con], [Low], [Medium], [High], [Con], [Low], [Medium], [High], table.hline(), ), [H], [2.52], [2.58], [2.57], [2.24], [2.48], [2.21], [2.21], [2.36], [2.66], [2.65], [2.64], [2.53], [E], [0.87], [0.88], [0.93], [0.85], [0.9], [0.86], [0.86], [0.85], [0.9], [0.9], [0.85], [0.88], table.hline(), ) }, caption: "室外细菌气溶胶香农-维纳指数(H)和均匀性指数(E)", ) ``` ) #figure( { //show table.cell.where(y:0): set text(weight: "bold") // 取消这一行的注释可以首行加粗 table( columns: 13, rows: 1.8em, align: center + horizon, stroke: none, table.header( table.hline(), [], table.cell(colspan: 4)[Stage 1 (>7.1 μm)], table.cell(colspan: 4)[Stage 2 (4.8-7.1 μm)], table.cell(colspan: 4)[Stage 3 (3.2-4.7 μm)], table.hline(stroke: 0.5pt, start: 1), // 调整线条粗细 [], [Con], [Low], [Medium], [High], [Con], [Low], [Medium], [High], [Con], [Low], [Medium], [High], table.hline(), ), [H], [2.52], [2.58], [2.57], [2.24], [2.48], [2.21], [2.21], [2.36], [2.66], [2.65], [2.64], [2.53], [E], [0.87], [0.88], [0.93], [0.85], [0.9], [0.86], [0.86], [0.85], [0.9], [0.9], [0.85], [0.88], table.hline(), ) }, caption: "室外细菌气溶胶香农-维纳指数(H)和均匀性指数(E)", ) // 表格太多懒得手敲了 == 表达式 论文中的公式应注序号并加圆括号,序号一律用阿拉伯数字连续编序(如(28))或逐章编序(如(3.6)),编号方式应与插图、表格方式一致。序号排在版面右侧,且距右边距离相等。公式与序号之间不加虚线。本模板采用按章节编号的方式。 长公式在一行无法写完的情况下,原则上应在等号(或数学符号,如“+”、“-”号)处换行,数学符号在换行的行首。 公式及文字中的一般变量(或一般函数)(如坐标$X$、$Y$,电压$V$,频率$f$)宜用斜体,矢量用粗斜体如$bold(S)$或白斜体上加单箭头$limits(S)^arrow$,常用函数(如三角函数$cos$、对数函数$ln$等)、数字运算符、化学元素符号及分子式、单位符号、产品代号、人名地名的外文字母等用正体。 Typst 的公式与 LaTeX 写法不同,参见 Typst 官方文档。 在 Typst 中,使用 `$$` 包裹公式以获得行内公式,在公式内容两侧增加空格以获得块公式。如 ```typ $alpha + beta = gamma$``` 会获得行内公式 $alpha + beta = gamma$,而加上两侧空格,写成 ```typ $ alpha + beta = gamma $``` ,就会变成带自动编号的块公式: $ alpha + beta = gamma $ #h(2em) 与图表相同,公式后的第一段通常也需要手动缩进。 多行公式可以使用 `\ ` 换行(反斜杠紧跟空格或者反斜杠紧跟换行)。与 LaTeX 类似,`&` 可以用于声明对齐关系。 #code( ```typst $ E_"ocv" &= 1.229 - 0.85 times 10^(-3) (T_"st" - T_0) \ &+ 4.3085 times 10^(-5) T_"st" [ln(P_H_2/1.01325)+1/2 ln(P_O_2/1.01325)] $ ``` ) $ E_"ocv" &= 1.229 - 0.85 times 10^(-3) (T_"st" - T_0) \ &+ 4.3085 times 10^(-5) T_"st" [ln(P_H_2/1.01325)+1/2 ln(P_O_2/1.01325)] $ == 注释 正文中有个别名词或情况需要解释时,可加注说明,注释采用页末注(将注文放在加注页的下端)。在引文的右上角标注序号①、②、……,如“马尔可夫链#footnote[马尔可夫链表示……]”。若在同一页中有两个以上的注时,按各注出现的先后,顺序编号。引文序号,以页为单位,且注释只限于写在注释符号出现的同页,不得隔页。 注释应当采用 `#footnote` 插入。如上方的“马尔科夫链”及其注释,是通过下面的代码插入的。 #code( ```typst 马尔可夫链#footnote[马尔可夫链表示……] ``` ) = 总结与展望 == 工作总结 上述标题第三章仅为示例,实际论文报告可根据研究内容按序编排章节,最后一章结论与展望着重总结论文的创新点或新见解及研究展望或建议。 结论是对论文主要研究结果、论点的提炼与概括,应准确、简明、完整、有条理,使人看后就能全面了解论文的意义、目的和工作内容。主要阐述自己的创造性工作及所取得的研究成果在本学术领域中的地位、作用和意义。 结论要严格区分自己取得的成果与导师及他人的科研工作成果。在评价自己的研究工作成果时,要实事求是,除非有足够的证据表明自己的研究是“首次”的、“领先”的、“填补空白”的,否则应避免使用这些或类似词语。 == 工作展望 展望或建议,是在总结研究工作和现有结论的基础上,对该领域今后的发展方向及重要研究内容进行预测,同时对所获研究结果的应用前景和社会影响加以评价,从而对今后的研究有所启发。 == 为了参考文献而加的章节 参考文献需要使用 bib 格式的引用文献表,再在正文中通过 `@labelname` 方式引用。如 #code( ```typst 这里有一段话 @kopka2004guide. 引用多个会自动合并 @kopka2004guide @wang2010guide 。 ``` ) #h(2em)这里有一段话 @kopka2004guide,引用多个会自动合并 @kopka2004guide @wang2010guide 。 目前参考文献格式不符合教务处要求,会在今后重制/寻找合适的 csl 文件。 当前(Typst 0.11.x)的 GB/T 7714-2015 参考文献功能仍有较多问题;东大使用的参考文献也不是标准的 GB/T 7714-2015 格式。目前,我们尝试使用曲线方法解决: 为了生成中英文双语的参考文献表,本模板实验性地引入了 `bilingual-bibliography` 。有关该功能的详细信息,请访问 https://github.com/nju-lug/modern-nju-thesis/issues/3 。如果出现参考文献显示不正常的情况,请前往 https://github.com/csimide/SEU-Typst-Template/issues/1 反馈。 模板提供了 `bilingual-bib` 参数,用于控制是否使用 `bilingual-bibliography`。当 `bilingual-bib` 参数设置为 `true` 时,模板会使用 `bilingual-bibliography` 渲染。 本模板附带的 `gb-t-7714-2015-numeric-seu.csl` 是“修复”部分 bug 的 CSL 文件。该格式和东大格式不完全吻合,但比自带的 `gb7714-2015` 稍微符合一些。 参考文献过后,需要使用```typ #show: show-appendix```进入附录部分。 #bibliography( "ref.bib", // 替换为自己的bib路径 style: "gb-t-7714-2015-numeric-seu-bachelor.csl" ) #show: show-appendix = 这里是附录内容 == 附录测试1 在参考文献之后的章节会自动编为附录。同样,图表等要素在此都会使用 A B C 序号。例如: $ a^2 + b^2 = c^2 $ <ss1> #figure( [(假装这里是表格内容)], caption: [附录中的一个表格], kind: table, ) <flt> #thanks[ 学位论文正文和附录之后,一般应放置致谢(后记或说明),主要感谢指导老师和对论文工作有直接贡献和帮助的人士和单位。致谢言语应谦虚诚恳,实事求是。字数一般不超过1000个汉字。 “致谢”用三号黑体加粗居中,两字之间空4个半角空格。致谢内容为小四号宋体,1.5倍行距。 若需要渲染致谢,请用 ```typ #thanks[内容]```。 ]
https://github.com/mintyfrankie/brilliant-CV
https://raw.githubusercontent.com/mintyfrankie/brilliant-CV/main/letter.typ
typst
Apache License 2.0
/* * Functions for the CV template */ #import "./utils/styles.typ": * #let letterHeader( myAddress: "Your Address Here", recipientName: "<NAME> Here", recipientAddress: "Company Address Here", date: "Today's Date", subject: "Subject: Hey!", metadata: metadata, awesomeColors: awesomeColors, ) = { let accentColor = setAccentColor(awesomeColors, metadata) let letterHeaderNameStyle(str) = { text(fill: accentColor, weight: "bold", str) } let letterHeaderAddressStyle(str) = { text(fill: gray, size: 0.9em, smallcaps(str)) } let letterDateStyle(str) = { text(size: 0.9em, style: "italic", str) } let letterSubjectStyle(str) = { text(fill: accentColor, weight: "bold", underline(str)) } letterHeaderNameStyle(metadata.personal.first_name + " " + metadata .personal .last_name) v(1pt) letterHeaderAddressStyle(myAddress) v(1pt) align(right, letterHeaderNameStyle(recipientName)) v(1pt) align(right, letterHeaderAddressStyle(recipientAddress)) v(1pt) letterDateStyle(date) v(1pt) letterSubjectStyle(subject) linebreak() linebreak() } #let letterSignature(img) = { set image(width: 25%) linebreak() place(right, dx: -5%, dy: 0%, img) } #let letterFooter(metadata) = { // Parameters let firstName = metadata.personal.first_name let lastName = metadata.personal.last_name let footerText = metadata.lang.at(metadata.language).letter_footer // Styles let footerStyle(str) = { text(size: 8pt, fill: rgb("#999999"), smallcaps(str)) } return table( columns: (1fr, auto), inset: 0pt, stroke: none, footerStyle([#firstName #lastName]), footerStyle(metadata.lang.at(metadata.language).letter_footer), ) }
https://github.com/typst/packages
https://raw.githubusercontent.com/typst/packages/main/packages/preview/t4t/0.1.0/math.typ
typst
Apache License 2.0
#import "is.typ": same-type // Math #let minmax( a, b ) = ( calc.min(a, b), calc.max(a, b) ) #let clamp( min, max, value ) = { assert.eq(type(min), type(max), message:"Can't clamp values of different types!" ) assert.eq(type(min), type(value), message:"Can't clamp values of different types!" ) // (min, max) = minmax(min, max) if value < min { return min } else if value > max { return max } else { return value } } #let lerp( min, max, t ) = { assert.eq(type(min), type(max), message:"Can't lerp values of different types!" ) // (min, max) = minmax(min, max) return min + (max - min) * t } #let map( min, max, range-min, range-max, value ) = { assert.eq(type(min), type(max), message:"Can't map values from ranges of different types!" ) assert.eq(type(range-min), type(range-max), message:"Can't map values to ranges of different types!" ) assert.eq(type(min), type(value), message:"Can't map values with different types as the initial range!" ) // (min, max) = minmax(min, max) // (range-min, range-max) = minmax(range-min, range-max) let t = (value - min) / (max - min) return range-min + t * (range-max - range-min) }
https://github.com/SWATEngineering/Docs
https://raw.githubusercontent.com/SWATEngineering/Docs/main/src/2_RTB/PianoDiProgetto/sections/PianificazioneSprint/PrimoSprint.typ
typst
MIT License
#import "../../functions.typ": glossary === Primo #glossary[sprint] *Inizio*: Venerdì 10/11/2023 *Fine*: Giovedì 23/11/2023 *Obiettivi dello #glossary[sprint]*: - Normare le modalità di lavoro attualmente in uso all'interno delle _Norme di Progetto_, ponendo particolare attenzione su: processi primari, processi di supporto e processi organizzativi, il tracciamento del tempo speso (con riferimento allo #glossary[spreadsheet] "Time & Resource Manager") e l'inserimento di termini all'interno del _Glossario_; - Inizio della redazione dell'_Analisi dei Requisiti_, ideando i primi casi d'uso; - Inizio della stesura del _Piano di Progetto_, ponendo particolare attenzione su: analisi dei rischi tecnologici, di comunicazione e di pianificazione e il modello di sviluppo agile Scrum (#glossary[framework Scrum]); - Avvio della scrittura del _Glossario_; - Principio di realizzazione del #glossary[PoC]: - Creazione modulo di simulazione di sensori di temperatura; - Creazione modulo di inserimento dei dati simulati all'interno di #glossary[Kafka]\; - Containerizzazione dei moduli realizzati.
https://github.com/qujihan/typst-cv-template
https://raw.githubusercontent.com/qujihan/typst-cv-template/main/cv.typ
typst
#import "utils.typ": * #import "params.typ": * #let cv(info, body) = { set document(author: info.name, title: info.title) set page( number-align: center, margin: (x: 0.5in, y: 0.5in), ) set par( justify: true, leading: 0.8em, linebreaks: "optimized", ) set text( font: (default-config.font-en, default-config.font-zh), size: default-config.font-size, weight: default-config.font-weight, ) set footnote.entry(clearance: 0.5em, gap: 0.4em, indent: 2em, separator: none) show footnote.entry: set align(right) show footnote.entry: set text(size: default-config.font-size * 0.7) body }
https://github.com/jdupak/slides-gnu-cauldron-2024-borrowing-polonius
https://raw.githubusercontent.com/jdupak/slides-gnu-cauldron-2024-borrowing-polonius/master/main.typ
typst
Creative Commons Attribution 4.0 International
#import "@preview/polylux:0.3.1": * #import "@preview/fletcher:0.3.0" as fletcher: node, edge #import "theme/ctu.typ": * #show: ctu-theme.with(aspect-ratio: "4-3") #title-slide[ #set text(size: 1.3em) #v(6em) = Borrowing Polonius <NAME> #v(2em) #text(size: 0.7em)[ GNU Tools Cauldron 2024 16. 9. 2024 ] ] #title-slide[ #set text(size: 5em, weight: "bold") Rust?! #notes( ```md Let me start question? What is the first thing the comes to your mind about the programming language Rust? ``` ) ] #title-slide[ #set text(size: 4em, weight: "bold") #rotate(box(box([MEMORY SAFETY], stroke: theme.accent.lighten(10%) + 4pt, inset: 15pt, radius: 20pt), stroke: theme.accent.lighten(10%) + 4pt, inset: 6pt, radius: 20pt), -15deg) #notes( ```md Memory safety, OK. The Rust compiler, namely the borrow checker, can give your program sort of stamp that your "safe" parts of your program are not doing some nasty things with memory. ``` ) ] #title-slide[ #image("media/gccrs.png", height: 12em) #notes( ```md You might also have noticed - for example yesterday - that there is an ongoing effort to build an independent Rust compiler in GCC. ``` ) ] #title-slide[ #move(dx: 29%, dy: -30%)[#image("media/thought-bubble.svg", height: 100%)] #v(-55%) #move(dx: -25%, dy: 0%)[#image("media/gccrs.png", height: 9em)] #set text(size: 3.3em, weight: "bold",) #place(top+right, dy: 50pt, dx: -10pt, align(left, [Memory \ safety???])) #notes( ```md You might have noticed - for example yesterday - that there is an ongoing effort to build an independent Rust compiler in GCC. And you cannot really call yourself a Rust compiler if you don't have this borrow checker. Right? ``` ) ] #title-slide[ #set text(size: 4em, weight: "bold") #only(1)[#place(horizon+left, dy: -30pt, dx: 60pt, image("media/rust.svg", height: 40%))] #uncover(2)[#text(fill: black, [&])#text(fill: gray, [mut])] Polonius #uncover(2)[ #v(-10%) #move(dx: 0%, dy: 0%)[#image("media/gccrs.png", height: 30%)] #v(-30%) ] #notes( ```md So can Rust GCC give you this stamp as well? Well, unfortunatelly, the answer is "not yet". Rust is a very complex language and it takes a lot of work to compile it. However, that official Rust compiler has come up with a new independent library for borrow checking, called Polonius. And we were thinking, couldn't we save ourselves some work and... ...borrow this library. ``` ) ] #slide[ = Outline - About me - Terminology - Borrow checker rules - History of borrow checking - Lexical - NLL - Polonius - Rust GCC - BIR - Polonius engine #notes( ```md Well, as you might have guessed, we tried. And I am here today to tell you how it went. So let me briefly outline the agenda for this talk: - First, I might mention who I am and how I got to this work. - Then we will spent a significant time of the presentation trying to unserstand what borrow cheking is all about and why is it hard. This is in my oppinion best understood by looking at the evoluion of the analysis in the official compiler. - Finally, with enought background, we will look at Rust GCC and what it take to glue the Polonius Engine to it. ``` ) ] #slide[ = About Me #grid(columns: (100pt, 1fr), column-gutter: 30pt, row-gutter: 50pt, [#image("media/me.jpg", width: 100pt, height: 100pt, fit: "cover")], [ *<NAME>* \ #text(size: 0.85em, [#light([_#link("mailto:<EMAIL>", "<EMAIL>")_])]) \ #text(size: 0.85em, [#light([_#link("https://jakubdupak.com")_])]) ], only("2-")[#image("media/cvut-symbol.svg", height: 100pt)], only("2-")[ #text(fill: rgb("#0065BD"), [ *Memory safety analysis in Rust GCC* \ #light([#smallcaps("Faculty of Electrical Engineering")]) \ #text(size: 0.85em, [#light([_#link("https://dspace.cvut.cz/handle/10467/113390")_])]) ]) ], only("3-")[#image("media/ms.svg", height: 100pt)], only("3-")[ #text(fill: luma(60%), [ *Software Engineer* \ #light([#smallcaps("Rust Tooling Group")]) \ #text(size: 0.85em, [#light([_Microsoft Development Center Prague_])]) ]) ],) #notes( ```md ``` ) ] #section[ = Terminology ] #slide[ #set align(center+horizon) #set text(size: 1.25em) == Reference | Borrow #set text(size: 2em, weight: "bold") _#light[checked pointer]_ #v(50pt) #set text(size: 0.75em) ```rust let reference: &i32; ``` ] #slide[ #set align(center+horizon) #set text(size: 1.25em) == Borrowing #set text(size: 2em, weight: "bold") _#light[taking a reference]_ #v(50pt) #set text(size: 0.75em) ```rust &value ``` ] #slide-big[ == Loan ][ _#light[the result of borrowing]_ ][ ```rust &value ``` ] #slide-big[ == Lifetime | Origin | Region ][ _#light[abstract notion of a part of program]_ ][ range of lines, set of CFG nodes ] #section[ = Borrow Checker Rules ] #slide-big[ = High-level Rules ][ #set text(size: 0.8em) #light([#sym.section 1]) \ No invalid memory access #light([#sym.section 2]) \ No mutable reference aliasing ][] #slide[ == #light([#sym.section 1]) No invalid memory access - Move #only(2)[ ```rust let mut v1 = Vec::new(); v1.push(42) let mut v2 = v1; // <- Move println!(v1[0]); // <- Error ``` #v(0.5em) ] #only("1-")[ - Borrow must not outlive borrowee - Lifetime subset relation ] #only(3)[ ```rust fn f() -> &i32 { &(1+1) } // <- Error ``` #v(0.5em) ] ] #slide[ == #light([#sym.section 2]) No mutable reference aliasing - #light([Either]) one mutable _live_ reference \ #light([or]) multiple (shared) immutable reference #let c = ```rust let mut counter = 0; let ref1 = &mut counter; // ... let ref2 = &mut counter; // <- Error use(ref1) ``` #only(2)[#code((1,2,3,4,5), c)] #only(3)[#code((5,), c)] - No modification of borrowed data ] #slide[ = Checking Functions #let v = ```rust struct Vec<&'a i32> { ... } impl<'a> Vec<&'a i32> { fn push<'b> where 'b: 'a (&mut self, x: &'b i32) { // ... } } ``` #only(1)[#code((1,2,3,4,5,6), v)] #only(2)[#code((3,4), v)] #only(3)[#code((5,), v)] #notes( ```md OK, so checking those rules locally (in a single function) is quite easy, but checking the whole program would be extremly expensive. It would also require the borrow checker to see the whole program, so no linking. Therefore the Rust people had to come with a clever trick. Most of the properties are local by nature. If you pass a mutable reference to a function, it must have been unique in the caller, otherwise the caller would locally violate the rules. The only rule we need to check across function boundaries is subset of lifetimes (validity periods of references). So, on the function boundary, programmer is required to describe the invariants of lifetimes manually. Each reference can be ascribed with a inference variable, written with apostroph at the beginning and we can relate those references using a subset relation. Lets see an example. We have a function magic, which takes a reference to an integer and returns some reference to an integer. From this signature, we cannot assume anything about the relation between the input and output reference. It could be an identity function. It could return a reference to a temporary value. Fortunatelly, we can detect this locally, so we can ignore this case. It could also return a reference to a global variable. Or randomly return a reference to a global variable or the input reference. Or more realistically choose between the input references. There is no way of knowing without looking at the implementation. So lets take a more realistic code and add some lifetime annotation. We have a Vector that stores references to integers. We require that lifetimes of the references are bound by some lifetime `'a`. We also have a push method, which takes a reference to an integer and a lifetime `'b` and we require that `'b` is a subset of `'a`. This is a way of saying that the reference must be valid at least as long as `'a`. We don't mind if it is valid longer. Now, in many cases you could just write `'a` everywhere and the compiler would coerce the lifetimes at call site. But there are some cases with mutable references and variance, where we need to be more careful. ``` ) ] #slide[ = Propagating lifetimes #only(1, ```rust fn max_ref(a: &i32, b: &i32) -> &i32 { let mut max = a; if (*max < *b) { max = b; } max } ```) #only(2, code((1,2),```rust fn max_ref(a: &'a i32, b: &'a i32) -> &'a i32 { let mut max = a; if (*max < *b) { max = b; } max } ```)) #only(3, code((1,2),```rust fn max_ref(a: &'a i32, b: &'b i32) -> &'c i32 { let mut max = a; if (*max < *b) { max = b; } max } ```)) #only(4, code((3,),```rust fn max_ref(a: &'a i32, b: &'b i32) -> &'c i32 { let mut max: &i32 = a; if (*max < *b) { max = b; } max } ```)) #only(5, { code((3,4,5,5,6,7),```rust fn max_ref(a: &'a i32, b: &'b i32) -> &'c i32 { let mut max: &'?1 i32 = a; if (*max < *b) { max = b; } max } ```) set align(horizon + center) set text(size: 1.5em, ) table(columns: 2, column-gutter: 50pt, row-gutter: 10pt, stroke: none, [`max = a`],[ `'a: '?1` ], [`max = b`], [ `'b: '?1` ], [`return max`], [ `'?1: 'c` ], ) }) ] #section[ = Borrow checker evolution Lexical, NLL, Polonius ] #slide-big[ == Lexical borrow checker ][ lifetime = lexical scope#imp("*") ][] #slide[ == Lexical borrow checker #set text(size: 1em) #let c1 = ```rust fn foo() { let mut data = vec!['a', 'b', 'c']; capitalize(&mut data[..]); data.push('d'); data.push('e'); data.push('f'); } fn capitalize(data: &mut [char]) { // do something } ``` #only(1)[#code((1,2,3,4,5,6,7,8,9,10,11,12), c1)] #only(2)[#code((2,), c1)] #only(3)[#code((3,9,10,11), c1)] #only(4)[#code((4,5,6,), c1)] #only(5)[ ```rust fn foo() { let mut data = vec!['a', 'b', 'c']; // --+ capitalize(&mut data[..]); // | // ^~~~~~~~~~~~~~~~~~~~~~~~~ 'lifetime // | data.push('d'); // | data.push('e'); // | data.push('f'); // | } // <---------------------------------------+ fn capitalize(data: &mut [char]) { // do something } ``` ] #only(6)[ ```rust fn bar() { let mut data = vec!['a', 'b', 'c']; let slice = &mut data[..]; // <-+ 'lifetime capitalize(slice); // | data.push('d'); // ERROR! // | data.push('e'); // ERROR! // | data.push('f'); // ERROR! // | } // <------------------------------+ ``` ] #only(7)[ ```rust fn bar() { let mut data = vec!['a', 'b', 'c']; { let slice = &mut data[..]; // <-+ capitalize(slice); // | } // <------------------------------+ data.push('d'); // OK data.push('e'); // OK data.push('f'); // OK } ``` ] ] #slide[ == Lexical borrow checker #set text(size: .9em) #let c = ```rust fn process_or_default<K,V:Default>( map: &mut HashMap<K,V>, key: K ) { match map.get_mut(&key) { // -------------+ Some(value) => process(value), // | None => { // | map.insert(key, V::default()); // | // ^~~~~~ ERROR. // | } // | } // <------------------------------------+ } ``` #only(1)[#code((1,2,3,4,5,6,7,8,9,10,11,12), c)] #only(2)[#code((7,8,9), c)] ] #slide-big[ == Non-lexical lifetimes (NLL) ][ lifetime = set of CFG nodes ][] #slide[ == Non-lexical lifetimes (NLL) #set text(size: 1em) #grid(columns: (5.5fr, 2fr), column-gutter: -100pt)[ #let c = ```rust fn process_or_default<K,V>( map: &mut HashMap<K,V>, key: K ) { match map.get_mut(&key) { Some(value) => { process(value); }, None => { map.insert(key, ...); } } } ``` #only(1)[#code((1,2,3,4,5,6,7,8,9,10,11,12,12), c)] #only(2)[#code((2,5), c)] #only(3)[#code((6,7,8), c)] #only(4)[#code((9,10,11), c)] ][ #set text(size: 0.9em, font: "Roboto Mono") #only("1-2")[ #fletcher.diagram( { let (start, match, s, n, end, ret) = ((0,0), (0,-0.75), (-0.5, -1.5), (0.5, -1.5), (0, -2.25), (0, -3)) node(start, "Start") node(match, "Match") node(s, "Some") node(n, "None") node(end, "End") node(ret, "Return") edge(start, match, "->") edge(match, s, "->") edge(match, n, "->") edge(s, end, "->") edge(n, end, "->") edge(end, ret, "->") })] #only("3-")[ #fletcher.diagram( { let (start, match, s, n, end, ret) = ((0,0), (0,-0.75), (-0.5, -1.5), (0.5, -1.5), (0, -2.25), (0, -3)) node(start, "Start") node(match, text(fill:blue, "Match")) node(s, text(fill:green, "Some")) node(n, text(fill:red, "None")) node(end, text(fill:red, "End")) node(ret, "Return") edge(start, match, "->") edge(match, s, "->") edge(match, n, "-->") edge(s, end, "-->") edge(n, end, "-->") edge(end, ret, "-->") })] ] #notes( ```md So we have out example again and on the right side we also have a very simple control flow graph. There is the start of the function, the match statement, the two branches of the match statement, end of the match statement and the end of the function. In the match node we call into the hashmap. ``` ) ] #slide[ == Breaking NLL #grid(columns: (3fr, 1fr), column-gutter: -100pt)[ #let c = ```rust fn get_default<'m,K,V>( map: &'m mut HashMap<K,V>, key: K ) -> &'m mut V { match map.get_mut(&key) { Some(value) => value, None => { map.insert(key, ...); map.get_mut(&key) } } } ``` #only(1, code((1,2,3,4,5,6,7,8,9,10,11,12,13), c)) #only(2, code((4,10), c)) #only(3, code((5,), c)) #only(4, code((5,6,7), c)) #only(5, code((5,6,7,12,13), c)) #only(6, code((5,6,7,8,9,10,11,12,13), c)) #only(7, code((8,9,10,11), c)) ][ #set text(size: .9em, font: "Roboto Mono") #let cfg(step) = { fletcher.diagram( { let (start, match, s, n, end, ret) = ((0,0), (0,-0.75), (-0.5, -1.5), (0.5, -1.5), (0, -2.25), (0, -3)) node(start, text(fill: if step >= 5 { red } else { black }, "Start")) node(match, text(fill: if step >= 2 { blue } else { black }, "Match")) node(s, text(fill: if step >= 3 { green } else { black },"Some")) node(n, text(fill: if step >= 5 { green } else { black }, weight: if step >= 6 { 900 } else { 900 } ,"None")) node(end, text(fill: if step >= 4 { green } else { black}, "End")) node(ret, text(fill: if step >= 4 { green } else { black},"Return")) edge(start, match, "->") edge(match, s, "->") edge(match, n, "->") edge(s, end, "->") edge(n, end, "->") edge(end, ret, "->") })} #for step in range(8) { only(step, cfg(step - 1)) } ] ] #slide-big[ == Polonius ][ lifetime = set of loans ][] #slide[ = Polonius #set text(size: 1em) #grid(columns: (3fr, 1fr), column-gutter: -100pt)[ #let c = ```rust fn get_default<'m,K,V>( map: &'m mut HashMap<K,V>, key: K ) -> &'m mut V { match map.get_mut(&key) { Some(value) => value, None => { map.insert(key, ...); map.get_mut(&key) } } } ``` #only(1, code((8,9,10,11), c)) ][ #set text(size: 0.9em,font: "Roboto Mono") #let cfg(step) = { fletcher.diagram( { let (start, match, s, n, end, ret) = ((0,0), (0,-0.75), (-0.5, -1.5), (0.5, -1.5), (0, -2.25), (0, -3)) node(start, text(fill: if step >= 5 { red } else { black}, "Start")) node(match, text(fill: if step >= 2 { red } else { black}, "Match")) node(s, text(fill: if step >= 3 { red } else { black},"Some")) node(n, text(fill: if step >= 5 { red } else { black},"None")) node(end, text(fill: if step >= 4 { red } else { black}, "End")) node(ret, text(fill: if step >= 4 { red } else { black},"Return")) edge(start, match, "->") edge(match, s, "->") edge(match, n, "->") edge(s, end, "->") edge(n, end, "->") edge(end, ret, "->") })} #for step in range(2) { only(step, cfg(step)) } ] ] #slide[ = Polonius ```rust let r: &'0 i32 = if (cond) { &x /* Loan L0 */ } else { &y /* Loan L1 */ }; ``` ] #section[ = Computing! Steps of the borrow checker ] #slide[ #only(1)[ #box(width: 100%, height: 100%, clip: true, inset: (top: 0pt), align(center, image("media/polonius.svg", height: 100%))) ] #only(2)[ #box(width: 100%, height: 100%, clip: true, inset: (top: 0pt), align(center, image("media/polonius.svg", height: 200%))) ] #only(3)[ #box(width: 100%, height: 100%, clip: true, inset: (top: -50%, bottom: 50%), align(center, image("media/polonius.svg", height: 200%))) ] #only(4)[ #box(width: 100%, height: 100%, clip: true, inset: (top: -100%, bottom: 100%), align(center, image("media/polonius.svg", height: 200%))) ] #only(5)[ #box(width: 100%, height: 100%, clip: true, inset: (top: 0pt), align(center, image("media/polonius.svg", height: 100%))) ] ] #section[ = Back to Rust GCC BIR, Variance, Polonius, Future ] #slide[ = Rust GCC #set align(center+horizon) #image("media/pipeline.svg", height: 100%) ] #slide[ == MIR #set text(size: 1.2em) ```rust struct Foo(i32); fn foo(x: i32) -> Foo { Foo(x) } ``` ] #slide[ == MIR #set text(size: 1.2em) ```rust fn foo(_1: i32) -> Foo { debug x => _1; let mut _0: Foo; bb0: { _0 = Foo(_1); return; } } ``` ] #slide[ === MIR: Fibonacci #set text(size: 1.2em) ```rust pub fn fib(n: u32) -> u32 { if n == 0 || n == 1 { 1 } else { fib(n-1) + fib(n - 2) } } ``` ] #slide[ === MIR: Fibonacci #set text(size: 0.7em) #columns(2, gutter: 11pt)[ ```rust fn fib(_1: u32) -> u32 { bb0: { StorageLive(_2); StorageLive(_3); _3 = _1; _2 = Eq(move _3, const 0_u32); switchInt(move _2) -> [0: bb2, otherwise: bb1]; } bb2: { StorageDead(_3); StorageLive(_4); StorageLive(_5); _5 = _1; _4 = Eq(move _5, const 1_u32); switchInt(move _4) -> [0: bb4, otherwise: bb3]; } bb7: { _11 = move (_13.0: u32); StorageDead(_12); _10 = fib(move _11) -> [return: bb8, unwind: bb11]; } bb8: { StorageDead(_11); _14 = CheckedAdd(_6, _10); assert(!move (_14.1: bool)) -> [success: bb9, unwind: bb11]; } bb9: { _0 = move (_14.0: u32); StorageDead(_10); StorageDead(_6); goto -> bb10; } bb10: { StorageDead(_4); StorageDead(_2); return; } ```] ] #slide[ = Rust GCC #set align(center+top) #image("media/pipeline.svg", height: 80%) ] #slide[ = Rust GCC #set align(center+horizon) #image("media/bir.svg") ] #slide[ == BIR: Borrow Checker IR #set text(size: 1em) - basic block list - basic block - place database - arguments - return type - universal lifetimes - universal lifetime constraints ] #slide[ == BIR: Borrow Checker IR #set text(size: 1em) - `Statement` - `Assignment` - `InitializerExpr` - `Operator<ARITY>` - `BorrowExpr` - `AssignmentExpr (copy)` - `CallExpr` - `Switch`, - `Goto` - `Return` - `StorageLive`, `StorageDead` - `UserTypeAsscription` ] #slide[ === BIR: Fibonacci #set text(size: 0.7em) #columns(2, gutter: 1pt)[ ```rust fn fib(_2: u32) -> u32 { bb0: { StorageLive(_3); StorageLive(_5); _5 = _2; StorageLive(_6); _6 = Operator( move _5, const u32); switchInt(move _6) -> [bb1, bb2]; } bb2: { StorageLive(_8); _8 = _2; StorageLive(_9); _9 = Operator( move _8, const u32); _3 = move _9; goto -> bb3; } bb4: { _1 = const u32; goto -> bb8; } bb5: { StorageLive(_14); _14 = _2; StorageLive(_15); _15 = Operator( move _14, const u32); StorageLive(_16); _16 = Call(fib)(move _15) -> [bb6]; } bb8: { return; } ```] ] #slide[ == Facts colector #set text(size: 0.8em) ``` <Origin, Loan, Point> loan_issued_at Origin universal_region <Point, Point> cfg_edge <Loan, Point> loan_killed_at <Origin, Origin, Point> subset_base <Point, Loan> loan_invalidated_at <Variable, Point> var_used_at <Variable, Point> var_defined_at <Variable, Point> var_dropped_at <Variable, Origin> use_of_var_derefs_origin <Variable, Origin> drop_of_var_derefs_origin <Path, Path> child_path <Path, Variable> path_is_var <Path, Point> path_assigned_at_base <Path, Point> path_moved_at_base <Path, Point> path_accessed_at_base <Origin, Origin> known_placeholder_subset <Origin, Loan> placeholder ``` ] #slide[ == Generics and Variance #set text(size: 1.2em) #only("1")[ ```rust let a: &?1 i32; let b: &?2 i32; /// ... a = b; ```] #only("2-")[ ```rust let a: Foo<'a, 'b, T>; let b: Foo<'a, 'b, T>; /// ... a = b; ```] \ #only("3-")[ ```rust struct Foo<'a, 'b, T> { x: &'a T, y: Bar<T>, } ```] ] #slide[ = Bootstraping - Polonius is written in advanced Rust - Similar problem with proc macros - For now - Optional component compiled by _rustc_ ] #slide[ = GSoC 2024 #grid(columns: (100pt, 1fr), column-gutter: 30pt, row-gutter: 50pt, [#image("media/kushal.png", width: 100pt, height: 100pt, fit: "cover")], [ *Borrow-checking IR location support* \ #text(size: 0.85em, [ Kushal Pal ]) \ #text(size: 0.85em, [#light([_#link("https://summerofcode.withgoogle.com/programs/2024/projects/DPiEgdZa")_])]) \ #text(size: 0.85em, [#light([_#link("https://github.com/braw-lee/gsoc-2024/blob/main/README.md")_])]) ] ) ] #section[ = Detected Errors Move, Subset and Loan Errors ] #slide[ = Detected Errors - Mainly limited by BIR translation - Detected - Move errors - Subset errors - Loan errors ] #slide[ == Move Errors #set text(size: 1em) #only(1)[ #set text(size: 1.2em) ```rust fn f() { struct A { i: i32, } let a = A { i: 1 }; let b = a; let c = a; } ```] #only("2-")[ #set text(size: .8em) ```rust fn f() { struct A { i: i32 } let a = A { i: 1 }; let b = a; let c = a; } ```] #only(2)[ ``` example_2.rs:2:1: error: Found move errors in function f 2 | fn f() { | ^~ ```] #only(3)[ ``` example_2.rs:8:13: error: use of moved value 7 | let b = a; | ~ | | | value moved here 8 | let c = a; | ^ | | | moved value used here ```] ] #slide[ == Loan Errors #set text(size: 1em) #only(1)[ #set text(size: 1.2em) ```rust fn f() { let mut x = 0; let y = &mut x; let z = &x; let w = y; } ```] #only("2-")[ #set text(size: .8em) ```rust fn f() { let mut x = 0; let y = &mut x; let z = &x; let w = y; } ```] #only(2)[ ``` example_1.rs:2:1: error: Found loan errors in function f 2 | fn f() { | ^~ ```] #only(3)[ ``` example_1.rs:5:13: error: use of borrowed value 4 | let y = &mut x; | ~ | | | borrow occurs here 5 | let z = &x; | ^ | | | borrowed value used here ```] ] #slide[ == Subset Errors #set text(size: 1em) #only(1)[```rust fn f<'a, 'b>( b: bool, x: &'a u32, y: &'b u32 ) -> &'a u32 { if b { y } else { x } } ```] #only("2-")[```rust fn f<'a, 'b>(b, x: &'a, y: &'b) -> &'a { if b { y } else { x } } ```] #only(2)[ ``` example_3.rs:2:1: error: Found subset errors in function f. Some lifetime constraints need to be added. 2 | fn f<'a, 'b>(...) -> &'a u32 { | ^~ ```] #only(3)[ ``` example_3.rs:2:1: error: subset error, some lifetime constraints need to be added 2 | fn f<'a, 'b>(...) -> &'a u32 { | ^~ ~~ ~~ | | | | | | | lifetime defined here | | lifetime defined here | subset error occurs in this function ```] ] #title-slide[ = Conclusion Polonius trouble, Future work ] #slide[ = Polonius Engine Deprecated - Problems with over-materialization - Rust Edition 2024 - Polonius Algorithm - NLL Infrastructure - Only minimal part of this work is bound to Polonius engine ] #slide[ = TODO - Finish translation to BIR - Match expressions - Two-phase borrowing - Drops - Collect implicit type constrains - `(&'a T => T: 'a)` - Improve error messages - Store additional information - Deduplicate by reason - Emit crate metadata - #light([(see _#link("https://dspace.cvut.cz/bitstream/handle/10467/113390/F3-DP-2024-Dupak-Jakub-thesis.pdf?sequence=-1&isAllowed=y#section.6.1", "my thesis [section 6.1]")_ for a more detailed list)]) ] #title-slide[ #move(dy: 6em,image("media/ferris-happy.svg", height: 40%)) #v(3em) #text(size: 3em, weight: 800)[That's all Folks!] ] #slide[ = References #set text(size: 0.7em, weight: "regular") Slides made with Typst and Polylux. #set text(size: 0.7em, weight: "regular") - DUPAK, Jakub. Memory Safety Analysis in Rust GCC. Available from: _#link("https://dspace.cvut.cz/bitstream/handle/10467/113390/F3-DP-2024-Dupak-Jakub-thesis.pdf")_ - PAL, Kushal. Google Summer of Code 2024 : Final report. Available from https://github.com/braw-lee/gsoc-2024/blob/main/README.md - MATSAKIS, Niko. Non lexical lifetimes introduction. Available from: _#link("https://smallcultfollowing.com/babysteps/blog/2016/04/27/non-lexical-lifetimes-introduction/")_ - MATSAKIS, Niko. 2094-nll. In : The Rust RFC Book. Online. Rust Foundation, 2017. Available from _#link("https: rust-lang.github.io/rfcs/2094-nll.html")_ - STJERNA, Amanda. Modelling Rust’s Reference Ownership Analysis Declaratively in Datalog. Online. Master’s thesis. Uppsala University, 2020. Available from: _#link("https://www.diva-portal.org/smash/get/diva2:1684081/fulltext01.pdf")_ - MATSAKIS, Niko, RAKIC, Rémy and OTHERS. The Polonius Book. 2021. Rust Foundation. - GJENGSET, Jon. Crust of Rust: Subtyping and Variance. 2022. Available from _#link("https://www.youtube.com/watch?v=iVYWDIW71jk")_ - Rust Compiler Development Guide. Online. Rust Foundation, 2023. Available from _#link("https://rustc-dev-guide.rust-lang.org/index.html")_ - TOLVA, <NAME>. Original Ferris.svg. Available from _#link("https://en.wikipedia.org/wiki/File:Original_Ferris.svg")_ #light("This work is licensed under CC BY 4.0.") \ #light([Sources are available at _#link("https://github.com/jdupak/slides-gnu-cauldron-2024-borrowing-polonius")_]) ]
https://github.com/csimide/SEU-Typst-Template
https://raw.githubusercontent.com/csimide/SEU-Typst-Template/master/seu-thesis/pages/statement-degree-fn.typ
typst
MIT License
#import "../utils/fonts.typ": 字体, 字号 #let degree-statement-conf( anonymous: false, ) = page( header: none, footer: none, numbering: none, margin: 2.5cm, { show heading.where(level: 1): it => { set align(center) set text(font: 字体.黑体, size: 15pt) it.body.text.clusters().join(h(0.3em)) v(2em) } set text(font: 字体.宋体, size: 10.6pt, lang: "zh") // 字号来自“附件1:学位论文独创性和使用授权声明.pdf” set par(first-line-indent: 2em, leading: 1.5em, justify: true) set block(spacing: 1.5em) set align(horizon) block({ align( center, text( font: 字体.黑体, size: 15pt, tracking: 0.3em, )[东南大学学位论文独创性声明], ) v(1.5em) [ 本人声明所呈交的学位论文是我个人在导师指导下进行的研究工作及取得的研究成果。尽我所知,除了文中特别加以标注和致谢的地方外,论文中不包含其他人已经发表或撰写过的研究成果,也不包含为获得东南大学或其它教育机构的学位或证书而使用过的材料。与我一同工作的同志对本研究所做的任何贡献均已在论文中作了明确的说明并表示了谢意。 ] v(1cm) align( right, grid( columns: (auto, 6em, auto, 6em), column-gutter: 3pt, [研究生签名:], line(start: (0pt, 0.9em), length: 6em, stroke: 0.5pt), [日期:], line(start: (0pt, 0.9em), length: 6em, stroke: 0.5pt), ), ) v(4cm) align( center, text( font: 字体.黑体, size: 15pt, tracking: 0.3em, )[东南大学学位论文使用授权声明], ) v(1.5em) [ 东南大学、中国科学技术信息研究所、国家图书馆、《中国学术期刊(光盘版)》电子杂志社有限公司、万方数据电子出版社、北京万方数据股份有限公司有权保留本人所送交学位论文的复印件和电子文档,可以采用影印、缩印或其他复制手段保存论文。本人电子文档的内容和纸质论文的内容相一致。除在保密期内的保密论文外,允许论文被查阅和借阅,可以公布(包括以电子信息形式刊登)论文的全部内容或中、英文摘要等部分内容。论文的公布(包括以电子信息形式刊登)授权东南大学研究生院办理。 ] v(1cm) align( right, grid( columns: (auto, 6em, auto, 6em, auto, 6em), column-gutter: 3pt, [研究生签名:], line(start: (0pt, 0.9em), length: 6em, stroke: 0.5pt), [导师签名:], line(start: (0pt, 0.9em), length: 6em, stroke: 0.5pt), [日期:], line(start: (0pt, 0.9em), length: 6em, stroke: 0.5pt), ), ) }) }, ) #degree-statement-conf(anonymous: false)
https://github.com/RomainPierre7/ENSEIRB-report-template
https://raw.githubusercontent.com/RomainPierre7/ENSEIRB-report-template/main/template/main.typ
typst
MIT License
#import "../lib.typ": * #show: report()
https://github.com/polarkac/MTG-Stories
https://raw.githubusercontent.com/polarkac/MTG-Stories/master/stories/037%20-%20Ravnica%20Allegiance/011_The%20Gathering%20Storm%3A%20Chapter%2017.typ
typst
#import "@local/mtgstory:0.2.0": conf #show: doc => conf( "The Gathering Storm: Chapter 17", set_name: "Ravnica Allegiance", story_date: datetime(day: 02, month: 10, year: 2019), author: "<NAME>", doc ) There were a lot of bars, taverns, and pubs in the streets around Nivix. Chemisters, workers, and scorchbringers all liked to get drunk as much as the next people, possibly more, given the hazardous nature of their jobs. There were high-class establishments where project leaders could exchange information over a bottle of wine or three, and raucous winesinks where it was a poor night that didn’t end with someone exiting through the window. Viashino pubs echoed to drunken lizard-song until the small hours, accompanied by the mournful melody of their traditional flutes. Even vedalken could occasionally be tempted to a glass or two of something, to better perfect their emotional state. The tavern Ral was headed to was a different sort of place from any of those. It was not the site of anyone’s celebrations, nor was there ever any kind of music. It was mostly underground, a staircase descending beneath a crumbling apartment block to a large, dark space, broken up by heavy support beams and subdivided into a hundred nooks and crannies. It had a dark reputation, but not one that revolved around fights or vice. This was where you went when everything had gone wrong, when your project had collapsed or your rivals had triumphed or the wrong thing had exploded one time too many. The patrons were chemisters with that mad gleam in their eye, engineers with flyaway hair who doodled compulsively on napkins, robed figures bent over mugs of beer muttering about how they were going to show them all. Schemes hatched in the booths and back rooms usually ended in flaming debris raining down on the city, and so, appropriately, the sign outside the tavern proclaimed that it was called The Smoking Wreckage. Ral had spent a lot of time here, in the days before he’d gotten involved with Tomik. He liked the atmosphere. Tonight, however, he was here because a note delivered to his office by a courier-elemental had summoned him. He wore his accumulator and gauntlets under a hooded robe, and surveyed the clientele as he came down the stairs. There were more people in than usual, which made sense. The resonator project, his grand scheme to modify the Guildpact against the will of Azor himself, was nearly completed, and most of the staff at Nivix had the night off. There was no bar at The Smoking Wreckage, and no servers. Drinks were brought by tiny constructs, little platters with articulated legs. Their constant scuttling gave the place a writhing quality, as though it were alive and shuddering. It also meant there was no one to overhear, which was what the patrons demanded. The note had directed him to a table at the back. Ral made his way over cautiously and found a booth shrouded by a heavy black curtain. Pulling it aside a fraction, he gave a sigh of relief, then slipped through it and sat. "Lavinia," he muttered. "You might have said it was you." "And risk my note being intercepted? A good way to get ambushed." Lavinia leaned across the table and twitched the curtain closed. "You’re a hard man to meet these days, Ral. Don’t spend much time alone." "I’ve been busy," Ral growled. "I’m still busy. Saving the city and all that. After the disaster at the guild summit, someone has to." "I know." Lavinia lowered her head, and there was genuine pain in her expression. "I failed." Ral shook his head. "You told us to be careful about Vraska. I let my feelings blind me." "A great many mistakes were made." Lavinia put her hands on the table. "But, thanks to you, it’s not over yet. And so I still have work to do." Lavinia, Ral noticed, was not looking her best. Her hair was snarled and greasy, as though she hadn’t washed for days, and her skin was caked with soot. Her clothes, carefully nondescript, were rumpled and stained, and there were dark circles under her eyes. "How long has it been since you slept?" Ral said. "Does it matter?" Lavinia said. "Bolas is #emph[coming] . We’re out of time." Ral stiffened. "When?" "Tonight. I think." She rubbed her face. "I’ve broken some of his agents’ codes. I’m on the trail of their leader, but I think he’s made me. That’s why I needed to see you." #emph[Tonight.] Ral’s mind whirled. #emph[Close, close.] The resonators were finished, the alignments completed. There were more checks, last-minute adjustments— "We can make it," he said. "I’ll have my people cut some corners, if they have to, but we’ll get it done. I’ll tell Niv-Mizzet we have to power up the machine at once." "Good." Lavinia slumped back in her seat. "That’s good. At least we have a chance." "Come back with me," Ral said. "You were there at the beginning of this whole project. You should be there at the end." She shook her head. "Can’t. I’ve almost got him." "The agent?" Lavinia nodded. "I’ll take him tonight. One less threat. The last thing we need once Bolas turns up is a dagger in the back." "Do you know who it is?" "Not yet. But I will." "I have . . . a suspicion." #emph[Tezzeret.] Ral wasn’t certain he was still on Ravnica, but it seemed logical that he would be coordinating Bolas’s spies. "Be careful. If you’re dealing with who I think you are, he’s very dangerous." "Believe me, I know," Lavinia said. "I’ve been following him long enough that I’m familiar with his methods." "Do you need backup?" "It would only tip him off." She got to her feet. "You do your job, Ral, and let me do mine. I will not fail again." Ral gave a slow nod. "Good luck, then. If we survive, I owe you a drink." "Good luck." Lavinia gave him the ghost of a smile. "If we survive, I’ll take you up on that." #v(0.35em) #line(length: 100%, stroke: rgb(90%, 90%, 90%)) #v(0.35em) Ral strode through the gates of Nivix, power crackling around him. Arcs of lightning briefly connected him to the iron doorframe, worms of crackling white light crawling across the brackets of the torches as he passed. His long coat billowed out behind him, and his hood had fallen back, revealing his wild frizz of hair with its single white streak. "Gullifen! Noz! Fredon!" he bellowed. "Message to all sections! We’re throwing the switch #emph[tonight] . Bring all resonators online as soon as possible. I want status reports across the board." "Tonight, boss?" said Gullifen. She was a goblin and one of the projects primary engineers, responsible for the parts of it constructed within Nivix itself. She hurried along beside Ral, taking two short strides for each of his long ones to keep up. "We’re not ready!" "We’re ready," Ral said. "Or we’ll #emph[get] ready. We don’t have a choice." "But the calibration tests—" "Listen," Ral said, rounding on her. A small horde of goblins, humans, and vedalken who had gathered behind him as he walked abruptly pulled up short. Ral straightened up, feeling the weight of all those pairs of eyes, and cleared his throat. "If we don’t activate the machine tonight, then a dragon so old he’s practically a god is going to come to Ravnica and make damn sure we don’t get a chance to turn it on tomorrow. You understand? So if there’s no time for calibration testing, tell your people to make certain they get it right the #emph[first] time." Gullifen swallowed hard and saluted. "Yes, boss!" The crowd blew apart like a dandelion puff, workers and chemisters running in every direction. Some were headed for the bowels of Nivix, where the vast mizzium coils that would power the central node were housed. Others hurried off to subsidiary systems, or went to send messages to the other stations. They’d planned this moment, practiced for it, and Ral felt a moment of pride that everyone knew their place. "Upstairs," Ral said to Gullifen. "We’ll start testing the other nodes when they come online. Do as much as we can." "Yes, boss," the goblin said. Ral took the steps three at a time, leaving Gullifen to follow as best she could, and ascended to the tenth floor. Here, a substantial section of the labs and offices that filled Nivix had been torn out, opening up a vast space for the machine’s control chamber. Eight stations, each a metal workshop covered in glowing crystals, wavering dials, and glowing mizzium coils, were arranged in a semi-circle around a central dais and panel. Ral mounted the steps and looked out across the room, where chemisters were scurrying to and fro, taking up their positions. "Power coming online!" a tech shouted. "Operating at ninety-seven percent." "Node number 1 ready to activate!" another said. That was the center of the network, here in Nivix itself, the only site Ral could implicitly trust. He looked down at his own control panel, where there were eight small metal switches, and above them a single large double-pronged knife switch, painted red and bolted in place. He reached for the first of the smaller controls and flicked it up. "Bringing up number 1," he said. "Give me status." "Node number 1 coming online!" an operator sang out. "Aligning with the grid." "Looking good," another added. "No interference so far." High atop Nivix, Ral knew, the resonator would be unfolding itself, mizzium coils spinning in their chambers, crystal projectors shifting to line up with the complicated strands of the Guildpact spell. It looked a bit like a spider doing some kind of elaborate stretching exercise with multiple limbs. In the basement, the generators would be roaring, power surging through arm-thick cables strung along the outside of the building. Gullifen stumbled into the room, panting, and headed to her own station. A moment later, she called, "Number 2, number 5, number 7 all reporting powered and ready!" "Get on the others," Ral shouted back. "Bringing up number 2." He flicked another switch, and a second section of the control room came to life, dials twisting wildly and crystals throbbing. For a moment, Ral held his breath. At the front of the room, in front of the banks of controls, was a table with a map of the Tenth District. The nodes were marked on it by small colored lights, all dim except for the bright white glow that represented Nivix. As Ral watched, a second light grew and brightened, and then an arcing bridge snapped into being between them, energy crackling and strobing. "Number 2 online!" a tech shouted. "Aligned and receiving. Interference less than zero point three!" "Coolant pressure rising!" one of the vedalken said, uncharacteristically alarmed. "The outflow pumps are backed up." "I knew that was going to be trouble," Gullifen said. "If we close down, we can get someone to—" "Vent it," Ral snapped. "Plenty of water in the tanks." "Venting!" A moment later, there was an unearthly howl, audible even ten stories up, as stream boiled out of a dozen spots in the streets around the building. The plumes rose higher and higher, surrounding Nivix in a white cloud, lit from within by spitting, sparking energy in fantastic colors. Node number 2 was in Azorius territory, near New Prahv. A single line of brilliant light connected it to the resonator on top of the Izzet tower. Deep in his mind, Ral felt the Guildpact shifting, titanic magical energies realigning in response to the pressure of the machine. Every mage in Ravnica would feel it, though only a handful would know what it portended. #emph[Tonight we change the world.] "Bringing up number 5 and number 7," Ral said, flicking switches. "Check power consumption and get me status on the rest." "Power’s high, but holding," one of the goblins said. "As long as the couplings hold, the generators will make it." "Number 3 and number 4 report ready!" Gullifen said. "Checking number 6 and number 8." Ral frowned. Number 8 was the Undercity node, in Golgari territory. If something was going to wrong, it would be there, where they’d had the least time to prepare. #emph[If Vraska tries to attack now . . .] #emph[Ral.] Niv-Mizzet’s voice echoed in Ral’s mind, though the dragon was nowhere to be seen. #emph[Guildmaster] , Ral thought back. #emph[Apologies for the late notice. I received word that Bolas plans his incursion tonight.] #emph[You have acted correctly] , the Firemind said. #emph[I am in position on the Aerie. When the machine amends the Guildpact, I will be ready.] #emph[We’re nearly there] , Ral promised. Something went #emph[bang] . Things exploded all the time at Nivix, but this was a big one, even by Izzet standards. The room shook. Ral looked at the dials and saw half of them dropping and the other half rising toward the red. "Conduit blew!" a tech shouted. "Power’s falling. We can’t keep the node up!" "Reroute power," Ral snapped. "The rest of the conduits won’t take it! If we try, we’ll lose the whole array." "Blow every last one of them before we lose that node," Ral snarled. "We only get one chance at this, understand?" "Wait!" Gullifen said. "I can handle this. The break’s down on the second floor, we can send power through the laboratory systems." "Do it," Ral said. "And hurry. I’m bringing up the rest of the nodes." "All stations report ready!" Gullifen said, and dashed out of the room, a couple of other goblins at her heels. Ral ran a hand across the row of switches, flipping them all on one after another. Down below, every crystal was glowing. The techs shouted to one another, hardly looking back at him now. "Number 8 online!" "Number 6 coming up!" "Watch that resonance—" "Interference rising to zero point nine!" On the map, glowing lines reached out from Nivix, the spider on the roof spreading burning legs wide across the city. Ral watched them grow brighter with half his attention, while the rest was on the dials indicating power in the central node, which was still dropping. "Get ready to reroute," he told the tech. "If Gullifen doesn’t make it—" "Blown conduit coming back up!" another tech said. "She’s bridged it in above the breach." "Make sure it holds this time," Ral said. "Distributing." There was a long moment—not silence, since the room was full of buzzes, clatters, crackles, and the hiss of steam—but a collective intake of breath. On the map, seven strobing lines connected Nivix to the other resonators. In Ral’s mind, the Guildpact groaned, the lines of forces that comprised it shoved to their breaking points by the titanic energies unleashed. "That’s it," someone said. "Network fully activated. All links up and holding." "Interference falling to point six." "All stations report holding steady!" #emph[Guildmaster] , Ral said in his mind. #emph[We are ready.] #emph[As am I] , the Firemind thought back. #emph[Do it.] Ral reached for the big switch. #v(0.35em) #line(length: 100%, stroke: rgb(90%, 90%, 90%)) #v(0.35em) Lavinia pounded down the narrow alley, her worn boots splashing through noisome puzzles. Overhead, lights shifted and glowed in the sky. Nivix, looming against the horizon, was surrounded by a boiling cloud of steam. Arcs of energy, like titanic lightning bolts stretching over miles, flickered between it and the sites in the rest of the Tenth District. Thunder boomed and rolled continuously, under a blanket of thick, dark cloud. The ordinary citizens of Ravnica, the unguilded and the rank-and-file of every guild, were in for a terrifying night, no matter what happened. There had been no way to warn them about what was going to happen, not without tipping their hand to Bolas’s agents. #emph[But that ends tonight.] Lavinia’s hand brushed the hilt of her sword. #emph[No more sneaking around.] Ahead of her, the robed figure turned left, just as she’d expected. He was heading for a certain disused stable, a stone building he used for his meetings. Lavinia had finally broken enough of his codes to figure out for certain where he was going to be, and the stable was now packed with Azorius arresters. More troops were arrayed in the surrounding streets, to keep Bolas’s agent from escaping. #emph[We need to know what he knows.] She glanced overhead and caught one of Dovin Baan’s thopters looking down at her, outlined against the shifting lightshow above. She made the turn, carefully inching around the corner of a brick building. Bolas’s agent was striding confidently ahead, not bothering to check if he was being followed. When he reached the door at the end of the alley, he reached out for it, and the twisting light gleamed on bulbous metal. Lavinia waited until he’d gone inside, then followed at a run. She yanked the door open herself, shielding her eyes from the expected glow of dozens of lanterns. Instead the stable was dark. It was a long, empty space, stalls long ago broken down for firewood, the only sign of its old purpose a lingering smell of dung. Her quarry stood alone in the center of it, his back to her, arms folded. Of the backup the guild had promised her, there was no sign at all. #emph[Something is very wrong.] But it was too late to back off now. She loosened her sword in its scabbard. #emph[The thopters were there, at least. They know what’s going on.] "You’re quite good at this," Bolas’s agent said. He turned around, pushing back his hood. He was a tall, weathered man with dark dreadlocks. "Following people, I mean." "Stay where you are." "Am I under arrest?" He gave a humorless smile. "Lavinia, #emph[formerly] of the Azorius. I don’t believe you have the authority to arrest anyone anymore." "The authorities will be along in a moment," Lavinia said grimly. "In the meantime, I have some questions for you." "Very bold." He raised his right hand. His fingers were steel talons, stretching from a twisted metal claw. "I suppose you’ve earned some answers." "Who are you?" "My name is Tezzeret. And, as you have guessed, I work for <NAME>." "Who are your agents in the guilds?" Lavinia took a step forward. "How much do you know about what’s happening tonight? How did you suborn Glademaster Garo of Selesnya?" "So #emph[many] questions." Tezzeret’s smile faded. "Perhaps a demonstration is in order." He waved his clawed hand, and in the shadowy corners of the stables, lights blinked on. Things began to stir, spindly, multi-armed constructs with spidery legs and long, bladed arms. Four of them straightened up, each taller than a man, and advanced to box Lavinia in. Beside Tezzeret, something flickered, a vague shape in the air like nearly solid mist. Lavinia couldn’t make out much, but there was the suggestion of a face, and the curving arc of horns. "Glademaster Garo, as you might imagine, was strong-willed," Tezzeret said. "When it comes to someone of weak mind, or in dire circumstances, my . . . associate can take direct action. In other cases, I provide a little assistance." He twitched the fingers of his metal hand, and the constructs closed in. Lavinia tensed, drew her sword, and spun, slamming against one of the pair behind her. #emph[If I can get back to the door, make him chase me, then the thopters will pick us up.] Where her backup had gone, she had no idea, but they had to be somewhere nearby. The construct blocked her strike with two scythe-like arms, its spindly body sliding backward along the stable floor with the force of her blow. Lavinia spun away from it, wickedly fast, and aimed a cut at another of the machines, hitting one of its knee joints. Metal buckled, and the construct stumbled drunkenly. It remained in her way, though, its razor-arms swinging wildly, and she had to back off. The two behind her took that opportunity to pounce. Pain lanced through her as a thin-bladed scythe struck her sword arm, fixing it in place like an insect pinned in a collector’s box. Another blade pinioned her leg, and she dropped to one knee, gritting her teeth to keep from screaming. The construct twisted its blade, and the pain ratcheted upward. Her sword clattered to the floor. "You . . . won’t get away," Lavinia managed, staring up at Tezzeret. "The Azorius will find you." "Oh, my dear," he said. "How little you understand." He glanced sideways, at the hovering apparition. "I could kill you, but it seems like a waste. I’ve always believed in being efficient. So hold still." He reached into a pouch and produced a metal half-collar, angular and ugly with spiky protrusions. Lavinia could feel power running off it in waves, vicious and bloody, and she tried to scramble away, only to be pinned in place by the constructs with a fresh wave of pain. Tezzeret grabbed her chin with his metal hand, grip inhumanly strong, and gently pressed the thing around her throat. "For the strong-willed, as I said, the process requires my assistance." Tezzeret stepped back, and the shimmering, intangible shape moved in. "And, I’m afraid, a great deal of pain." Lavinia screamed. #v(0.35em) #line(length: 100%, stroke: rgb(90%, 90%, 90%)) #v(0.35em)  #linebreak The bolt clicked back with a grim finality. Ral put his hand on the switch and paused a moment, feeling the power of the great machine humming all around him. "Activating primary resonance," he said. Electricity crackled across him, crawling along the switch as he pulled it down. It closed with a satisfying #emph[clunk] , and all at once the omnipresent whine of machinery rose to a new pitch. With his magical senses, Ral felt the Guildpact straining, Azor’s ancient strictures pushing back against this intrusion, but the energy the machine harnessed was titanic, and the magic began to give. Slowly at first, but bit by bit— Down among the technicians, something exploded with an almighty #emph[bang] . Ral heard bits of metal and crystal #emph[ping] off the walls, and felt something tug at his cheek. Another blast followed, and another. The lights in the chamber went out, and screams rose in darkness illuminated only by the glow of spreading fires and instrument displays. "#emph[Status!] " Ral shouted, over the chorus of dismay. "What in the hells is going on?" A babble of voices answered. "Lost primary power—surge blew the board— "No reports coming in—" "Bleeding won’t stop, someone—" #emph[Ral.] Niv-Mizzet’s voice. #emph[It has gone wrong.] #emph[] #linebreak #emph[I know] , Ral thought back. #emph[I’ll fix it.] #emph[] #linebreak "Gullifen!" he snapped. "Get me something on the other sites. Send runners if you have to. Tox, go down to the generators, check the output. We’ll bypass the main board—" "I need #emph[light] !" The shout was hoarse, desperate. Ral raised his hands, and electricity arced from his fingers to the lamps hanging over head, turning them into writhing, crackling globes of lightning. By this shifting radiance, he could see that one end of the eight-part instrument panel was a shambles. Something—several somethings—had exploded in the second section, overturning tables and shattering gear in the adjacent nodes. #emph[Damn, damn, damn.] Just getting cleaned up would take time. #emph[If it damaged the external nodes . . .] "Gullifen!" Ral shouted. "She’s here, sir," a younger goblin said. Something in his tone made Ral fall silent. Gullifen lay on the floor of her control enclosure, at the center of a spreading pool of blood. Two other goblins sat beside her, one pressing a cloth to her throat, where a shard of flying metal had laid her throat open. The task was clearly hopeless—the cloth was already soaked through with crimson, and more blood pumped through it with every heartbeat. #emph[So much blood] , Ral thought, unable to tear his eyes away. #emph[Who would have thought such a small body would hold so much?] #emph[] #linebreak Gullifen blinked, gaped like a landed fish, and died with a shudder. The two goblins beside her sat back, and Ral became aware the rest of the room was watching. Several of the other techs had injuries, too. "Someone tell me what happened," Ral grated, tearing his eyes from the dead goblin. "Now." "We got a surge through the connection to node number 2," a vedalken said. "I’m certain of it. The link spiked, and that blew the accumulator here." "It came from their side?" Ral frowned. "That’s impossible. The resonators are all controlled from here. Even if the damn thing blew up, the link should have cut out, not gone wild. Check it again—" #emph[Not impossible] , Niv’s mental voice rumbled. From the startled expressions on the faces of the techs, Ral guessed that everyone present heard it too. #emph[This is no accidental failure. The second node is in Azorius territory.] The dragon’s tone darkened. #emph[<NAME> has betrayed us.]
https://github.com/donRumata03/aim-report
https://raw.githubusercontent.com/donRumata03/aim-report/master/pres/proposal.typ
typst
#import "../lib/presentation-template.typ": * #blockquote[Вырезанная техническая часть из Proposal к CV в лабу] = Co-evolution https://github.com/aimclub/GOLEM/issues/47 == Высокоуровневое описание Предлагается реализовать кооперативную ко-эволюцию: решение будет собираться по частям из нескольких популяций подграфов. == Разделение на подзадачи Вероятно, будет несколько фиксированных слотов — каждый для своей популяции и по этой схеме будет собираться итоговый граф. О том, какая именно структура, знает только пользователь GOLEM, поэтому метод сборки передаётся в качестве параметра. Теоретически, структура соединения слотов тоже может эволюционировать (как отдельная популяция), но это в большинестве случаев дискредитирует идею разделения ответственности → специализации популяций. Кроме того, при коэволюции разбиение на подзадачи зачастую осуществляют через анализ статистических взаимосвязей переменных, но в случае графа это не представляется возможным — его структура не фиксирована. == Применение для мультимодальных данных в FEDOT Одно из полезных применений — работа с мультимодяльными данными в FEDOT: будет происходить эволюция `Pipiline`-ов, которые объединяются в общий `Pipiline`, оборачиваясь каждая в `AtomizedModel`. Структура общего пайплайна, вероятно, должна быть такой: несколько популяций ответственны за перевод входных данных конкретного типа в промежуточное представление, а после этого ещё одна популяция аггрегирует их, получая ответ. При этом на соединениях между разными популяциями выделяется «типизация»: нужно, чтобы данные, выдаваемые подграфами одной популяции соответствовали входным другой популяции, соединяющейся с ней в пайплайне. И эти внешние соединения (свои для каждой популяции) получают особенную поддержку в генетических операторах (как входы и выходы в pipeline — только модели с правильным типом входов/выходов могут вставать на это место). == Мотивация // Описать сепарабельность Такое разделение ответственности (разные популяции для разных типов данных + аггрегатор) — максимально естественно и гарантирует высокую степерь _независимости задач, выполнямых разными популяцями_, а это в точности условие, требующееся для применимости кооперативной коэволюции, поэтому можно ожидать экспоненциального от количества популяций ускорения. На предметом уровне это будет значить, что особи станут более «прозрачными» и гибкими (их структура будет более точно разложена перед оптимизатором). Соответственно, будет меньше появляться «комплексов» (термин позаимствован у Фрейда…): ситуации, при которой неудачная часть графа остаётся в популяции только потому, что когда-то зацепилась за удачную. Таким образом, зона ответственности будет менее расплывчатой. == Генетические операторы Для оценки особи нужно протестировать, «как она себя ведёт в комбинации с особями из других популяций», пробуя разные комбинации. Проводится несколько испытаний, каждое из которых — оценка фитнесса всего графа, собранного из каких-то обоей разных популяций. Выбирать испытания нужно, чтобы: - Каждая особь поучаствовала в достаточном количестве испытаний - Отдавалось предпочтение более точной оценки fitness-а у лучших особей При этом нужно быть более чувствительным к лучшим значениям, чем усреднение. В пределе — максимум. Классический подход к выбору collaborator-ов — k-fold. Однако практика показывает, что максимум для фиксированного индивида почти всегда достигается на одном из лучших членов каждой из остальных популяций, поэтому, вероятно, стоит использовать #link("https://doi.org/10.1145/1143997.1144060")[подход iCCEA]: поддерживать архив этих лучших представителей (похожую задачу решает #strike[GloryHall] #link("https://github.com/aimclub/GOLEM/blob/a46412cfdd01b0140f5c45fe2addbdec01254926/golem/core/optimisers/archive/individuals_containers.py#L10")[HallOfFame], только ещё нужно учитывать расстояние между особями). Когда fitness особей оценён, формирование новой популяции происходит одним из стандатных методов. Для оценки хода оптимизации используется external fitness — в случае кооперативной коэволюции это fitness лучшей комбинации из текущих популяций. // - Строить статистики подграфов, чтобы понимать, какие лучше, какие хуже для мутаций = Diversity Maintenance (Niching) — подход, в котором отдельно наказывается за отсутствие разнообрзия (здесь описаны основные методы: https://www.intechopen.com/chapters/8533). == Измерение разнообразия В случае графов измерять разнообразие можно с помощью аппроксимации Graph edit distance — сама задача NP полная, но есть #link("https://www.researchgate.net/publication/324275676_Error-tolerant_graph_matching_in_linear_computational_cost_using_an_initial_small_partial_matching")[аппроксимации] за ≈линейное время (В целом, обычно бо’льшая часть времени — вычисление фитнесса, так что можем позволить) Кроме структуры, вероятно, нужно использовать пользовательскую информацию для нахождения расстояния. Можно использовать информацию о хронологии эволюции: как напрямую учитывать родословеную при селекции, так и помогать GED находить оптимальное решение. == Как влиять на ход эволюции Предлагается использовать один из классических подходов, описанных, например, в Essentials of metaheuristics. Глобально, есть два пути: - Модификация fitness - Учитывать на уровне селекции // - incest prevention == Область применения Как минимум — параметр разнообразия полезно мониторить, чтобы не действовать вслепую. Кроме того, имея метрику и рычажок для её увеличения/уменьшения (в некотором смысле — exploration vs. exploitation), логично вручить их адаптирующему агенту. == Что уже реализовано // На данный момент там не то, что нет оценки diversity, а вообще бывают одинаковые часто: На данный момент ведётся работа над минимизацией дубликатов: https://github.com/aimclub/GOLEM/issues/89, что можно назвать частным случаем поддержки разнообразия, а для оценки разнообразия используются метрики, не использующие графовую структур до конца (сравниваются скалярные параметры графов).
https://github.com/Kasci/LiturgicalBooks
https://raw.githubusercontent.com/Kasci/LiturgicalBooks/master/SK/zalmy/Z062.typ
typst
Bože, ty si môj Boh, \* už od úsvitu sa viniem k tebe. Za tebou prahne moja duša, \* za tebou túži moje telo; ako vyschnutá, pustá zem bez vody, \* tak ťa túžim uzrieť vo svätyni a vidieť tvoju moc a slávu. Veď tvoja milosť je lepšia než život; \* moje pery budú ťa oslavovať. Celý život ťa chcem velebiť \* a v tvojom mene dvíhať svoje ruky k modlitbe. Sťa na bohatej hostine sa nasýti moja duša \* a moje ústa ťa budú chváliť jasavými perami. Na svojom lôžku myslím na teba, \* o tebe rozjímam hneď za rána. Lebo ty si mi pomáhal \* a pod ochranou tvojich krídel budem plesať. Moja duša sa vinie k tebe, \* ujímaš sa ma svojou pravicou. Tí však, čo chcú môj život zahubiť, \* zostúpia do hlbín zeme; vydaní budú meču napospas, \* stanú sa korisťou šakalov. Kráľ sa však bude tešiť v Bohu, \* chváliť sa budú všetci, ktorí prisahajú na neho, lebo budú umlčané ústa klamárov. O tebe rozjímam hneď za rána. Lebo ty si mi pomáhal \* a pod ochranou tvojich krídel budem plesať.
https://github.com/ClazyChen/Table-Tennis-Rankings
https://raw.githubusercontent.com/ClazyChen/Table-Tennis-Rankings/main/history/2011/MS-03.typ
typst
#set text(font: ("Courier New", "NSimSun")) #figure( caption: "Men's Singles (1 - 32)", table( columns: 4, [Ranking], [Player], [Country/Region], [Rating], [1], [<NAME>], [CHN], [3222], [2], [WANG Hao], [CHN], [3194], [3], [XU Xin], [CHN], [3172], [4], [<NAME>], [GER], [3169], [5], [ZHANG Jike], [CHN], [3145], [6], [<NAME>], [CHN], [3074], [7], [WANG Liqin], [CHN], [3030], [8], [MIZUTANI Jun], [JPN], [3003], [9], [CHEN Qi], [CHN], [2988], [10], [HAO Shuai], [CHN], [2940], [11], [<NAME>], [KOR], [2923], [12], [SAMSONOV Vladimir], [BLR], [2882], [13], [<NAME>], [KOR], [2878], [14], [<NAME>], [JPN], [2808], [15], [KREANGA Kalinikos], [GRE], [2798], [16], [<NAME>], [DEN], [2791], [17], [OVTCHAROV Dimitrij], [GER], [2776], [18], [CHUANG Chih-Yuan], [TPE], [2766], [19], [<NAME>], [GER], [2754], [20], [OH Sangeun], [KOR], [2749], [21], [<NAME>], [GER], [2749], [22], [<NAME>], [ROU], [2737], [23], [<NAME>], [POR], [2718], [24], [<NAME>], [KOR], [2712], [25], [<NAME>], [AUT], [2709], [26], [<NAME>], [SGP], [2705], [27], [<NAME>], [FRA], [2699], [28], [<NAME>], [JPN], [2675], [29], [<NAME>], [GER], [2673], [30], [<NAME>], [HKG], [2663], [31], [<NAME>], [CZE], [2663], [32], [<NAME>], [JPN], [2653], ) )#pagebreak() #set text(font: ("Courier New", "NSimSun")) #figure( caption: "Men's Singles (33 - 64)", table( columns: 4, [Ranking], [Player], [Country/Region], [Rating], [33], [<NAME>], [RUS], [2648], [34], [<NAME>], [SLO], [2647], [35], [PROKOPCOV Dmitrij], [CZE], [2645], [36], [<NAME>], [BLR], [2642], [37], [<NAME>], [BEL], [2641], [38], [<NAME>], [JPN], [2630], [39], [<NAME>], [AUT], [2623], [40], [<NAME>], [AUT], [2618], [41], [<NAME>], [CHN], [2610], [42], [TANG Peng], [HKG], [2610], [43], [GIONIS Panagiotis], [GRE], [2603], [44], [<NAME>], [SWE], [2602], [45], [YANG Zi], [SGP], [2601], [46], [<NAME>], [HKG], [2598], [47], [FREITAS Marcos], [POR], [2595], [48], [KOSOWSKI Jakub], [POL], [2593], [49], [KIM Junghoon], [KOR], [2589], [50], [<NAME>], [AUT], [2576], [51], [CHO Eonrae], [KOR], [2574], [52], [<NAME>], [IND], [2574], [53], [<NAME>], [KOR], [2571], [54], [JEOUNG Youngsik], [KOR], [2560], [55], [SMIRNOV Alexey], [RUS], [2559], [56], [JIANG Tianyi], [HKG], [2557], [57], [<NAME>], [CZE], [2552], [58], [MONTEIRO Joao], [POR], [2550], [59], [UEDA Jin], [JPN], [2550], [60], [DIDUKH Oleksandr], [UKR], [2549], [61], [<NAME>], [CRO], [2547], [62], [LIN Ju], [DOM], [2547], [63], [GERELL Par], [SWE], [2536], [64], [YOON Jaeyoung], [KOR], [2535], ) )#pagebreak() #set text(font: ("Courier New", "NSimSun")) #figure( caption: "Men's Singles (65 - 96)", table( columns: 4, [Ranking], [Player], [Country/Region], [Rating], [65], [SVENSSON Robert], [SWE], [2533], [66], [<NAME>], [GER], [2532], [67], [LEGOUT Christophe], [FRA], [2531], [68], [<NAME>], [QAT], [2531], [69], [<NAME>], [FRA], [2526], [70], [<NAME>], [PRK], [2524], [71], [SKACHKOV Kirill], [RUS], [2519], [72], [<NAME>], [JPN], [2518], [73], [<NAME>], [KOR], [2517], [74], [ZHMUDENKO Yaroslav], [UKR], [2510], [75], [<NAME>], [ESP], [2499], [76], [GORAK Daniel], [POL], [2492], [77], [RUBTSOV Igor], [RUS], [2491], [78], [<NAME>], [TUR], [2489], [79], [KIM Minseok], [KOR], [2486], [80], [HE Zhiwen], [ESP], [2484], [81], [<NAME>], [KOR], [2480], [82], [BLASZCZYK Lucjan], [POL], [2478], [83], [LIVENTSOV Alexey], [RUS], [2476], [84], [<NAME>], [CRO], [2470], [85], [<NAME>], [CZE], [2470], [86], [<NAME>], [JPN], [2469], [87], [<NAME>], [ENG], [2468], [88], [<NAME>], [FRA], [2463], [89], [<NAME>], [SRB], [2451], [90], [<NAME>], [HKG], [2450], [91], [<NAME>], [HUN], [2448], [92], [<NAME>], [FRA], [2445], [93], [<NAME>], [CHN], [2443], [94], [<NAME>], [DEN], [2443], [95], [<NAME>], [ENG], [2442], [96], [<NAME>], [ARG], [2439], ) )#pagebreak() #set text(font: ("Courier New", "NSimSun")) #figure( caption: "Men's Singles (97 - 128)", table( columns: 4, [Ranking], [Player], [Country/Region], [Rating], [97], [KASAHARA Hiromitsu], [JPN], [2433], [98], [SHIBAEV Alexander], [RUS], [2430], [99], [KIM <NAME>], [PRK], [2415], [100], [KEINATH Thomas], [SVK], [2413], [101], [<NAME>], [KOR], [2412], [102], [BURGIS Matiss], [LAT], [2410], [103], [CANTERO Jesus], [ESP], [2407], [104], [<NAME>], [JPN], [2404], [105], [<NAME>], [POL], [2400], [106], [<NAME>], [CZE], [2399], [107], [<NAME>], [KOR], [2394], [108], [<NAME>], [AUT], [2390], [109], [<NAME>], [TUR], [2388], [110], [<NAME>], [EGY], [2386], [111], [<NAME>], [CRO], [2385], [112], [<NAME>], [POL], [2381], [113], [<NAME>], [CHN], [2372], [114], [<NAME>], [TPE], [2370], [115], [<NAME>], [CZE], [2369], [116], [<NAME>], [SRB], [2363], [117], [<NAME>], [TPE], [2361], [118], [<NAME>], [RUS], [2361], [119], [<NAME>], [AUS], [2358], [120], [BAGGALEY Andrew], [ENG], [2356], [121], [LASHIN El-Sayed], [EGY], [2353], [122], [TAKAKIWA Taku], [JPN], [2348], [123], [<NAME>], [SVK], [2345], [124], [<NAME>], [PRK], [2342], [125], [<NAME>], [ESP], [2340], [126], [<NAME>], [SWE], [2336], [127], [<NAME>], [CHN], [2336], [128], [<NAME>], [SWE], [2335], ) )
https://github.com/WinstonMDP/math
https://raw.githubusercontent.com/WinstonMDP/math/main/exers/h.typ
typst
#import "../cfg.typ": * #show: cfg $ "Find" lim_(x -> 0) (log_a (1 + x))/x $ $(log_a (1 + x))/x = (ln (1 + x))/(x ln a) ->_(x -> 0) 1/(ln a)$
https://github.com/polarkac/MTG-Stories
https://raw.githubusercontent.com/polarkac/MTG-Stories/master/stories/021%20-%20Battle%20for%20Zendikar/003_The%20Believers'%20Pilgrimage.typ
typst
#import "@local/mtgstory:0.2.0": conf #show: doc => conf( "The Believers' Pilgrimage", set_name: "Battle for Zendikar", story_date: datetime(day: 02, month: 09, year: 2015), author: "<NAME>", doc ) #emph[Gideon Jura brought Jace Beleren to Zendikar in hopes that the mind mage could crack what the merfolk scholars of Sea Gate called the "puzzle of leylines," the mystery of the network of stone hedrons that float in the skies of Zendikar. The hedrons are tied intimately to the Eldrazi, serving as lures, bonds, and—the scholars hope—weapons.] #emph[But with Sea Gate fallen and the scholars' records lost, there may be only one place on Zendikar where Jace can get what he needs . . . and only one guide who's willing to help him get there.] #v(0.35em) #line(length: 100%, stroke: rgb(90%, 90%, 90%)) #v(0.35em) Jace pressed his forehead against a hedron, running his hand over its runes. The structure jutted out from the grass at an angle, mostly submerged in the earth, a slouching iceberg of stone. Strewn across the rocky fields from here to the encampment, and to Sea Gate beyond that, were the bodies of slain Eldrazi, lying like jellyfish washed up on a beach. He sensed someone approaching behind him, from the direction of the encampment. "<NAME>, is it?" He turned to her. "And you're Jace," she said. She was a tall merfolk, outfitted for the wilderness. She moved with the self-assured bearing of someone who had traveled Zendikar for years, but with the taut, careful look of someone who had witnessed devastation very recently. "I'm here to share what I know." "Good." Jace poked at a dead Eldrazi creature with his foot. Its tissue deformed in colors of magenta and teal. He looked up at Jori En. "People used to worship them as gods, didn't they?" "Some still do. Can't much blame them." "We need to stop the problem at its root." Jori nodded. "That's what the researchers hoped to do, at Sea Gate. Extinguish them." "With the hedron network." "Yes." "And you've had success using the hedrons?" "I only saw some of their research. But I'll tell you everything I can remember." Jace focused his glance on a space just between Jori's eyes. "I have a better idea, if you're amenable." #v(0.35em) #line(length: 100%, stroke: rgb(90%, 90%, 90%)) #v(0.35em) Jace's consciousness toured Jori's mind, swimming through imagery of goblins strapping small hedrons to sticks, kor warriors painting their faces to mimic hedron runes, and merfolk researchers at Sea Gate plying their magic on hedrons. He focused in on one memory in particular—a team of Zendikari, led by a human woman, using the magic of the hedrons to guide the Eldrazi creatures' movements. The puzzle of leylines. The woman, Kendrin, had been close to understanding something crucial about how the hedron's magic could be used—and turned into a weapon against the Eldrazi. Unfortunately, Jace also saw the memory of Jori putting her hand on Kendrin's forehead as the dead woman's body crumbled into brittle ribs of gray dust. She had died to the Eldrazi slaughter before she could pass on enough of what she knew. #figure(image("003_The Believers' Pilgrimage/01.jpg", width: 100%), caption: [Art by <NAME>], supplement: none, numbering: none) Jace opened his eyes and sucked in a breath, emerging from Jori En's mind as if he were breaching the surface of an ocean. Jori was squatting above him, on top of the hedron, looking down at him. "That was fascinating," she said, smirking with a twitch of her finned jawline. "I could almost feel the second presence in my mind." "Sometimes I can sense the person perceiving my perception of them. It's like catching my own reflection in a mirror. Sort of." "So do you know all my dark secrets now?" "I know Kendrin was close to something." But Jace also knew he couldn't yet solve the puzzle he was brought here to solve. He needed more—and he knew where he needed to go. Before he could explain, footsteps crunched toward them. "Hello, Gideon," Jace said. Jace and Jori turned to see Gideon approach, sunlight pooling on the warrior's armor like liquid light. "Tell me you have a breakthrough," Gideon said gruffly. "We're close," said Jace. "We have to go to the Eye." Jori's facial fins spread in surprise. "The Eye of Ugin? You want to go all the way to Akoum?" "It's the lynchpin to the hedron network. That's where we'll find the answer." "No," said Gideon. "Absolutely not. We just established this encampment. We have injured. We can't go separating the group." "We already have," said Jace. "Nissa left in the night." Gideon was aghast. "What? Why?" "I didn't talk to her. Only got surface thoughts as she left. I gathered she had a mission that was important to her." "More important than solving the nature of the hedrons?" Jori snapped. "We have to focus on life and death here." "I tend to agree," said Jace. "Come with us, Gideon." "I #emph[am] focusing on life and death," said Gideon stonily. "This place is life and death, every minute. I can't—we can't afford another refugee death. I'm not leaving to protect you on a cross-country mission." Gideon nodded at the merfolk. "You have Jori's account. Can't you solve it here, together?" #figure(image("003_The Believers' Pilgrimage/02.jpg", width: 100%), caption: [Art by <NAME>], supplement: none, numbering: none) "I only have what they accomplished, not why it worked," Jace said. "Look. You're not seeing the bigger picture here. This was what I came here to do. Let me do it." "If you leave the encampment, these people will die, and so will you." Jace spread his hands wide, embracing the whole horizon. "If I don't get to the Eye, #emph[everyone] on this plane will die." #v(0.35em) #line(length: 100%, stroke: rgb(90%, 90%, 90%)) #v(0.35em) "Have you ever—changed things?" Jori asked, holding reins in her hands. "While you were in there?" Jace sat next to her on a small coach pulled by a single hurda. It was the best the encampment could spare. They rode out from the encampment—without Gideon. Jace paused. "Sometimes that becomes necessary." "You could have removed my memory of her, for example. Of Kendrin. Of her death." Jace thought of Jori's hand touching the dead woman's forehead. It felt like his own hand, in his memory. He could feel Kendrin's skin, how it was too cool and too thin, and dry to the touch. "You didn't want that." "But you could have." "Yes." "How do I know you didn't alter anything else?" Jori asked. Then she added, "There is nothing you can say that will prove it to you either way, is there?" "I'm told I am not an easy person to be friends with." "Did you think about—you know—changing his mind?" Jori asked. "You could have #emph[made] him a believer in the mission, couldn't you?" He had thought about it, yes. One quick spell, and he could have "convinced" Gideon to come. "I consider every possibility," said Jace. "Not sure I'd have the same restraint you do," she said. "Seems like there'd always be possibilities #emph[he] would never consider." #figure(image("003_The Believers' Pilgrimage/03.jpg", width: 100%), caption: [Mind Sculpt | Art by <NAME>], supplement: none, numbering: none) "He's hard to budge, in more ways than one. A difference between us, I suppose." "And yet you chose not to meddle with his mind. Maybe you're more alike than you think." Jace looked at the horizon beyond the packbeast that pulled the coach. "If we were alike, he'd see the importance of the Eye. He'd have devoted all his resources into making sure we understand the hedrons. He'd be here, with us." Jori flicked the reins as the land trailed by. "You ever wonder what you'd be able to accomplish if there were just more of yourself around?" Jace shook off thoughts of Gideon, and let himself chuckle. He cast a quick illusion spell, and three other Jaces appeared. The duplicate Jaces perched at odd angles on the hurda's back, all identical in their blue cloaks. "We wonder that frequently," they said in unison, and disappeared. Jori gave him a skeptical smile, and shook her head. #v(0.35em) #line(length: 100%, stroke: rgb(90%, 90%, 90%)) #v(0.35em) It was days until they encountered any Eldrazi. They rambled past hedron-studded pastures, with knobby stone islands casting shadows down on them from the air above. They spoke little, and Jace struggled to piece together what he knew. He tried to find a reason they should turn back, a reason why their knowledge of the hedrons was somehow sufficient. He was probably even familiar enough with Sea Gate that he could planeswalk back there safely, via some other plane. But that would strand Jori En out here alone. When the swarm of Eldrazi spawn crested the hill and scrambled toward the two travelers, the sun was behind them, and light glinted off all the angular elbows and framed the blank cranial faces. #figure(image("003_The Believers' Pilgrimage/04.jpg", width: 100%), caption: [Art by <NAME>], supplement: none, numbering: none) "Drive!" said Jace. Jori saw them, but cover was almost nonexistent. "Where?" "Anywhere!" Jori yanked diagonally on the reins—too hard. The hurda snorted in revolt and threw its weight in the opposite direction, snapping the reins out of Jori's hands. Jace and Jori clung on as the coach jackknifed and tilted, and something cracked down by the wheels. The coach righted itself, but now it was being pulled at the hurda's whims. "New plan!" said Jace. "Stop!" "#emph[You] stop it!" Before Jace could explain the folly of trying to mind-alter the beast, the hurda slapped the ground with its paws and shifted its weight again, now turning directly toward the wave of advancing Eldrazi. That halted it. Jace and Jori lurched with the stopping coach. Seeing the creatures moving toward it, the hurda slowly started backing up, pushing back into its own rigging, pushing back against the coach. The coach began to tilt, and something wooden was breaking— A kor woman dashed past the coach, seemingly out of nowhere, holding sharp, curving grappling hooks. She leapt onto the rigging, ran up the hurda's back, and jumped onto the ground between the packbeast and the scrambling Eldrazi. Jace could see that her skin was smudged with symbols in black grease—like hedron runes, but perhaps slightly different. Jori was incredulous. "Where the hell did she come from?" The kor woman looked at Jace and Jori, and without breaking eye contact with them, sliced through the hurda's neck with one of the sharp hooks. With a bellow, the hurda fell to the ground. She stood there, blood dripping from her hook, looking at them. Jace checked Jori's face to see his own mental state reflected back at him: extreme alarm. "Come with me!" the kor woman said sternly. "Hurry! They'll eat the animal first." With that, she bolted past them, heading toward a low hill. Jace and Jori leapt down from the coach and ran after her, Jori grabbing a halberd from the coach and Jace grabbing—nothing, as usual. The kor woman disappeared over the ridge, and they followed her to the lip of a narrow chasm. The kor woman had already deployed her lines and was rappelling down into the fissure. "Down here! Quickly!" #figure(image("003_The Believers' Pilgrimage/05.jpg", width: 100%), caption: [Art by <NAME>], supplement: none, numbering: none) Jace looked back. Sure enough, the hurda was already being overwhelmed and torn to shreds by the Eldrazi creatures. "I'm with her," said Jori En. She threw the halberd onto a strap on her back and lurched herself down the ropes, heading down into the chasm. Jace had eight or nine distinct bad feelings about this. But he took hold of one of the lines and pulled himself down. He had a strange brainstorm of creating illusions of himself to climb alongside him. He imagined them losing their grip on the ropes and falling, and for some reason the thought was strangely comforting. Better them than him. The kor woman helped him to the ground as Jori dusted herself off. "I am Ayli," she said. "We must get you to the sanctuary. Hurry, please!" Jace and Jori En exchanged another look—the facial equivalent of a desperate shrug. Ayli dashed through the narrow chasm, and they followed. They squeezed through the walls on either side of them; some were defined by the flat surfaces of great hedrons, other sections bare rock. They tried to hurry, which became increasingly difficult as they descended into shadow. Jace tried to keep close to Jori's back, his mind racing with fallback options as they got farther and farther from the coach. The chasm widened, and the sky opened overhead. Jace's gaze arced up from Jori, who had stopped dead in her tracks—to the kor woman, Ayli, who stood serenely before them, her hands folded—to the wide swath #emph[hewn] in the land ahead of them, edged with brittle gray dust—to the towering horror, the titan poised on a skirt of sinewy tentacles, the eyeless-skulled deity with its great bifurcated limbs. Ulamog. #figure(image("003_The Believers' Pilgrimage/06.jpg", width: 100%), caption: [Art by <NAME>], supplement: none, numbering: none) Jace could barely move. The air felt wrong. He felt drawn forward somehow, as if gravity had shifted away from the earth and toward this thing. He felt like krill drawn toward a whale's maw, sucked inevitably toward its consuming bristles. "Welcome, offerings, to the sanctuary," said Ayli, raising her arms. "The presence of the god Mangeni, whose second name is Ula, whose voice sings the Song of Devouring, will be your final sanctuary." Jace turned to retreat, but he and Jori were surrounded. A dozen other priests stood between them and the gap in the chasm. They were all dressed alike, painted with dark, greasy streaks like Ayli, and they all bore weapons. Two of them held lengths of thick iron chain. "We are the Eternal Pilgrims," Ayli intoned. "We shall forever roam!" "WE SHALL FOREVER ROAM!" chanted the other priests. "We present these world-gifts in Ula's name!" "IN ULA'S NAME!" Ulamog reached out with its tentacled bulk, grasped a quantity of earth, and then, horribly, began to drag itself forward. The sound of Ulamog's locomotion chilled Jace's soul—it was the sound of living earth having all its essence leeched out of it, of fierce and wild mana being silenced forever, of rich terrain turning to desiccated bone. It was only for a moment, but Jace imagined his own body dissolving under Ulamog's mass, his tissues separating from each other, his flesh floating away from him like the floating islands of Zendikar— This was what was going to happen to the entire world. The Eldrazi titan was consuming every flicker of energy on the plane, from the mana of the land to individual lives, slowly and inexorably. In a flash, Jace perceived the pattern that would develop. The peoples of Zendikar would flee from the wasted lands, gathering together in the places that could still support life, concentrating their number around defensive locations and landmarks. And in turn, Ulamog would drag his towering form toward those concentrations. And those trusted landmarks would become—tombs. #emph[Sea Gate] . That's why Sea Gate was being attacked by the scions of the Eldrazi. They were the farthest tendrils of Ulamog's spread, reaching out, sensing for the concentrations of population, sensing concentrations of energy. #figure(image("003_The Believers' Pilgrimage/07.jpg", width: 100%), caption: [Art by <NAME>], supplement: none, numbering: none) No, not sensing, he thought. #emph[Tasting] . Ayli and the circle of Eternal Pilgrims closed in on them. They raised the iron chains, and moved closer to Jace and Jori. Jori brandished her halberd, whipping it back and forth. It was not a time for subtlety. Jace walked straight up to one of the Pilgrims who was in his way, a human with gray stubble. "In Ula's name—" the man began, reaching forward to wrap Jace in chains. "Stop," said Jace, and the man burst into flames. The man screamed. He dropped the chains and flailed, pawing at his body, trying to slap at the fire that suddenly engulfed him. It wouldn't go out. He dropped to the ground and rolled against the grass, but it still wouldn't go out. He moaned in agony. Jace looked around at all the Eternal Pilgrims, and they, too, erupted in flames. They shrieked in unison, all of them grabbing at themselves, trying to shed their flame-consumed robes, writhing on the ground or running in random directions. Jace and Jori were no longer surrounded. "Which way out of here?" asked Jace. Jori's mouth hung open. "Uh—back into the chasm. We can climb back up the other face." As they raced back into the narrow fissure, Jori whispered at him. "How—? You're not a pyromancer." "The important thing is," said Jace, "#emph[they] don't know that." Jori looked back. Over their shoulder, the Pilgrims weren't on fire at all. They patted at their perfectly whole bodies, thrashing around in the grass for no reason. Jace saw her shoot him a look, and they ran on. #v(0.35em) #line(length: 100%, stroke: rgb(90%, 90%, 90%)) #v(0.35em) Jace and Jori caught their breath. In the distance, Ulamog hauled itself forward in the direction of Sea Gate, carving its way through the landscape. The Pilgrims hadn't strayed far from their object of worship. "I had never seen a titan before," said Jori. "Neither had I." It had become clear to Jace what needed to happen, and he didn't like it. Now he had to break the news to Jori, and hope she agreed. "Well, we lost all our provisions in the coach. . ." Jori said. "Jori," said Jace softly. ". . .So I can hunt for us for the next few days. I should be able to get us to the Eye on foot. We'll have to ask for help with the crossing, and then there's the Teeth of Akoum. But I have friends among the Tuktuk goblins who may be able to help. . ." "Jori, someone has to warn them." "Warn who?" "The others, back at Sea Gate. Ulamog is headed right for them. Gideon has to know what's coming." "And abandon our expedition to the Eye? You can't just . . . tell him? From here?" "It's too far for telepathy." "You could just . . . return. Right now. You're one of those." "I'm not doing that." "So, what? We just—head back?" Jori's neck-fins wrinkled. She turned away for a moment, toward the horizon, but then faced him again. "All right. Yes. We'll turn around. Head back as fast as we can. And we'll prepare for a fight at the encampment." "You go," said Jace. "What?" "Go back and warn them. I'm going to the Eye." "You're going on alone? Jace, no." "It's what has to happen." "But you'll never make it!" "I have to." "But then there's only #emph[one] of you! I won't let you go alone, unprovisioned, unprepared." "I'll have my illusions to keep me company." "Not funny. Come on. You're coming back to Sea Gate with me." Jace wondered if she knew her hand had involuntarily touched her halberd. "You're going to drag me back with you?" "If I have to!" "I thought you might say something like that." Jace backed away. He had to consider every possibility. "Goodbye, Jori." #v(0.35em) #line(length: 100%, stroke: rgb(90%, 90%, 90%)) #v(0.35em) "Wait," she found herself saying. "Jace. Wait. No. . ." Her voice trailed off. Jori shook her head and looked around. The encampment wasn't far now—another day's hike would have her back there to warn them. She had made good time without the tenderfoot mind mage to slow her down. It had only been a few days since she had convinced Jace— —#emph[Right?] —#emph[Yes] ? She furrowed her brow. . . .#emph[Yes.] —since she had convinced him to go on to the Eye without her. It had been the smartest option. He just needed to see the bigger picture. She stopped hiking. What had she just been saying to herself? #emph["Wait, Jace, no?"] #figure(image("003_The Believers' Pilgrimage/08.jpg", width: 100%), caption: [Art by <NAME>], supplement: none, numbering: none) She scanned around, feeling like she needed to get her bearings. The sky above her was much as it had been for the past several days—broad and blue, and peppered with clouds and the occasional floating hedron, limitless and familiar and yet somehow odd. She felt an unsettling sensation, as if the dome of sky had just somehow bent into a new shape, suddenly and just outside her field of vision. She swiveled her head around. The grass and stones and distant trees all looked as they should. She looked at a stone on the ground. She kicked it. "God#emph[damn] it, Jace." She heaved a breath and shook her head. She adjusted a strap on her armor and walked on, on toward Sea Gate.
https://github.com/atareao/typst-templates
https://raw.githubusercontent.com/atareao/typst-templates/main/book/example/02-chapter-02.typ
typst
MIT License
= Chapter 02 #lorem(150)
https://github.com/elteammate/typst-compiler
https://raw.githubusercontent.com/elteammate/typst-compiler/main/src/z-test.typ
typst
#import "reflection-lexer.typ": * #import "reflection-parser.typ": * #let tokens = typst_lex(" #let x = x.x() aboba") #tokens.map(x => [#x]).join([ \ ]) \ \ // #pprint_ast(typst_parse(tokens)) // #"abacaba".slice(2, -2)
https://github.com/KireinaHoro/research-plan
https://raw.githubusercontent.com/KireinaHoro/research-plan/master/glossary.typ
typst
// defined in the format for @preview/glossarium #let glossary = ( (key: "rpc", short: [RPC], long: [remote procedure call]), (key: "nic", short: [NIC], long: [network interface card]), (key: "dma", short: [DMA], long: [direct memory access]), (key: "irq", short: [IRQ], long: [interrupt request]), (key: "pio", short: [PIO], long: [programmed input/output]), (key: "ipu", short: [IPU], long: [infrastructure processing unit]), (key: "sriov", short: [SR-IOV], long: [single-root input/output virtualization]), (key: "abv", short: [ABV], long: [assertion-based verification]), (key: "fpga", short: [FPGA], long: [field-programmable gate array]), (key: "oncrpc", short: [ONC-RPC], long: [Open Network Computing Remote Procedure Call]), (key: "nfs", short: [NFS], long: [Network File System]), )
https://github.com/Myriad-Dreamin/typst.ts
https://raw.githubusercontent.com/Myriad-Dreamin/typst.ts/main/fuzzers/corpora/layout/transform_01.typ
typst
Apache License 2.0
#import "/contrib/templates/std-tests/preset.typ": * #show: test-page // Test combination of scaling and rotation. #set page(height: 80pt) #align(center + horizon, rotate(20deg, scale(70%, image("/assets/files/tiger.jpg"))) )
https://github.com/jgm/typst-hs
https://raw.githubusercontent.com/jgm/typst-hs/main/test/typ/meta/document-03.typ
typst
Other
Hello // Error: 2-30 document set rules must appear before any content #set document(title: "Hello")
https://github.com/RaphGL/ElectronicsFromBasics
https://raw.githubusercontent.com/RaphGL/ElectronicsFromBasics/main/DC/chap3/4_ohms_law_again.typ
typst
Other
#import "../../core/core.typ" === Ohm's Law (again!) A common phrase heard in reference to electrical safety goes something like this: "It's not voltage that kills, its current!" While there is an element of truth to this, there's more to understand about shock hazard than this simple adage. If voltage presented no danger, no one would ever print and display signs saying: *DANGER -- HIGH VOLTAGE!* The principle that "current kills" is essentially correct. It is electric current that burns tissue, freezes muscles, and fibrillates hearts. However, electric current doesn't just occur on its own: there must be voltage available to motivate electrons to flow through a victim. A person's body also presents resistance to current, which must be taken into account. Taking Ohm's Law for voltage, current, and resistance, and expressing it in terms of current for a given voltage and resistance, we have this equation: $ I = E / R $ $ "Current" = "Voltage" / "Resistance" $ The amount of current through a body is equal to the amount of voltage applied between two points on that body, divided by the electrical resistance offered by the body between those two points. Obviously, the more voltage available to cause electrons to flow, the easier they will flow through any given amount of resistance. Hence, the danger of high voltage: high voltage means potential for large amounts of current through your body, which will injure or kill you. Conversely, the more resistance a body offers to current, the slower electrons will flow for any given amount of voltage. Just how much voltage is dangerous depends on how much total resistance is in the circuit to oppose the flow of electrons. Body resistance is not a fixed quantity. It varies from person to person and from time to time. There's even a body fat measurement technique based on a measurement of electrical resistance between a person's toes and fingers. Differing percentages of body fat give provide different resistances: just one variable affecting electrical resistance in the human body. In order for the technique to work accurately, the person must regulate their fluid intake for several hours prior to the test, indicating that body hydration another factor impacting the body's electrical resistance. Body resistance also varies depending on how contact is made with the skin: is it from hand-to-hand, hand-to-foot, foot-to-foot, hand-to-elbow, etc.? Sweat, being rich in salts and minerals, is an excellent conductor of electricity for being a liquid. So is blood, with its similarly high content of conductive chemicals. Thus, contact with a wire made by a sweaty hand or open wound will offer much less resistance to current than contact made by clean, dry skin. Measuring electrical resistance with a sensitive meter, I measure approximately 1 million ohms of resistance (1 MΩ) between my two hands, holding on to the meter's metal probes between my fingers. The meter indicates less resistance when I squeeze the probes tightly and more resistance when I hold them loosely. Sitting here at my computer, typing these words, my hands are clean and dry. If I were working in some hot, dirty, industrial environment, the resistance between my hands would likely be much less, presenting less opposition to deadly current, and a greater threat of electrical shock. But how much current is harmful? The answer to that question also depends on several factors. Individual body chemistry has a significant impact on how electric current affects an individual. Some people are highly sensitive to current, experiencing involuntary muscle contraction with shocks from static electricity. Others can draw large sparks from discharging static electricity and hardly feel it, much less experience a muscle spasm. Despite these differences, approximate guidelines have been developed through tests which indicate very little current being necessary to manifest harmful effects (again, see end of chapter for information on the source of this data). All current figures given in milliamps (a milliamp is equal to 1/1000 of an amp): #table( align: horizon, columns: (auto, auto, auto, auto), table.header([*BODILY EFFECT*], [*DIRECT CURRENT (DC)*], [*60 Hz AC*], [*10 kHz AC*]), [Slight sensation, felt at hand(s)], [ Men = 1.0 mA Women = 0.6 mA ], [ 0.4 mA 0.3 mA ], [ 7 mA 5 mA ], [Threshold of perception], [ Men = 5.2 mA Women = 3.5 mA ], [ 1.1 mA 0.7 mA ], [ 12 mA 8 mA ], [Painful, but voluntary muscle control maintained], [ Men = 62 mA Women = 41 mA ], [ 9 mA 6 mA ], [ 55 mA 37 mA ], [Painful, unable to let go of wires], [ Men = 76 mA Women = 51 mA ], [ 16 mA 10.5 mA ], [ 75 mA 50 mA ], [Severe pain, difficulty breathing], [ Men = 90 mA Women = 60 mA ], [ 23 mA 15 mA ], [ 94 mA 63 mA ], [Possible heart fibrillation after 3 seconds], [ Men = 500 mA Women 500 mA ], [ 100 mA 100 mA ], ) "Hz" stands for the unit of _Hertz_, the measure of how rapidly alternating current alternates, a measure otherwise known as _frequency_. So, the column of figures labeled "60 Hz AC" refers to current that alternates at a frequency of 60 cycles (1 cycle = period of time where electrons flow one direction, then the other direction) per second. The last column, labeled "10 kHz AC," refers to alternating current that completes ten thousand (10,000) back-and-forth cycles each and every second. Keep in mind that these figures are only approximate, as individuals with different body chemistry may react differently. It has been suggested that an across-the-chest current of only 17 milliamps AC is enough to induce fibrillation in a human subject under certain conditions. Most of our data regarding induced fibrillation comes from animal testing. Obviously, it is not practical to perform tests of induced ventricular fibrillation on human subjects, so the available data is sketchy. Oh, and in case you're wondering, I have no idea why women tend to be more susceptible to electric currents than men! Suppose I were to place my two hands across the terminals of an AC voltage source at 60 Hz (60 cycles, or alternations back-and-forth, per second). How much voltage would be necessary in this clean, dry state of skin condition to produce a current of 20 milliamps (enough to cause me to become unable to let go of the voltage source)? We can use Ohm's Law ($E = I R$) to determine this: $ E &= I R \ E &= 20"mA" times 1M Omega) \ E &= 20,000 "volts" "or" 20 "kV" $ Bear in mind that this is a "best case" scenario (clean, dry skin) from the standpoint of electrical safety, and that this figure for voltage represents the amount necessary to induce tetanus. Far less would be required to cause a painful shock! Also keep in mind that the physiological effects of any particular amount of current can vary significantly from person to person, and that these calculations are rough _estimates only_. With water sprinkled on my fingers to simulate sweat, I was able to measure a hand-to-hand resistance of only 17,000 ohms ($17 k Omega$). Bear in mind this is only with one finger of each hand contacting a thin metal wire. Recalculating the voltage required to cause a current of 20 milliamps, we obtain this figure: $ E &= I R \ E &= 20 "mA" times 17 k Omega) \ E &= 340 "volts" $ In this realistic condition, it would only take 340 volts of potential from one of my hands to the other to cause 20 milliamps of current. However, it is still possible to receive a deadly shock from less voltage than this. Provided a much lower body resistance figure augmented by contact with a ring (a band of gold wrapped around the circumference of one's finger makes an excellent contact point for electrical shock) or full contact with a large metal object such as a pipe or metal handle of a tool, the body resistance figure could drop as low as 1,000 ohms (1 $k Omega$), allowing an even lower voltage to present a potential hazard: $ E &= I R \ E &= 20 "mA" times 1 k Omega \ E &= 20 "volts" $ Notice that in this condition, 20 volts is enough to produce a current of 20 milliamps through a person: enough to induce tetanus. Remember, it has been suggested a current of only 17 milliamps may induce ventricular (heart) fibrillation. With a hand-to-hand resistance of 1000 $Omega$, it would only take 17 volts to create this dangerous condition: $ E &= I R \ E &= 17 "mA" times 1 k Omega \ E &= 17 "volts" $ Seventeen volts is not very much as far as electrical systems are concerned. Granted, this is a "worst-case" scenario with 60 Hz AC voltage and excellent bodily conductivity, but it does stand to show how little voltage may present a serious threat under certain conditions. The conditions necessary to produce 1,000 $Omega$ of body resistance don't have to be as extreme as what was presented, either (sweaty skin with contact made on a gold ring). Body resistance may decrease with the application of voltage (especially if tetanus causes the victim to maintain a tighter grip on a conductor) so that with constant voltage a shock may increase in severity after initial contact. What begins as a mild shock -- just enough to "freeze" a victim so they can't let go -- may escalate into something severe enough to kill them as their body resistance decreases and current correspondingly increases. Research has provided an approximate set of figures for electrical resistance of human contact points under different conditions (see end of chapter for information on the source of this data): - Wire touched by finger: 40,000 $Omega$ to 1,000,000 $Omega$ dry, 4,000 $Omega$ to 15,000 $Omega$ wet. - Wire held by hand: 15,000 $Omega$ to 50,000 $Omega$ dry, 3,000 $Omega$ to 5,000 $Omega$ wet. - Metal pliers held by hand: 5,000 $Omega$ to 10,000 $Omega$ dry, 1,000 $Omega$ to 3,000 $Omega$ wet. - Contact with palm of hand: 3,000 $Omega$ to 8,000 $Omega$ dry, 1,000 $Omega$ to 2,000 $Omega$ wet. - 1.5 inch metal pipe grasped by one hand: 1,000 $Omega$ to 3,000 $Omega$ dry, 500 $Omega$ to 1,500 $Omega$ wet. - 1.5 inch metal pipe grasped by two hands: 500 $Omega$ to 1,500 k$Omega$ dry, 250 $Omega$ to 750 $Omega$ wet. - Hand immersed in conductive liquid: 200 $Omega$ to 500 $Omega$. - Foot immersed in conductive liquid: 100 $Omega$ to 300 $Omega$. Note the resistance values of the two conditions involving a 1.5 inch metal pipe. The resistance measured with two hands grasping the pipe is exactly one-half the resistance of one hand grasping the pipe. #image("static/4-circuit-1.png") Note the resistance values of the two conditions involving a 1.5 inch metal pipe. The resistance measured with two hands grasping the pipe is exactly one-half the resistance of one hand grasping the pipe. #image("static/4-circuit-2.png") As we will see in a later chapter, _parallel_ circuit pathways always result in less overall resistance than any single pathway considered alone. In industry, 30 volts is generally considered to be a conservative threshold value for dangerous voltage. The cautious person should regard any voltage above 30 volts as threatening, not relying on normal body resistance for protection against shock. That being said, it is still an excellent idea to keep one's hands clean and dry, and remove all metal jewelry when working around electricity. Even around lower voltages, metal jewelry can present a hazard by conducting enough current to burn the skin if brought into contact between two points in a circuit. Metal rings, especially, have been the cause of more than a few burnt fingers by bridging between points in a low-voltage, high-current circuit. Also, voltages lower than 30 can be dangerous if they are enough to induce an unpleasant sensation, which may cause you to jerk and accidently come into contact across a higher voltage or some other hazard. I recall once working on a automobile on a hot summer day. I was wearing shorts, my bare leg contacting the chrome bumper of the vehicle as I tightened battery connections. When I touched my metal wrench to the positive (ungrounded) side of the 12 volt battery, I could feel a tingling sensation at the point where my leg was touching the bumper. The combination of firm contact with metal and my sweaty skin made it possible to feel a shock with only 12 volts of electrical potential. Thankfully, nothing bad happened, but had the engine been running and the shock felt at my hand instead of my leg, I might have reflexively jerked my arm into the path of the rotating fan, or dropped the metal wrench across the battery terminals (producing large amounts of current through the wrench with lots of accompanying sparks). This illustrates another important lesson regarding electrical safety; that electric current itself may be an indirect cause of injury by causing you to jump or spasm parts of your body into harm's way. The path current takes through the human body makes a difference as to how harmful it is. Current will affect whatever muscles are in its path, and since the heart and lung (diaphragm) muscles are probably the most critical to one's survival, shock paths traversing the chest are the most dangerous. This makes the hand-to-hand shock current path a very likely mode of injury and fatality. To guard against such an occurrence, it is advisable to only use one hand to work on live circuits of hazardous voltage, keeping the other hand tucked into a pocket so as to not accidently touch anything. Of course, it is always safer to work on a circuit when it is unpowered, but this is not always practical or possible. For one-handed work, the right hand is generally preferred over the left for two reasons: most people are right-handed (thus granting additional coordination when working), and the heart is usually situated to the left of center in the chest cavity. For those who are left-handed, this advice may not be the best. If such a person is sufficiently uncoordinated with their right hand, they may be placing themselves in greater danger by using the hand they're least comfortable with, even if shock current through that hand might present more of a hazard to their heart. The relative hazard between shock through one hand or the other is probably less than the hazard of working with less than optimal coordination, so the choice of which hand to work with is best left to the individual. The best protection against shock from a live circuit is resistance, and resistance can be added to the body through the use of insulated tools, gloves, boots, and other gear. Current in a circuit is a function of available voltage divided by the total resistance in the path of the flow. As we will investigate in greater detail later in this book, resistances have an additive effect when they're stacked up so that there's only one path for electrons to flow: #image("static/4-circuit-3.png") Person in direct contact with voltage source current limited only by body resistance: $ I = E / R_"body" $ Now we'll see an equivalent circuit for a person wearing insulated gloves and boots: #image("static/4-circuit-4.png") Person wearing insulating gloves and boots: Current now limited by _total_ circuit resistances. $ I = E / (R_"glove" + R_"body" + R_"boot") $ Because electric current must pass through the boot _and_ the body and the glove to complete its circuit back to the battery, the combined total (_sum_) of these resistances opposes the flow of electrons to a greater degree than any of the resistances considered individually. Safety is one of the reasons electrical wires are usually covered with plastic or rubber insulation: to vastly increase the amount of resistance between the conductor and whoever or whatever might contact it. Unfortunately, it would be prohibitively expensive to enclose power line conductors in sufficient insulation to provide safety in case of accidental contact, so safety is maintained by keeping those lines far enough out of reach so that no one can accidently touch them. #core.review[ - Harm to the body is a function of the amount of shock current. Higher voltage allows for the production of higher, more dangerous currents. Resistance opposes current, making high resistance a good protective measure against shock. - Any voltage above 30 is generally considered to be capable of delivering dangerous shock currents. - Metal jewelry is definitely bad to wear when working around electric circuits. Rings, watchbands, necklaces, bracelets, and other such adornments provide excellent electrical contact with your body, and can conduct current themselves enough to produce skin burns, even with low voltages. - Low voltages can still be dangerous even if they're too low to directly cause shock injury. They may be enough to startle the victim, causing them to jerk back and contact something more dangerous in the near vicinity. - When necessary to work on a "live" circuit, it is best to perform the work with one hand so as to prevent a deadly hand-to-hand (through the chest) shock current path. ]
https://github.com/rikhuijzer/phd-thesis
https://raw.githubusercontent.com/rikhuijzer/phd-thesis/main/propositions.typ
typst
The Unlicense
#let font = "EB Garamond" // Use to test whether font is used. // Fallback true needed for Gronnerod in some fonts. #let fallback = true #set text(font: font, fallback: fallback, size: 14pt) #align(center)[ #set text(size: 20pt) Propositions ] \ #align(center)[ Belonging to the dissertation \ *Predicting dropout in special forces selection* \ by <NAME>. ] \ + We can predict dropout in special forces selection reasonably well, but validation in practice is necessary (this thesis). + Physical measures are more predictive of dropout in special forces selection than psychological measures (this thesis). + It is easier to predict dropout than to predict graduation (this thesis). + Psychology's near-total focus on explaining the causes of behavior has led to theories with little (or unknown) ability to accurately predict future behaviors (this thesis). + Machine learning's near-total focus on predictive performance has led to accurate models with possibly unsafe, unfair, or unreliable predictions (this thesis). + A solution is to combine prediction and explanation (this thesis). + Recognize reality even when you don't like it. Especially when you don't like it (<NAME>).
https://github.com/juraph-dev/usyd-slides-typst
https://raw.githubusercontent.com/juraph-dev/usyd-slides-typst/main/example.typ
typst
MIT License
#import "usyd_polylux_theme.typ": * #show: usyd-theme.with( short-author: "Juraph", short-title: "Demo of Typst capabilities", short-date: "24th Jul, 2024" ) #set text(font: "Arial", fallback: false) #set par(justify: true) #title-slide( authors: [Juraph, author2, author3, author4], title: "University of Sydney Typst Presentation theme", subtitle: "Powered by Polylux", // date: datetime.today().display() // Use this to display current date title_image: "./figures/acfr-hero-image.jpg", date: "24th July 2024" ) #usyd-pres-outline() #slide(new-section: "Example maths")[ Demonstrating some mathematics: $frac(d, d t) (frac(partial L, partial dot(q)_i)) - frac(partial L, partial q_i) = tau$ $ overline(delta) = 1/2 z_"b"(t_"bt") + (m_"b" g)/k - ((m_"b" + m_"l")^2)/(k m_"b" z_"b"(t_"bt")) g h $ $ mat(delim: "[", dot.double(x); dot.double(theta)) = mat(delim: "[", (m_p sin(theta) (l dot(theta)^2 + g cos(theta))) / (m_c + m_p sin^2(theta)) ; (-f_x cos(theta) - m_p l dot(theta)^2 cos(theta) sin(theta) - (m_c + m_p) g sin(theta)) / (l (m_c + m_p sin^2(theta))) ) + mat(delim: "[", 1; 0) f_x $ ] #slide(title: "Example title", new-section: "Demonstration of blocks")[ #usyd-info-block(title: "Info", "info block") #usyd-example-block(title: "Example", "example block") #usyd-alert-block(title: "Alert", "alert block") Blocks are schemed to usyd themes. ] #new-section-slide("Break slide to introduce new section") #slide(title: "Continuation of new section")[ Note the progress of sections in the header ] #slide(title: "Example title",new-section: "sect 3")[ Blank slides to show progress bar in header ] #slide(title: "Example title", new-section: "sect 4")[ Blank slides to show progress bar in header ] #slide(new-section: "sect 5")[ Blank slides to show progress bar in header ] #slide(new-section: "sect 6")[ Blank slides to show progress bar in header ] #slide(new-section: "sect 7")[ Blank slides to show progress bar in header ] #focus-slide[ Thanks for checking this theme out! #parbreak() Please feel free to propose changes/improvements. ]
https://github.com/fuchs-fabian/typst-template-aio-studi-and-thesis
https://raw.githubusercontent.com/fuchs-fabian/typst-template-aio-studi-and-thesis/main/template/lib.typ
typst
MIT License
#import "@preview/aio-studi-and-thesis:0.1.0": *
https://github.com/kotfind/hse-se-2-notes
https://raw.githubusercontent.com/kotfind/hse-se-2-notes/master/os/lectures/2024-09-30.typ
typst
== Конкретные алгоритмы (программные) === Запрет прерываний Существует команда процесса (Clear Interrupt), которая заставляет его игнорировать почти все прерывания, кроме критических. У процесса не могу отобрать процессор ни при каких условиях. Существует парная команда, которая обрабатывает все запомненные и новые прерывания. ``` while (some condition) { запретить все прерывания critical section разрешить все прерывания remainder section } ``` Если в программе есть бесконечный цикл, то вся система насмерть зависнет. Команды доступны только ядру. Прием используется только внутри кода ОС. === Переменная-замок Общая переменная--замок для всех процессов в наборе ``` shared int lock = 0; while (some condition) { while (lock == 1); lock = 1; critical section lock = 0; remainder section } ``` Если между `while (lock == 1);` и `lock = 1;` перейдет передача управления, то будет беда: оба процесса войдут в критическую секцию. === Строгое чередование Введем порядок, в котором процессы будут проходить свои критические секции. ``` // для двух процессов // i-ый процесс shared int turn = 0; while (some condition) { while (turn != i); critical section turn = (i + 1) % 2; remainder section } ``` Если у процессов скорость выполнения сильно разная, то один из процессов может очень долго ждать входа в критическую секцию. === Флаги готовности ``` shared int ready[proc_num] = {0}; while (some condition) { ready[i] = 1; while (ready[1 - i]); critical section ready[0] = 0; remainder section } ``` Если оба процесса скажут, что они готовы, то беда: оба зависнут в цикле. === Алгоритм Петерсона Совмещение идей очередности и готовности. ``` // для 0-ого процесса shared int ready[2] = {0}; shared int turn; while (some condition) { ready[0] = 1; turn = 1; while (ready[1] && turn == 1); critical section; ready[0] = 0; remainder section; } ``` Все пять требований выполняются. Для `n` процессов алгоритм сложнее, но существует. === Bakery algorithm (алгоритм булочной) "Алгоритм регистратуры в поликлинике" Основные идеи: + Процессы можно сравнивать по именам (id-шникам) + Перед входом в критическую секцию процессы получают "талон" с номером. Может случиться, что номера талонов совпали. + В критическую секцию входит тот, у кого меньше пара (номер талона, id-шник). === Заключение Всё работало хорошо до 2005 года, пока не появились многоядерные системы Раньше использовалась строгая модель консистентности памяти: из ячейки всегда считывается то значение, которое последнее было туда записано. Модель плоха с точки зрения hardware: кэши разных ядер и оперативу долго синхронизировать. Модель ослабили: синхронизацию производять только после накопления некоторого числа изменений. Алгоритмы синхронизации стали нерабочими: теперь после каждого изменения shared переменной нужно атомарно синхронизировать кэши. == Аппаратная поддержка === Команда Test-And-Set ``` int Test-And-Set(int* a) { int tmp = *a; *a = 1; return tmp; } // Но выполняется процессором атомарно ``` ``` shared int lcok = 0; while(some condition) { while (Test-And-Set(&lock)); critical section lock = 0; remainder section } ``` Нарушается условие ограниченного ожидания, но это легко чиниться. === Команда Swap ``` void Swap(int* a, int* b) { int tmp = *a; *a = *b; *b = tmp; } ``` ``` shared int lock = 0; int key = 0; while (some condition) { key = 1; do Swap(&lock, &key); while (key); critical section lock = 0; remainder section } ``` Тоже нарушается условие ограниченного ожидания, но это легко чиниться. = Механизмы синхронизации Механизмы внутри ОС Недостатки программных алгоритмов: + Ослабленная модель консистентности памяти + Перевод цикла активного ожидания (busy wait) в цикл активного ожидания#footnote[это не всегда эффективно из-за накладных расходов]: "Кручение" в while-замке жрет процессорное время + Классические алгоритмы плохо работают в случае введения приоритетов процессов: Проблема, если низко приоритетный процесс вошел в критическую секцию, а у него отобрали управление: + высоко приоритетный не может войти в критическую секцию, так так там низко приоритетный + низко приоритетный не может выйти из критической секции, так как у него отняли управление == Семафор Дейкстры `S` --- семафор --- целая неотрицательная разделяемая переменная При создании инициализируется любым неотрицательным значением Допустимые *атомарные* операции: + `P(S)`: ``` while (S == 0) block process S -= 1 ``` + `V(S):` ``` S += 1 ``` "Задача об обедающих философах" == Проблема Producer--Consumer Два процесса (в более сложной постановке процессов может быть больше): + Один производит информацию + Один --- потребляет Обмениваются информацией через буфер конченого размера: + Если в буфере нет места, то Producer блокируется + Если в буфере пусто, то Consumer блокируется Критическая секция --- работа с буфером === Решения с тремя семафорами Семафоры: + Взаимоисключение работы буферов (`mut_ex`) + Блокировка Producer (`full`) + Блокировка Consumer (`empty`) ``` Semaphore mut_ex = 1; Semaphore full = 0; Semaphore empty = N; ``` #grid( columns: 2, row-gutter: 5pt, [Producer:], [Consumer:], // Producer ``` while (1) { produce_item(); P(empty); P(mut_ex); put_item(); V(mut_ex): V(full); } ```, // Consumer ``` while (1) { P(full) P(mut_ex) get_item(); V(mut_ex); V(empty); consume_item(); } ``` ) Вдруг совершили ошибку: в `Consumere` перепутали местами строки `P(full)` и `P(mut_ex)`. Всё ломается: заходим в состояние вечного ожидания. Эту ошибку сложно отследить, так как она возникает только при определенных условиях. == Мониторы Хора (Hoare) В ЯП встраиваются определенные конструкции --- мониторы Хора. ``` Monitor monitor_name { Описание внутренних переменных; void m1(...) {...} void m2(...) {...} ... void mn(...) {...} Блок инициализации переменных; } ``` Со внутренними переменными можно работать только используя методы монитора. Только один метод монитора может быть вызван (это достигается ОС и компилятором языка). === Условные переменные `Condition C;` Всегда лежат внутри монитора. Операции: + `C.wait`: Всегда блокирует данный процесс + `C.signal`: Разблокирует один процесс, который раньше выполнил `.wait`, если он есть. Процесс мгновенно вылетает из монитора. === Producer--Consumer ``` Monitor PC { Condition full, empty; int count; void put() { if (count == N) full.wait; put_item(); ++count; if (count == 1) empty.signal; // Если ждал consumer, то разбудили его } void get() { if (count == 0) empty.wait; get_item(); --count; if (count == N - 1) full.signal; // Если ждал producer, то разбудили его } { count = 0; } } ``` #grid( columns: 2, row-gutter: 5pt, [Producer:], [Consumer:], // Producer ``` while (1) { produce_item(); PC.put(); } ```, // Consumer ``` while (1) { PC.get(); consume_item(); } ``` ) В этом методе хорошо то, что сложно налажать. Плохо, что нужен ЯП с соответствующей конструкцией.
https://github.com/GuTaoZi/SUSTech-thesis-typst
https://raw.githubusercontent.com/GuTaoZi/SUSTech-thesis-typst/main/README.md
markdown
MIT License
# 南方科技大学学位论文 SUSTech-thesis-typst \* 本项目绝赞施工中,欢迎参与开发或提出宝贵意见! 南方科技大学毕业论文(设计)的Typst模板,拥有Markdown的实时渲染与简洁语法,不输$\LaTeX$的自动排版,如Word写作一样轻松上手。本模板按照[南方科技大学本科生毕业论文(设计)撰写规范](https://tao.sustech.edu.cn/studentService/graduation_project.html)进行编写,但由于本模板并非官方模板,**存在不被认可的风险**。 查看示例论文:[thesis.pdf](./build/thesis.pdf) ## 为什么选择Typst? 1. $\LaTeX$语法复杂,可读性低,要从通篇都是反斜杠和花括号的源码中定位文本费时费力。同时在文本数量增多后,编译一次用时几分钟,浪费时间是对写作者的慢性谋杀。 2. Word排版不够优雅,时常出现各种血压情况与排版问题,且每一段都需要手动调整格式,没有技术含量的重复性工作拖累学术写作。 Typst 是可用于出版的可编程标记语言,拥有变量、函数与包管理等现代编程语言的特性,注重于科学写作 (science writing),定位与 LaTeX 相似。可以阅读[@OrangeX4](https://github.com/OrangeX4):[Typst 中文用户使用体验](https://zhuanlan.zhihu.com/p/669097092) 进一步了解 Typst 的优势。 Typst拥有活跃的社区与完善的文档,可以阅读[Typst Official Tutorial](https://typst.app/docs/tutorial/)或[Typst 中文文档网站](https://typst-doc-cn.github.io/docs/)快速上手,如果你是有经验的$\LaTeX$写手,可以参考[LaTeX 用户指南](https://typst-doc-cn.github.io/docs/guides/guide-for-latex-users/)。 ## 搭建编写环境 ### 在线编辑 Typst提供了[Web App](https://typst.app/)以支持在线编辑,其使用类似于用Overleaf编写LaTeX,但Typst的增量编译实时渲染让学术写作效率与体验远超recompile一次要一年的LaTeX,极大提高效率和开发体验。 目前Typst Web App对自行上传字体的支持尚不完善,本模板涉及的字体并未完全被在线编辑器支持,因此在使用该模板时推荐使用本地编辑,不过平时写作业/报告使用Web App绰绰有余。 ### 本地编辑(推荐) 1. 克隆本仓库到本地 ```bash git clone https://github.com/GuTaoZi/SUSTech-thesis-typst.git ``` 2. 使用Visual Studio Code打开此文件夹,安装以下插件以支持Typst本地编辑与预览: - [Typst LSP](https://marketplace.visualstudio.com/items?itemName=nvarner.typst-lsp) - [Typst Preview](https://marketplace.visualstudio.com/items?itemName=mgt19937.typst-preview) - [Typst Companion](https://marketplace.visualstudio.com/items?itemName=CalebFiggers.typst-companion) 3. 打开目录下的`thesis.typ`,使用`CTRL+SHIFT+P`快捷键输入命令`Typst Preview: Preview current file`,即可实时渲染论文了,同时也可以进行双向定位。 ![开发环境示意图](https://s2.loli.net/2024/01/21/VBqM3uoxA7yJ2t4.png) 4. 在导出为PDF时,可以使用以下命令,将`thesis.pdf`生成到build目录下,也可以`typst --help`了解更多用法。 ```bash typst compile --font-path fonts thesis.typ ./build/thesis.pdf ``` ## 项目结构说明 - `template`目录下定义了论文各个部分的排版格式 - `utils`目录包括了一些常用的小工具,例如字体设置 - 默认使用主目录下的`thesis.typ`作为主要编写文档 - 推荐将图片放在`images`目录下,便于管理 - 在`references.bib`文件中添加BibTex格式的参考文献,引用的具体使用方法请移步[官方教程](https://typst.app/docs/reference/model/cite/) ## **开发进度** - [x] 学士学位模板 - [x] 中文封面 - [x] 英文封面 - [x] 诚信承诺书 - [x] 中文摘要 - [x] 英文摘要 - [x] 目录页 - [ ] 插图目录 - [ ] 表格目录 - [ ] 符号表 - [x] 致谢 ## 参与贡献 一个人的力量总是有限的,模板中可能存在Bug和不优雅的实现,欢迎大家对本模板进行完善改进,为大家提供更舒适优雅的学术写作环境。 - 关于使用中遇到的问题与未来特性的需求,请通过在本仓库提交issue进行反馈。 - 非常欢迎通过提交PR等方式实现特性,修复问题,协助项目开发。 ## 致谢 - 感谢[梁钰栋学长](https://github.com/iydon)开发的$\LaTeX$版本学士学位论文模板[sustechthesis](https://github.com/iydon/sustechthesis),本项目开发过程中参考了其排版。 - 感谢[nju-thesis-typst](https://github.com/nju-lug/nju-thesis-typst)等基于Typst的中文学位论文模板,文档详细结构清晰,本项目开发过程中多有借鉴。
https://github.com/saYmd-moe/note-for-statistical-mechanics
https://raw.githubusercontent.com/saYmd-moe/note-for-statistical-mechanics/main/contents/PartII/PartII.typ
typst
#import "../../template.typ": * = 统计力学 为了方便复习,统计力学部分会尽量简略描述结果,省去大部分推导过程,作为简单的总结给出。(快考试了没时间写全推导步骤) $arrow.t arrow.b$ #colorbox( title: [等概率原理], color: "blue", radius: 5pt, width: auto )[ 对于#text(rgb("#FA7F6F"))[平衡态的孤立系],系统处于各个可能微观态的概率相等。 ] $ cases( #[定域子系] cases( #[经典子系(经典统计)] , #[量子子系(量子统计)] ), #[非定域子系] cases( #[Bose子(_Bose-Einstein_分布) 自旋是 $hbar$ 的整数倍,如光子($s=1$)、$pi$ 介子($s=0$)], #[Fermi子(_Fermi-Dirac_分布) 自旋是 $hbar$ 的半整数倍,如电子($s=1/2$)、质子($s=1/2$)] ) ) $ #h(2em)后续计算中搞清楚变量含义尤为重要,一千个物理壬使用一千套符号体系,先在这里给出各个变量的含义便于随时检索。 - *能级:* $epsilon_lambda$ 用于记录各个能级的能量 - *简并度:* $g_lambda$ 相同能级下允许存在的不同的量子态数目 - *分布:* ${a_lambda}$ $a_1,a_2,dots.c,a_lambda$ 用于记录第 $lambda$ 个能级上的粒子数 - *系统量子态数:* $W({a_lambda})=#text(rgb("#FA7F6F"))[$c$] #text(blue)[$product_lambda d_lambda$]$,#text(rgb("#FA7F6F"))[分布${a_lambda}$只决定了每个能级上的粒子数,还需要考虑不同能级间粒子的变换,这就是组合系数 $c$]; #text(blue)[第$lambda$个能级上的$a_lambda$个粒子有$d_lambda$种占据方式] - *_Stirling_公式:*$ ln n! = sum_(k=1)^n ln k approx integral_1^n ln x dif x (n gt.double 1) = [x ln x - x]_1^n approx n (ln n -1) $ - *处于平衡态的孤立近独立子系必满足这两个条件:*$ sum_lambda a_lambda = N, \ sum_lambda epsilon_lambda a_lambda = E. $ 直接给出最可几分布的形式,后续小节补充推导过程(使用 _Stirling_ 公式和_Lagrange_乘子法得到):$ macron(a)_lambda = g_lambda/(e^(alpha + beta epsilon_lambda) + eta), quad eta = cases( plus 1\, quad &#[_Fermi-Dirac_分布], 0\, &#[_Maxwell-Boltzmann_分布], minus 1\, &#[_Bose-Einstein_分布] ) $最可几分布法(最概然分布法)是一种使用极大值代替平均值的方法,上述各个分布 $tilde(a)_lambda$ 都是使系统量子态数 $W({a_lambda})$ 取极大值的分布,该分布可以代表微观的统计平均,进而反应系统的宏观状态。
https://github.com/FkHiroki/ex-D2
https://raw.githubusercontent.com/FkHiroki/ex-D2/main/sections/section1.typ
typst
MIT No Attribution
= 問1 == (1) 恒星と惑星 恒星とは自ら光を放つ天体であり、核融合によってエネルギーを生み出し、そのエネルギーを放射している。一方、惑星は恒星の周りを公転している天体であり、自ら光を放つことはなく、恒星が放射する光を反射している。太陽系においては、太陽が恒星であり、地球や木星などが惑星である。 == (2) 白色矮星と中性子星 白色矮星と中性子星はどちらも恒星の成れの果てである。白色矮星は、$0.08$から$8$太陽質量程度の恒星が核融合を終えた後に残る天体であり、中性子星は、質量が太陽の$8$倍より大きい恒星が、超新星爆発を起こした後に残る天体である。白色矮星は電子縮退圧によって自重を支えているが、中性子星は核力と中性子の縮退圧によって自重を支えている。 == (3) 渦巻き銀河と楕円銀河 渦巻銀河はバルジ・円盤部・ハローの3つの構造を持ち、円盤部が渦巻構造になっている銀河である。一方楕円銀河は円盤構造や渦巻模様がなく、楕円形をしている銀河である。渦巻銀河は比較的青い光が多く星形成が盛んであるが、楕円銀河は赤い光が多く、星形成が活発でない。
https://github.com/jgm/typst-hs
https://raw.githubusercontent.com/jgm/typst-hs/main/test/typ/compute/construct-07.typ
typst
Other
// Ref: true #let envelope = symbol( "🖂", ("stamped", "🖃"), ("stamped.pen", "🖆"), ("lightning", "🖄"), ("fly", "🖅"), ) #envelope #envelope.stamped #envelope.pen #envelope.stamped.pen #envelope.lightning #envelope.fly
https://github.com/dark-flames/apollo-typst
https://raw.githubusercontent.com/dark-flames/apollo-typst/main/content/_index.md
markdown
Apache License 2.0
+++ title= "Apollo Theme" template = "homepage.html" +++ Thanks for checking out this theme! Checkout all the [options you can configure](./posts/configuration) and the [example pages](./tags/example/).[Test Typst](./posts/test)
https://github.com/kdog3682/2024-typst
https://raw.githubusercontent.com/kdog3682/2024-typst/main/examples/blue-green-barchart.typ
typst
// #import "@preview/cetz:0.2.0" #let default-style = ( tick-limit: 10, minor-tick-limit: 5, auto-tick-factors: ( 4, 5, 6, 8, 10), // Tick factor to try auto-tick-count: 10, // Number of ticks the plot tries to place fill: none, stroke: black + 0.75pt, // the container bars label: ( offset: .2cm, // Axis label offset anchor: auto, // Axis label anchor ), tick: ( fill: none, length: .1cm, // Tick length: Number minor-length: 80%, // Minor tick length: Number, Ratio minor-offset: 2, // Minor tick length: Number, Ratio minor-stroke: 0.5pt, label: ( offset: .2cm, // Tick label offset angle: 0deg, // Tick label angle anchor: auto, // Tick label anchor ) ), grid: ( stroke: (paint: gray.lighten(50%), thickness: 0.8pt), ), minor-grid: ( stroke: (paint: gray.lighten(50%), thickness: .8pt), ), ) #let margin = 0.5in #set page(margin: 0.5in, paper: "us-letter") #let default-bar-style(idx) = { if calc.even(idx) { return ( fill: blue ) } else { (fill: green) } } #{ cetz.canvas({ import cetz.draw: * import cetz.chart set-style( axes: default-style ) chart.columnchart( value-key: ("value", "value2"), label-key: "label", mode: "clustered", bar-width: 0.5, x-unit: "pt", y-unit: "pt", x-label: [*hi*], bar-style: default-bar-style, size: (auto, 6), //size: (5,5), (( label: "A", value: 12, value2: 16, ), ( label: "A", value: 12, value2: 12, )) ) }) }
https://github.com/yasemitee/Teoria-Informazione-Trasmissione
https://raw.githubusercontent.com/yasemitee/Teoria-Informazione-Trasmissione/main/2023-11-03.typ
typst
#import "@preview/lemmify:0.1.4": * #let ( theorem, lemma, corollary, remark, proposition, example, proof, rules: thm-rules ) = default-theorems("thm-group", lang: "it") #show: thm-rules #show thm-selector("thm-group", subgroup: "proof"): it => block( it, stroke: green + 1pt, inset: 1em, breakable: true ) = Disuguaglianza di Kraft-McMillan == Introduzione Nelle scorse lezioni abbiamo visto prima il codice di Shannon che in media si comporta bene e in seguito i codici di Huffman, che sono i migliori codici istantanei possibili, nel senso che minimizzano il valore atteso della lunghezza media delle parole di codice. D'altro canto abbiamo osservato nella gerarchia dei codici che riducendo l'insieme da cui andiamo a scegliere un codice, spesso guadagniamo una proprietà (ad esempio per i cod. inst. la decodifica istantanea) a discapito di una maggiore lunghezza media delle parole di codice, quindi ci chiediamo se esiste un codice univocamente decodificabile (che perde la proprietà di essere decodificabile istantaneamente) che si comporti meglio del codice di Huffman. Il prossimo risultato mostra invece che il miglior codice univocamente decodificabile non è meglio del codice di Huffman. Prima di procedere, introduciamo l'estensione _k-esima_ di un codice $c:Chi -> D^+$ come $C_k: Chi^k ->D^+$ definita come $ C_k(x_1, dots, x_k) = c(x_1), dots, c(k) $ $ "avente" $ $ l_C_k (x_1, dots, x_k) = l_c(x_1)+ dots +l_c(x_k) $ Chiaramente se $c$ è univocamente decodificabile, la sua estensione _k-esima_ è non singolare per ogni $k >= 1$. == Definizione #theorem(name: "Disuguaglianza di Kraft-McMillan", numbering: none)[ $l_1, dots, l_m in NN$ sono le lunghezze di un codice _D-ario_ univocamente decodificabile per una sorgente di $m$ simboli se e solo se $ sum_(i=1)^m D^(-l_i) <= 1 $ ]<thm> #proof[ Valendo la disuguaglianza di kraft per le lunghezze sappiamo che sono le lunghezze di un codice istantaneo (come abbiamo già dimostrato). Ora dobbiamo dimostrare che se $c:Chi -> D^+$ è univocamente decodificabile allora le sue lunghezze $l_c (x_1), dots, l_c (x_m)$ soddisfano la disuguaglianza di Kraft. Quindi per ogni $k >= 1$ vale che $ (sum_(x in Chi) D^(-l_c (x)))^k = sum_(x_1 in Chi) dots sum_(x_k in Chi) D^(-l_c (x_1)) times dots times D^(-l_c (x_k)) $ $ = sum_((x_1, dots, x_k) in Chi) D^(-l_C_k (x_1,dots, x_k)) $ Ora introduciamo l'insieme $Chi_n ^ k subset.eq Chi^k$ di tutti i messaggi che vengono codificati in parole di codice di lunghezza $n$, così definito $ Chi_n ^ k = {(x_1, dots, x_k) in Chi^k : l_C_k (x_1, dots,x_k) = n} $ Quindi ad esempio per $n = 1$ $ Chi_n ^ k = (x_1, dots, x_k) = 1 $ Possiamo allora scrivere $ sum_((x_1, dots, x_k) in Chi^k) D^-l_C_k (x_1, dots,x_k) = sum_(n = 1)^(k l_max) sum_((x_1, dots, x_k) in Chi_n ^ k) D^(-l_C_k)(x_1, dots, x_k) = sum_(n=1)^(k l_max) |Chi_n ^ k| D^(-n) $ dove $l_max = max( l_c (x_i))$ con $i = 1, dots, m.$ Ora, siccome $c$ è univocamente decodificabile, $C_k$ è non singolare per ogni $k >= 1$. Ciò implica che $Chi_n^k$ non può contenere più elementi di $D^n$, altrimenti verrebbe violata l'ipotesi di iniettività. Quindi $|Chi_n ^k| <= |D^n| = D^n$. Questo ci permette di scrivere $ underbrace((sum_(x in Chi) D^(-l_c)(x))^k, M >= 0) <= sum_(n=1)^(k l_max) |Chi_n ^ k| D^(-n) <= sum_(n=1)^(k l_max) cancel(D^n) cancel(D^(-n)) = k l_max $ $ "può essere riscritta come" M^k <= k l_max $ Quindi la relazione sopra vale per ogni $k >= 1$, se $M > $1 ci sarebbe un $k_0$ tale che per ogni $k >= k_0$ si avrebbe $M^k >= k l_max$. Qundi $M <= 1$ _Graficamente:_ #v(12pt) #figure( image("assets/2023-11-03 dimostrazione-McMillan.svg", width: 55%) ) Quindi dopo $k>=1$ (il momento in cui vale la relazione) se $M^k$ è maggiore di 1 allora ad un certo punto sta sopra $k l_max$ (quindi non va bene), mentre se $M^k$ è compreso tra 0 e 1 allora sta sotto $k l_max$. #v(12pt) ]<proof> Quindi non cambia la situazione prendendo un codice univocamente decodificabile anziché usare un codice istantaneo, di conseguenza è meglio usare un codice istantaneo dato che sono decodificabili istantaneamente.
https://github.com/Treeniks/bachelor-thesis-isabelle-vscode
https://raw.githubusercontent.com/Treeniks/bachelor-thesis-isabelle-vscode/master/chapters/03-related-work.typ
typst
#import "/utils/todo.typ": TODO #import "/utils/isabelle.typ": * = Related Work #vscode was created in 2017 by #cite(<markarius-isabelle-vscode-2017>, form: "prose"). Lacking features like highlighting in output and state panels, #cite(<denis-paluca>, form: "prose") continued the work on #vscode in 2021. Since then, further improvements have been made to #vscode, including the introduction of a custom #utf8isa encoding for VSCode to improve performance. As mentioned in @intro:motivation, <NAME> introduced the unofficial Isabelle fork `isabelle-emacs` #footnote[https://github.com/m-fleury/isabelle-emacs] to support the Emacs text editor, already introducing some of the features we will discuss in this thesis. While Fleury's work focuses primarily on building enough support in the language server for Emacs, this thesis's goal is to make the language server flexible enough to be usable for virtually any code editor that supports the LSP and improve more fundamental usability issues. If the changes introduced in this thesis get merged upstream into the official Isabelle distribution, the changes to the language server introduced by `isabelle-emacs` should become redundant (although the work done for the Emacs language client will not). There are also language server implementations for other theorem provers, like VsCoq #footnote[https://github.com/coq-community/vscoq] for the Coq proof assistant #footnote[https://coq.inria.fr/], as well as `vscode-lean` #footnote[https://github.com/leanprover/vscode-lean4] for the Lean theorem prover #footnote[https://lean-lang.org/] @lean4-system. #cite(<lsp-spec-extension>, form: "prose") explored extensions to the LSP specification to support more types of semantic languages, including theorem provers. With these extensions implemented in both the specification and language clients, it may be possible to update the Isabelle language server to use these new LSP extensions and support other language clients with almost no additional work (i.e. no custom handlers for custom LSP messages).
https://github.com/sitandr/conchord
https://raw.githubusercontent.com/sitandr/conchord/main/tabs/drawing.typ
typst
MIT License
#import "./tabs.typ": draw #let native-scale = scale #import draw: * #let draw-lines(s-num, colors, y, x) = { { on-layer(-2, { for i in range(s-num) { line((0, -(y + i)), (x, -(y + i)), stroke: colors.lines) } }) } } #let draw-bar(s-num, scale-length, colors, x, y, width: 1.0) = { on-layer(-1, line((x, -y + 0.06), (x, -y - s-num + 1 - 0.06), stroke: width * scale-length/0.3cm * 1.1pt + colors.bars) ) } #let draw-column(s-num, colors, x, y) = { circle((x, -y - (s-num - 1)/2 + 1), radius: 0.2, fill: colors.bars, stroke: colors.bars) circle((x, -y - (s-num - 1)/2 - 1), radius: 0.2, fill: colors.bars, stroke: colors.bars) } #let draw-slur(colors, x, y, n-y, last-string-x) = { let y = - (y + n-y - 1) bezier-through( (last-string-x.at(n-y - 1) + 0.3, y - 0.5), ((x + last-string-x.at(n-y - 1)) / 2 + 0.3, y - 1.0), (x + 0.3, y - 0.5), stroke: colors.connects, ) } #let sign(x) = if x > 0 { 1 } else if x == 0 { 0 } else { -1 } #let draw-slide(colors, x, y, n-y, last-string-x, fret, last-tab-x) = { let y = - (y + n-y - 1) let dy = fret.fret - last-tab-x.at(n-y - 1) dy = sign(dy) * 0.2 on-layer(-1, line( (last-string-x.at(n-y - 1) + 0.6, y - dy), (x, y + dy), stroke: colors.connects, )) } #let scale-fret-numbers( scale-length, one-beat-length, colors, fret, duration, alpha ) = { let nlen = str(fret).len() let available = (scale-length/0.3cm) * (one-beat-length/8) * calc.pow(2, -duration) * alpha let given = nlen * 0.09 let size = if given > available { available/given } else {1} native-scale(raw(str(fret)), x: size * 100%, origin: left) } #let draw-bend(colors, x, y, n-y, dx, bend-return, bend-text) = { let alpha = if bend-return {0.4} else {0.8} on-layer(-1, bezier( (x + 0.5, - (y + n-y - 1)), (x+alpha*dx, - (y - 1.2)), (x+alpha*dx*0.8, - (y + n-y - 1)), (x+alpha*dx, - (y + n-y - 1)), stroke: colors.connects, mark: ( length: 0.7, end: (symbol: ">", fill: colors.connects, length: 0.5, angle: 30deg, flex: false)) )) content( (x + alpha*dx, -y + 1.2), raw(str(bend-text)), anchor: "south" ) if bend-return { bezier( (x+alpha*dx, - (y - 1)), (x+0.8*dx, - (y + n-y - 1)), (x+0.64*dx, -y+1), (x+0.8*dx, -y+1), stroke: colors.connects, mark: ( length: 0.7, end: (symbol: ">", fill: colors.connects, length: 0.5, angle: 30deg, flex: false)) ) } } #let draw-vibrato(colors, x, y, n-y, dx) = { let n = int(dx/0.8) let points = for i in range(n) { ((x + 0.8 * i, - (y - 0.9)), (x + 0.15 + 0.8 * i, - (y - 1.05)), (x + 0.3 + 0.8 * i, - (y - 0.9)), (x + 0.45 + 0.8 * i, - (y - 0.7)),) } merge-path( { hobby( ..points, fill: black) hobby( ..points.rev().map(el => (el.at(0) + 0.04, el.at(1) - 0.2)), fill: black) }, stroke: none, fill: colors.connects ) }
https://github.com/smorad/um_cisc_7026
https://raw.githubusercontent.com/smorad/um_cisc_7026/main/syllabus.typ
typst
#align(center)[#text(size: 20pt)[Course Syllabus]] #table( columns: (0.2fr, 0.8fr), [Course], [CISC 7026 Fall 2024], [Time], [19:00-22:00, Mondays], [Location], [Room E6-1102C], [Description], [This course introduces the theory and application of deep neural networks], [Instructor], [ <NAME> \<smorad at um.edu.mo\> ], [Office Hours], [11:00-12:00 Mondays and Tuesdays], [Teaching Assistants], [TBD], [Grading], [ - Assignments: 70% - Quizzes: 20% - Participation: 10% ], [Late Work Policy], [ - -25% 0-1 days late - -50% 1-2 days late - -75% 2-3 days late - -100% 3+ days late ], [Prerequisites], [ - Linear Algebra - Multivariable Calculus - Programming in Python ], [Preliminary Lecture Schedule], [ - Week 1 (08.19): No Lecture (visa issues) - Week 2 (08.26): Introduction to the Course - Week 3 (09.02): Linear Regression (D2L 3.1, 3.6) - Week 4 (09.09): Neural Networks (D2L 5.1, 5.2, 6.1) - Week 5 (09.16): Backpropagation and Optimization (D2L 5.3, 12.1, 12.3-12.5) - Week 6 (09.23): Classification (D2L 4.1, 4.2, 4.4) - Week 7 (09.23): Training Tricks (D2L 5.1-5.5, 6.1-6.3, 12.1-12.10) - Week 8 (09.30): Convolutional Neural Networks (D2L 7) - Week 9 (10.14): Recurrent Neural Networks (D2L 9-10) - Week 10 (10.21): Graph Neural Networks - Week 11 (10.07): Autoencoders and Generative Models - Week 12 (10.28): Attention and Transformers (D2L 11.1-11.7) - Week 13 (11.04): Foundation Models (D2L 11.8-11.9) - Week 14 (11.11): Reinforcement Learning (D2L 17) ], [Preliminary Assignment Schedule], [ - Week 3-4 (09.02 - 09.09): Linear Regression - Week 4-6 (09.09 - 09.23): Neural Networks and Backpropagation - Week 6-8 (09.23 - 10.07): MLP Regression - Week 8-10 (10.07 - 10.21): Convolutional MNIST Classification - Week 10-12 (10.21 - 11.04): LSTM Weather Prediction - Week 12-14 (11.04 - 11.18): Transformer IMDB Sentiment Analysis ] )
https://github.com/jgm/typst-hs
https://raw.githubusercontent.com/jgm/typst-hs/main/test/typ/math/accent-04.typ
typst
Other
// Test wide base. $arrow("ABC" + d), tilde(sum)$
https://github.com/buxx/cv
https://raw.githubusercontent.com/buxx/cv/master/modules/projects.typ
typst
#import "../brilliant-CV/template.typ": * #import "../src/utils.typ": * #cvSection("Réalisations", highlighted: true, letters: 3) #cvEntry( title: [Logiciels métiers], society: [], date: [], location: [], description: list( [ #img("plug") Logiciel de mesure scientifique embarqué #text(style: "italic", " 2016→2024") ], [ #img("oss") #img("cloud") - Tracim - Plateforme de travail collaboratif #text(style: "italic", "tracim.fr") #text(style: "italic", " 2015→2018") ] ), tags: ("Architecture", "Python", "Pyramid", "API HTTP", "PostgreSQL", "MySQL", "SQlite", "React", "Redis", "Pushpin", "aiohttp", "TypeScript", "Angular", "Architecture orientée services", "QA", "Intégration continue", "Haute performance", "Gitlab-ci", "Jenkins", "Packaging", "Docker", "Ansible", "Cypress") ) #cvEntry( title: [Jeux Vidéos], society: [], date: [], location: [], description: list( [ #img("oss") #img("helmet_military") Open Combat : Jeu de tactique temps réel - #text(style: "italic", "opencombat.bux.fr") #text(style: "italic", " 2017→2024") ], [ #img("oss") #img("dice") Rolling : Jeu multijoueur dans un monde ouvert et persistant - #text(style: "italic", "rolling.bux.fr") #text(style: "italic", " 2019→2023") ] ), tags: ("Architecture", "Rust", "ggez", "Puffin", "Intelligence artificielle", "Python", "PostgreSQL", "API HTTP", "2D", "Macroquad", "WebAssembly") ) #cvEntry( title: [Divers], society: [], date: [], location: [], description: list( [ #img("oss") #img("music") - Muzi.ch - Site web de partage de découvertes musicales #text(style: "italic", "muzi.ch") #text(style: "italic", " 2011→2024") ], [ #img("tv") Mangas-tv.com - Plateforme de streaming #text(style: "italic", "web.archive.org/web/*/mangas-tv.com") #text(style: "italic", " 2007→2018") ], [ #img("oss") #img("ant") Synergine - Système multi-agent - #text(style: "italic", "github.com/buxx/synergine2") #text(style: "italic", " 2016→2017") ], [ #img("oss") #img("cloud")#img("arrows")#img("disk") TrSync - Synchronisation cloud/disque - #text(style: "italic", "github.com/buxx/trsync") #text(style: "italic", " 2021→2024") ] ), tags: ("Architecture", "Conception", "Développement", "Rust", "PHP", "Symfony", "MySQL", "SQLite", "Infrastructure", "Administration système.", "GNU/Linux", "Gestion d'équipe", "parallélisation", "egui", "Behavior Driven Development", "Packaging") )
https://github.com/Skimmeroni/Appunti
https://raw.githubusercontent.com/Skimmeroni/Appunti/main/C++/Introduzione/Doxygen.typ
typst
Creative Commons Zero v1.0 Universal
#import "@preview/showybox:2.0.1": showybox *Doxygen* é uno strumento che permette di generare documentazione del codice C++ in maniera automatica a partire da dei commenti propriamente formattati. Tali commenti é best practise riportarli nei file header in cui sono riportate le firme dei metodi. Doxygen riconosce un commento speciale tipo perché é un commento multilinea che inizia con un doppio asterisco: ``` /** Comment to be generated goes here... */ ``` Doxygen formatta la documentazione per mezzo di _direttive_, parole chiave che iniziano con `@`. Una prima direttiva che é bene porre é `@brief`, con cui viene specificata una descrizione sommaria (lunga una sola riga) della funzione e del suo significato. Un commento piú descrittivo puó essere riportato lasciando una riga vuota. ``` /** @brief brief description goes here... longer description goes here... */ ``` La direttiva `@param` permette di descrivere un parametro di una funzione; una direttiva `@param` va riportata per ogni parametro della funzione. La direttiva `@return` descrive il valore di ritorno della funzione. ``` /** @param first parameter is this... and does that... @param second parameter is this... and does that... @param nth parameter is this... and does that... @return return value is this... and does that... */ ``` #showybox[ ``` /** @brief Computes the Euclidean distance Computes the Euclidean distance between two points @param x1 the x-coordinate of the first point @param x2 the x-coordinate of the second point @param y1 the y-coordinate of the first point @param y2 the y-coordinate of the second point @return the Euclidean distance */ float euclidean_distance(float x1, float x2, float y1, float y2); ``` ]
https://github.com/Myriad-Dreamin/typst.ts
https://raw.githubusercontent.com/Myriad-Dreamin/typst.ts/main/fuzzers/corpora/layout/clip_03.typ
typst
Apache License 2.0
#import "/contrib/templates/std-tests/preset.typ": * #show: test-page // Test block clipping over multiple pages. #set page(height: 60pt) First! #block(height: 4em, clip: true, stroke: 1pt + black)[ But, soft! what light through yonder window breaks? It is the east, and Juliet is the sun. ]
https://github.com/PuntitOwO/template-informe-practica-fcfm
https://raw.githubusercontent.com/PuntitOwO/template-informe-practica-fcfm/main/example.typ
typst
MIT License
#import "conf.typ": conf, guia, pronombre #let mostrar_guias = true #show: conf.with( titulo: "El Título de mi práctica", autor: (nombre: "<NAME>", pronombre: pronombre.elle), supervisor: (nombre: "<NAME>", pronombre: pronombre.ella), espaciado_titulo: 2fr, ) #guia(visible: mostrar_guias)[Se debe quitar todas las guías (estas cajas grises) antes de entregar el documento. Para ello, se debe cambiar el valor de la variable `mostrar_guias` a `false` en la segunda línea del archivo. Además, hay que reemplazar los datos de la portada en los parámetros de la función `conf` en la línea 3 del archivo. Los parámetros que acepta la función `conf` son: - título: El título de la práctica. - autor: Un diccionario con campos `nombre` y `pronombre`. Para los pronombres, importar el diccionario `pronombre` desde `conf.typ`. Los valores disponibles son `pronombre.el`, `pronombre.ella` y `pronombre.elle`. - practica: 1 o 2 dependiendo de si es la primera o segunda práctica profesional. - codigo: CC4901 para práctica I, CC5901 para práctica II. - ingenieria: Nombre de la carrera. - correo: Correo de autor. - telefono: Número de teléfono del autor. - periodo: Período en que se realizó la práctica. Por ejemplo: 'Diciembre 2022 - Enero 2023'. - empresa: Nombre de la empresa. - supervisor: Información del supervisor. Es un diccionario con campos `nombre` y `pronombre`. - correo-supervisor: Correo de supervisor. - telefono-supervisor: Número de teléfono del supervisor. - fecha: Fecha de entrega. Si no se especifica, se usa la fecha actual. - espaciado_titulo: Espaciado extra antes del título y al rededor de autor. Por defecto es `1fr`. Se puede usar `2fr` para un espaciado doble, `3fr` para un espaciado triple, etc. Como aproximación, se espera que el informe tenga de 8 a 14 páginas. En las guías de cada sección se mostrará la información de las páginas sugeridas. No olvidar que es una sugerencia. Se recomienda que el reporte de actividades se redacte en tercera persona. ] = Resumen #guia(visible: mostrar_guias)[En el resumen deben enunciarse los temas principales trabajados, problema, solución, reflexión y conclusiones sobre la realización de la práctica. El resumen debe contener lo esencial de cada sección del informe. (extensión sugerida: 0.5 páginas)] = Introducción #guia(visible: mostrar_guias)[Parte inicial de un texto en donde se informa acerca del contenido del informe. - Se contextualiza al lector con los antecedentes generales acerca del trabajo de práctica realizado, y que será descrito en los otros capítulos del informe - Se señala en qué empresa u organización realizaron las labores (se incluyen datos que no requieren de resguardo de confidencialidad por parte del/la estudiante). (extensión sugerida: 1 página)] = Descripción del problema #guia(visible: mostrar_guias)[Requerimiento o necesidad a resolver durante el trabajo de práctica: - Describir el problema específico (u oportunidad desaprovechada), y las consecuencias de éste para la empresa u organización. - Explicar qué tan crítico y urgente era para la organización resolver dicho problema. - Además, se deben plantear los desafíos técnicos y organizacionales que representó la labor desarrollada para resolver dicho problema o necesidad. (extensión sugerida: 0.5 a 1 página) ] = Objetivos #guia(visible: mostrar_guias)[Determinar el objetivo general y los objetivos específicos de la práctica; para ello es preciso considerar lo siguiente: - El objetivo es una declaración sobre una meta o propósito a cumplir. - Se debe plantear un objetivo general y los objetivos específicos de cada práctica. Estos se enuncian en infinitivo: por ejemplo, analizar, describir, aplicar. Es preciso señalar que los objetivos no son tareas a desarrollar. Cada objetivo específico aporta al logro del objetivo general. (No hay que poner texto acá. Se puede empezar directamente con el objetivo general.) (extensión sugerida: 0.5 páginas)] == Objetivo General #guia(visible: mostrar_guias)[ Un _resumen conciso_ (no más de un párrafo) de la meta principal del trabajo, es decir, qué quieres lograr con el trabajo (o qué significa \"éxito\" en el contexto del trabajo). El objetivo debería ser específico, medible, alcanzable, relevante al problema, y acotado en tiempo. ('Hacer la práctica' no es una repuesta válida. :\))] == Objetivos Específicos #guia(visible: mostrar_guias)[ Una _lista_ de los hitos principales que se quieren lograr para (intentar) cumplir con el objetivo general. Divide el objetivo general en varios hitos que formarán las etapas del trabajo. Cada objetivo debería ser específico, medible, alcanzable, relevante al problema, y acotado en tiempo. No se debería escribir más de un párrafo por hito. Los objetivos específicos deberían \"sumar\" al objetivo general.] + ... + ... = Metodología #guia(visible: mostrar_guias)[ Describir la metodología: - Se deben describir los pasos/etapas seguidos en el trabajo encomendado (tareas a realizar y su secuencia). - Explicar si la metodología fue dada al/la estudiante por su supervisor/a o jefe directo o fue una propuesta propia (justificar). - Explicar si la metodología fue la apropiada para alcanzar los objetivos planteados. - Explicar cómo se puede evaluar la calidad del resultado obtenido en esta práctica. (extensión sugerida: 0.5 a 1 página)] = Descripción de la Solución #guia(visible: mostrar_guias)[Describir la solución obtenida, en términos de su diseño (si es un producto) y/o en términos de los resultados obtenidos (si es un estudio). Presentar la solución señalando sus fundamentos teórico-técnico. - Describir la estructura de la solución (estructura macro). - Describir los componentes de la solución (estructura detallada). - Describir el comportamiento de la solución (dinámica), cuando corresponda. - Indicar qué tecnologías se utilizaron y justificar su elección. - Describir los resultados intermedios y finales obtenidos. - Indicar las fortalezas y debilidades de la solución. (extensión sugerida: 3 a 5 páginas)] = Reflexión #guia(visible: mostrar_guias)[ - Describir los obstáculos encontrados, cómo fue el proceso y período de práctica y qué cambios no previstos ocurrieron. - Describir el proceso de inserción en la empresa y la interacción que pudo alcanzar con el equipo. - Explicar si fue proactivo en la realización de las tareas asignadas en el lugar de práctica y de si fue puntual en su asistencia al lugar de trabajo. - Mencionar si enfrentó algún dilema ético, describiendo la situación y cómo se resolvió. - Indicar y explicar qué cursos de la carrera fueron un aporte al momento de realizar la práctica, y cómo estos le ayudaron. - Dar argumentos acerca de qué habilidades o conocimientos le faltaron para desempeñarse de manera adecuada en la práctica. Asimismo, explicar qué aspectos del ambiente laboral ayudaron (favorecieron) para compensar las debilidades que como practicante traía. - Describir los nuevos conocimientos adquiridos en la práctica profesional. *_Se solicita que este apartado pueda señalar su autopercepción del desempeño y las habilidades profesionales que implemento, tales como la ética, la comunicación oral y escrita, trabajo en equipo, entre otras. Respondiendo preguntas tales como_*: ¿qué aspecto de tu actuar en relación con el respeto y la responsabilidad, durante la experiencia de práctica destacarías? ¿En qué sentido su compromiso ético se vio fortalecido a partir de la experiencia de la práctica? ¿Cuáles son los principales desafíos que te planteas para el futuro en relación con lo técnico y personal? (extensión sugerida: 1 a 3 páginas)] = Conclusiones #guia(visible: mostrar_guias)[ En esta sección se deberá retomar y confirmar de manera sintética los aspectos centrales de la práctica profesional, y dar un cierre a lo expuesto en el informe; se incluye: - Determinar si se lograron los objetivos planteados. - Plantear aspectos de mejora a su desempeño y a la solución creada (proyección). (extensión sugerida: 0.5 a 1 página)] = Anexos #guia(visible: mostrar_guias)[ En esta sección se puede incluir material de adicional de apoyo al informe, por ejemplo, capturas de pantalla, código fuente, o la descripción de casos de uso. Este acápite es optativo. ] @CorlessJK97 @NewmanT42 #bibliography("bibliografia.yml", title: "Referencias")
https://github.com/7sDream/fonts-and-layout-zhCN
https://raw.githubusercontent.com/7sDream/fonts-and-layout-zhCN/master/pdf.typ
typst
Other
#import "@preview/book:0.2.5": _convert-summary #import "/template/template.typ": template #import "/template/consts.typ" #import "/template/util.typ" #set document( title: consts.title, author: (consts.author, ..consts.translators), ) #if not util.is-pdf-target() { panic("To compile this file, you need provide `realpdf=1` input argument") } #import "book.typ": summary #show: template #include "cover.typ" #include "outline.typ" #let flatten-chapter(chapter) = { let result = if chapter.section == none { () } else { (chapter.link,) } let children = chapter.at("sub", default: none) if children == none { return result } for section in children { if section.kind == "chapter" { result = (..result, ..flatten-chapter(section)) } } return result } #let flatten-summary = summary => { summary.map(chapter => if chapter.kind == "chapter" { flatten-chapter(chapter) } else { () }).flatten() } #{ for file in flatten-summary(_convert-summary(summary)) { include file } } #pagebreak(weak: true) #set text(lang: "en") #set par(justify: false) #bibliography("/refs.bib", title: [参考文献])
https://github.com/typst-community/guidelines
https://raw.githubusercontent.com/typst-community/guidelines/main/src/chapters/style/sugar.typ
typst
Creative Commons Attribution Share Alike 4.0 International
#import "/src/util.typ": * #import mantys: * = Syntax Sugar Prefer syntax sugar only for simple markup related tasks. TODO