repo
stringlengths
26
115
file
stringlengths
54
212
language
stringclasses
2 values
license
stringclasses
16 values
content
stringlengths
19
1.07M
https://github.com/jgm/typst-hs
https://raw.githubusercontent.com/jgm/typst-hs/main/test/typ/visualize/shape-square-03.typ
typst
Other
// Test text overflowing height. #set page(width: 75pt, height: 100pt) #square(fill: green)[ But, soft! what light through yonder window breaks? ]
https://github.com/yamoling/ulb-template-typst
https://raw.githubusercontent.com/yamoling/ulb-template-typst/main/README.md
markdown
# ULB Typst template This is a template for Universsité Libre de Bruxelles (ULB). Feel free to use and modify. ![](screenshot.png)
https://github.com/avonmoll/ifacconf-typst
https://raw.githubusercontent.com/avonmoll/ifacconf-typst/main/template/main.typ
typst
MIT No Attribution
//============================================================================== // main.typ 2023-11-17 <NAME> // Template for IFAC meeting papers // // Adapted from ifacconf.tex by <NAME> //============================================================================== #import "@preview/abiding-ifacconf:0.1.0": * #show: ifacconf-rules #show: ifacconf.with( title: "Style for IFAC Conferences & Symposia: Use Title Case for Paper Title", authors: ( ( name: "<NAME>", email: "<EMAIL>", affiliation: 1, ), ( name: "<NAME>.", email: "<EMAIL>", affiliation: 2, ), ( name: "<NAME>", email: "<EMAIL>", affiliation: 3, ), ), affiliations: ( ( organization: "National Institute of Standards and Technology", address: "Boulder, CO 80305 USA", ), ( organization: "Colorado State University", address: "Fort Collins, CO 80523 USA", ), ( department: "Electrical Engineering Department", organization: "Seoul National University", address: "Seoul, Korea", ), ), abstract: [ These instructions give you guidelines for preparing papers for IFAC technical meetings. Please use this document as a template to prepare your manuscript. For submission guidelines, follow instructions on paper submission system as well as the event website. ], keywords: ("Five to ten keywords", "preferably chosen from the IFAC keyword list."), sponsor: [ Sponsor and financial support acknowledgment goes here. Paper titles should be written in uppercase and lowercase letters, not all uppercase. ], ) = Introduction This document is a template for Typst. Running the command `typst init @preview/abiding-ifacconf` will generate the files needed to get started.. The template files are also available on github at #link("https://github.com/avonmoll/ifac-typst")[`https://github.com/avonmoll/ifacconf-typst`]. Please stick to the format defined by the `ifacconf` function, and do not change the margins or the general layout of the paper. It is especially important that you do not put any running header/footer or page number in the submitted paper.#footnote[This is the default for the provided class file.] Use _italics_ for emphasis; do not underline. Page limits may vary from conference to conference. Please observe the page limits of the event for which your paper is intended. = Procedure for Paper Submission Next we see a few subsections. == Review Stage For submission guidelines, follow instructions on paper submission system as well as the event website. Note that conferences impose strict page limits, so it will be better for you to prepare your initial submission in the camera ready layout so that you will have a good estimate for the paper length. Additionally, the effort required for final submission will be minimal. == Equations Some words might be appropriate describing equation @sample, if we had but time and space enough. $ (diff F) / (diff t) = D (diff^2 F) / (diff x^2) $ <sample> See @Abl56 @AbTaRu54 @Keo58, and @Pow85. === Example. This equation goes far beyond the celebrated theorem ascribed to the great Pythagoras by his followers. #theorem[ The square of the length of the hypotenuse of a right triangle equals the sum of the squares of the lengths of the other two sides. ] #proof[ The square of the length of the hypotenuse of a right triangle equals the sum of the squares of the lengths of the other two sides. ] // There are a number of predefined theorem-like environments in // template.typ: // // #theorem[ ... ] // Theorem // #lemma[ ... ] // Lemma // #claim[ ... ] // Claim // #conjecture[ ... ] // Conjecture // #corollary[ ... ] // Corollary // #fact[ ... ] // Fact // #hypothesis[ ... ] // Hypothesis // #proposition[ ... ] // Proposition // #criterion[ ... ] // Criterion == Figures To insert figures, use the `#figure` function. See @bifurcation for an example which was generated by the following code. ``` #figure( image("bifurcation.jpg", width: 8.4cm) caption: [Bifurcation: ...] ) <bifurcation> ``` #figure( // image("bifurcation.jpg", width: 8.4cm), rect(width: 8.4cm, height: 6.3cm), // bifurcation.jpg excluded intentionally to save space caption: [Bifurcation: Plot of local maxima of $x$ with damping $a$ decreasing], placement: auto ) <bifurcation> Figures must be centered, and have a caption at the bottom. == Tables Tables must be centered and have a caption above them, numbered with Arabic numerals. See @margins for an example. #tablefig( table( columns: 4, align: center + horizon, stroke: none, inset: 3pt, [Page], [Top], [Bottom], [Left/Right], table.hline(), [First], [3.5], [2.5], [1.5], [Rest], [2.5], [2.5], [1.5], table.hline(), ), caption: [Margin settings], ) <margins> == Final Stage Authors are expected to mind the margins diligently. Papers need to be stamped with event data and paginated for inclusion in the proceedings. If your manuscript bleeds into margins, you will be required to resubmit and delay the proceedings preparation in the process. === Page margins. See @margins for the page margins specification. All dimensions are in _centimeters_. == PDF Creation All fonts must be embedded/subsetted in the PDF file. This is handled by Typst. == Copyright Form IFAC will put in place an electronic copyright transfer system in due course. Please _do not_ send copyright forms by mail or fax. More information on this will be made available on IFAC website. = Units Use SI as primary units. Other units may be used as secondary units (in parentheses). This applies to papers in data storage. For example, write "$15" Gb/cm"^2$ ($100" Gb/in"^2$)". An exception is when English units are used as identifiers in trade, such as "3.5 in disk drive". Avoid combining SI and other units, such as current in amperes and magnetic field in oersteds. This often leads to confusion because equations do not balance dimensionally. If you must use mixed units, clearly state the units for each quantity in an equation. The SI unit for magnetic field strength $bold(upright(H))$ is $"A/m"$. However, if you wish to use units of T, either refer to magnetic flux density $bold(upright(B))$ or magnetic field strength symbolized as $mu_0 bold(upright(H))$. Use the center dot to separate compound units, e.g., "$upright(A) dot.c upright(m)^2$". = Helpful Hints == Figures and Tables Figure axis labels are often a source of confusion. Use words rather than symbols. As an example, write the quantity "Magnetization", or "Magnetization M", not just "M". Put units in parentheses. Do not label axes only with units. For example, write "Magnetization ($upright(A)$/$upright(m)$)" or "Magnetization ($upright(A)upright(m)^(-1)$)", not just "$upright(A)$/$upright(m)$". Do not label axes with a ratio of quantities and units. For example, write "Temperature ($upright(K)$)", not "$"Temperature"$/$upright(K)$". Multipliers can be especially confusing. Write "Magnetization ($"kA"/upright(m)$)" or "Magnetization ($10^3 upright(A)$/$upright(m)$)''. Do not write "Magnetization $(upright(A)$/$upright(m)) times 1000$" because the reader would not know whether the axis label means $16000 med upright(A)$/$upright(m)$ or $0.016 med upright(A)$/$upright(m)$. == References Use Harvard style references (see at the end of this document). With Typst, you can process an external bibliography database in the BibTeX format (`.bib`) or Hayagriva (a Rust-based bibliography management system based on YAML) formats. Footnotes should be avoided as far as possible. Please note that the references at the end of this document are in the preferred referencing style. Papers that have not been published should be cited as "unpublished". Capitalize only the first word in a paper title, except for proper nouns and element symbols. == Abbreviations and Acronyms Define abbreviations and acronyms the first time they are used in the text, even after they have already been defined in the abstract. Abbreviations such as IFAC, SI, ac, and dc do not have to be defined. Abbreviations that incorporate periods should not have spaces: write "C.N.R.S.", not "C. N. R. S." Do not use abbreviations in the title unless they are unavoidable (for example, "IFAC" in the title of this article). == Equations Number equations consecutively with equation numbers in parentheses flush with the right margin, as in @sample. To make your equations more compact, you may use the solidus (/), the $exp$ function, or appropriate exponents. Use parentheses to avoid ambiguities in denominators. Punctuate equations when they are part of a sentence, as in $ integral_0^(r_2) & F(r, phi.alt) upright(d)r upright(d) phi.alt = [sigma r_2 \/ (2 mu_0)] \ & dot.c integral_0^"inf" exp(- lambda |z_j - z_i|) lambda^(-1) J_1 (lambda r_2) J_0 (lambda r_i) upright(d) lambda $ <sample2> Be sure that the symbols in your equation have been defined before the equation appears or immediately following. Italicize symbols ($T$ might refer to temperature, but T is the unit tesla). Refer to "@sample", not "Eq. @sample" or "equation @sample", except at the beginning of a sentence: "Equation @sample is ...". == Other Recommendations Use one space after periods and colons. Hyphenate complex modifiers: "zero-field-cooled magnetization". Avoid dangling participles, such as, "Using (1), the potential was calculated" (it is not clear who or what used (1)). Write instead: "The potential was calculated by using (1)", or "Using (1), we calculated the potential". A parenthetical statement at the end of a sentence is punctuated outside of the closing parenthesis (like this). (A parenthetical sentence is punctuated within the parentheses.) Avoid contractions; for example, write "do not" instead of "don't". The serial comma is preferred: "A, B, and C" instead of "A, B and C". = Conclusion A conclusion section is not required. Although a conclusion may review the main points of the paper, do not replicate the abstract as the conclusion. A conclusion might elaborate on the importance of the work or suggest applications and extensions. = Acknowledgments Place acknowledgments here. // Display bibliography. #bibliography("refs.bib") #appendix[Summary of Latin Grammar] #appendix[Some Latin Vocabulary]
https://github.com/TypstApp-team/typst
https://raw.githubusercontent.com/TypstApp-team/typst/master/tests/typ/math/cases.typ
typst
Apache License 2.0
// Test case distinction. --- $ f(x, y) := cases( 1 quad &"if" (x dot y)/2 <= 0, 2 &"if" x divides 2, 3 &"if" x in NN, 4 &"else", ) $
https://github.com/typst/packages
https://raw.githubusercontent.com/typst/packages/main/packages/preview/numberingx/0.0.1/README.md
markdown
Apache License 2.0
# numberingx _Extended numbering patterns using the [CSS Counter Styles] specification, along with a number of [Ready-made Counter Styles]._ ## Usage ```ts // numberingx is expected to be imported with the syntax creating a named module #import "@preview/numberingx:0.0.1" // Use full-width roman numerals for titles, and lowercase ukrainian letters #set heading(numbering: numberingx.formatter( "{fullwidth-upper-roman}.{fullwidth-lower-roman}.{lower-ukrainian}" )) ``` ### Patterns numberingx's patterns are similiar to typst's [numbering patterns] and use the same notion of fragments with a prefix and a final suffix. The main difference is that it doesn't use special characters and all numbering styles must be written within braces. To insert a literal brace, you can double it. A list of patterns can be found in the [Ready-made Counter Styles] document. Additionally, numberingx allows typst's numbering characters to be used in patterns. This way, `"{upper-roman}.{decimal})"` can be shortened to `"{I}.{1})"`. ### API numberingx exposes two functions, `format`and `formatter`. #### `format(fmt, styles: (:), ..nums)` This function uses the same api as typst's `numbering()` and takes the pattern string as its first positional argument, and numbers as trailing arguments. An optional `styles` argument allows for [user-defined styles](#user-defined-styles). #### `formatter(fmt, styles: (:))` This function is little more than a shorter version of `format.with(..)`. It takes a pattern string and an optional `styles` argument, and return the matching numbering functions. This is mainly intended to be used for `#set` rules. ## User-defined styles Custom styles can be defined according to the [CSS Counter Styles] spec and passed through a `styles` named argument to `format` and `formatter`. It must be a dictionary mapping style names to style descriptions. Note that the `prefix`, `suffix`, `pad`, and `speak-as` descriptors are not supported, nor is the `extends` system. ## License This repository is licensed under [MIT-0], which is the closest I'm legally allowed to public domain while being OSI approved. [CSS Counter Styles]: https://www.w3.org/TR/css-counter-styles-3/ [Ready-made Counter Styles]: https://www.w3.org/TR/predefined-counter-styles/ [numbering patterns]: https://typst.app/docs/reference/meta/numbering/ [MIT-0]: https://spdx.org/licenses/MIT-0.html
https://github.com/QuadnucYard/crossregex-typ
https://raw.githubusercontent.com/QuadnucYard/crossregex-typ/main/src/layout.typ
typst
MIT License
#import "regex.typ": regex-match #let centered(body) = { context { let size = measure(body) move(dx: -size.width / 2, dy: -size.height / 2, body) } } #let build-char-box(width, height, cell-config, alphabet) = { ch => { set text( ..cell-config.text-style, fill: if ch.match(alphabet) != none { cell-config.valid-color } else { cell-config.invalid-color }, ) ch } } #let build-decoration(positioner, height, deco-config, alphabet) = { let hint-marker = if deco-config.hint-marker == auto { r => circle( radius: 0.2em, fill: if r == none { yellow } else if r { green } else { red }, ) } else { deco-config.hint-marker } let regex-box = if deco-config.regex-style == auto { box.with(fill: gray.transparentize(90%), outset: (x: 0.1em, y: 0.2em), radius: 0.2em) } else { deco-config.regex-style } (constraints, a) => { show raw.where(block: false): regex-box for (i, cons) in constraints.enumerate() { let check-result = if regex-match("^" + cons + "$", a.at(i)) { if a.at(i).clusters().all(x => x.match(alphabet) != none) { true } else { none } } else { false } let (x, y) = positioner(i) if hint-marker != none { place( dx: x + deco-config.hint-offset, dy: y, centered(hint-marker(check-result)), ) } // place constraint expressions place( dx: x + deco-config.regex-offset, dy: y - height * 0.5, box(height: height, align(horizon, raw(cons, lang: "re"))), ) } } } #let build-layout( angle: none, rows: none, row-len: none, cell: none, cell-size: none, cell-config: none, alphabet: none, cell-pos: none, char-box-size: none, deco-pos: none, deco-config: none, center: none, num-views: none, view-size: none, whole-size: none, whole-grid-offset: (0em, 0em), ) = { let cell-config = ( text-style: (:), valid-color: blue, invalid-color: purple, ) + cell-config let deco-config = ( hint-offset: 0.5em, hint-marker: auto, regex-offset: 1.0em, regex-style: auto, ) + deco-config let large-shape = for i in range(rows) { for j in range(row-len(i)) { let (x, y) = cell-pos(i, j) place(dx: x, dy: y, centered(cell)) } } let make-decorates = build-decoration(deco-pos, cell-size, deco-config, alphabet) let char-box = build-char-box(..char-box-size, cell-config, alphabet) let make-grid(a) = { large-shape // place cell texts for i in range(rows) { for j in range(row-len(i)) { let (x, y) = cell-pos(i, j) place(dx: x, dy: y, centered(char-box(a.at(i).at(j)))) } } } let puzzle-view(constraints, a) = { let (w, h) = view-size show: block.with(width: w, height: h) make-grid(a) place(dx: center.x, dy: center.y, make-decorates(constraints, a)) } let puzzle-whole(constraints, aa) = { let (w, h) = whole-size show: block.with(width: w, height: h) let (dx, dy) = whole-grid-offset show: move.with(dx: dx, dy: dy) make-grid(aa.at(0)) for i in range(num-views) { place( dx: center.x, dy: center.y, rotate(i * angle, make-decorates(constraints.at(i), aa.at(i))), ) } } (puzzle-whole: puzzle-whole, puzzle-view: puzzle-view) } /// Compose pages #let doc-layout(whole-maker: none, view-maker: none, num-views: none, progress: none, margin: 0.5em) = { if whole-maker != none { set page(height: auto, width: auto, margin: margin) let pw = whole-maker() set block(spacing: 0.5em) pw progress pagebreak(weak: true) } if view-maker != none { set page(height: auto, width: auto, margin: margin) for k in range(num-views) { let pv = view-maker(k) set block(spacing: 0.5em) pv progress pagebreak(weak: true) } } }
https://github.com/csimide/SEU-Typst-Template
https://raw.githubusercontent.com/csimide/SEU-Typst-Template/master/init-files/degree_thesis.typ
typst
MIT License
#import "../seu-thesis/lib.typ": degree-conf, degree-utils #let (thanks, show-appendix) = degree-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")), ) #let terminology = [ 如果有必要可以设置此注释表。此部分内容可根据论文中采用的符号、变量、缩略词等专用术语加以定义和注释,以便于论文阅读和迅速查出某符号的明确含义。 术语表建议使用 ```typ #let``` 语句另行定义,再通过参数传入模板。 一般来说,请用 ```typ #table``` 绘制表格。如果想让术语表也有编号,可以使用 ```typ #figure```。 `table` 的用法请见 Typst 文档。 #figure( table( columns: (1fr, 1fr), align: center + horizon, rows: auto, inset: 8pt, stroke: none, //auto-vlines: false, table.hline(), table.header[*符号、变量、缩略词等*][*含义*], table.hline(stroke: 0.5pt), [SEU],table.vline(stroke: 0.5pt), [东南大学], table.hline(stroke: 0.5pt), [Typst],[Typst is a new markup-based typesetting system for the sciences.], table.hline(), ), kind: table, caption: [本论文专用术语(符号、变量、缩略词等)的注释表] ) #h(2em)当 `terminology` 为 `none` 时,此注释表页面不会被渲染。 ] #show: doc => degree-conf( author: (CN: "王东南", EN: "<NAME>", ID: "012345"), thesis-name: ( CN: "摸鱼学硕士学位论文", EN: [ A Thesis submitted to \ Southeast University \ For the Academic Degree of Master of Touching Fish ], heading: "东南大学硕士学位论文" ), title: ( CN: "摸鱼背景下的Typst模板使用研究", EN: "A Study of the Use of the Typst Template During Touching Fish" ), advisors: ( (CN: "湖牌桥", EN:"HU Pai-qiao", CN-title: "教授", EN-title: "Prof."), (CN: "苏锡浦", EN:"SU Xi-pu", CN-title: "副教授", EN-title: "Associate Prof.") ), school: ( CN: "摸鱼学院", EN: "School of Touchingfish" ), major: ( main: "摸鱼科学", submajor: "计算机摸鱼" ), degree: "摸鱼学硕士", category-number: "N94", secret-level: "公开", UDC: "303", school-number: "10286", committee-chair: "张三 教授", readers: ( "李四 副教授", "王五 副教授" ), date: ( CN: ( defend-date: "2099年01月02日", authorize-date: "2099年01月03日", finish-date: "2024年01月15日" ), EN: ( finish-date: "Jan 15, 2024" ) ), thanks: "本论文受到摸鱼基金委的基金赞助(123456)", degree-form: "应用研究", cn-abstract: [ 论文摘要包括题名、硕士(博士)研究生姓名、导师姓名、学校名称、正文、关键词中文约 500 字左右,英文约 200~300 词左右,二者应基本对应。它是论文内容的高度概括,应说明研究目的、研究方法、成果和结论,要突出本论文的创造性成果或新的见解,用语简洁、准确。论文摘要后还应注明本文的关键词 3 至 5 个。关键词应为公知公用的词和学术术语,不可采用自造字词和略写、符号等,词组不宜过长。 ], cn-keywords: ("关键词1", "关键词2"), en-abstract: [ 英文摘要采用第三人称单数语气介绍该学位论文内容,目的是便于其他文摘摘录,因此在写作英文文摘时不宜用第一人称的语气陈述。叙述的基本时态为一般现在时,确实需要强调过去的事情或者已经完成的行为才使用过去时、完成时等其他时态。可以采用被动语态,但要避免出现用“This paper”作为主语代替作者完成某些研究行为。中国姓名译为英文时用汉语拼音,按照姓前名后的原则,姓、名均用全名,不宜用缩写。姓全用大写,名的第一个字母大写,名为双中文字时两个字的拼音之间可以不用短划线,但容易引起歧义时必须用短划线。例如“冯长根”译为“FENG Changgen”或“FENG Chang-gen”,而“冯长安”则必须译为“FENG Chang-an”。论文英文封面上的署名也遵守此规定。 #lorem(100) ], en-keywords: ("Keywords1", "Keywords2"), always-start-odd: true, terminology: terminology, anonymous: false, // 选项暂时无用,未来用于渲染盲审版本 first-level-title-page-disable-heading: false, // 一级标题页不显示页眉 // 启用此选项后,“第X章 XXXXX” 一级标题所在页面将不显示页眉 bilingual-bib: true, doc, ) = 封面、扉页、摘要说明 模板的封面、扉页、摘要内容都是在参数中传入的。使用方法请参考本 Demo 文档。 封面的部分横线长度可能不合适,请在 https://github.com/csimide/SEU-Typst-Template/issues 提交反馈以便修改。 若摘要等过长,也可以先行定义摘要变量,再将其作为参数传入。 = 正文内容说明 正文是学位论文的主体。内容可因研究课题的性质不同而有所变化。一般可包括:文献综述、理论基础、计算方法、实验方法、经过整理加工的实验结果的分析讨论、见解和结论。正文一律用阿拉伯数字编排页码,页码在底部居中。正文之前的摘要、目录等内容单独编排罗马数字页码。 == 绪论(前言) 本研究课题国内外已有的重要文献的扼要概括,阐明研究此课题的目的、意义,研究的主要内容和所要解决的问题。本研究工作在国民经济建设和社会发展中的理论意义与实用价值。 == 文献综述 在查阅国内外文献和了解国内外有关科技情况的基础上,围绕课题涉及的问题,综述前人工作情况,达到承前启后的目的。要求:(1)总结课题方向至少 10 年以来的国内外动态;(2)明确前人的工作水平;(3)介绍目前尚存在的问题;(4)说明本课题的主攻方向。文献总结应达到可独立成为一篇综述文章的要求。 == 理论分析、数值计算或统计分析 利用研究生本人所掌握的理论知识对所选课题进行科学地、严密地理论分析、数值计算或统计分析,剖析课题,提出自己的见解。 == 实验原理、实验方法及实验装置 学位论文要求对实验原理、方法、装置、步骤和有关参数有较详细的阐述,以便评阅人及答辩委员会审核实验的可靠性,并能对实验进行重复以便验证结果的可靠性,也为以后的研究者提供一个较完整的研究方法。 == 实验结果及分析 列出数据的图或表,并对数据结果进行讨论,对比分析、结果推论要严格准确,避免采用模棱两可的评定语言。对反常的数据要保留并做解释或者说明,不可随意剔除数据做出有违科学公正的行为。引用别人的研究成果及数据应加注参考文献,较长的公式推导可列入附录。采纳文献及引用数据应为可以公开并能重复查到的文献资源,并需标明准确出处(如页码或图表序号等)。正文引用文献一律用右上角方括号内的次序号(阿拉伯数字)以“上标”格式标示。 == 图、表、公式、计量单位和数字用法的规定 === 图 图包括曲线图、构造图、示意图、图解、框图、流程图、地图、照片等。图应具有“自明性”,即只看图、图题和图例,不阅读全文,就可理解图意。图应编排序号,可按章用阿拉伯数字顺序编排,例如图 3-1。插图较少时可按全文编排,如图 1、图 2……,若有分图用(a)(b)(c)表示,图注在图名下方,内容按序编号并用分号“;”隔开。 每一图应有简短确切的题名,连同图号置于图下。图题、图号字体与正文相同,字体也可改用仿宋以示与正文的区别。必要时,应将图上的符号、标记、代码以及实验条件等,用最简练的文字,横排于图题下方,作为图例说明。 本模板采用按章节编号的方式。如果需要插入带自动编号的图片,需要使用```typ #figure```。例如,使用下面的代码插入带编号的图片: #code( ```typst #figure( image("./demo_image/24h_rain.png", width: 8.36cm),// 宽度/高度需要自行调整 caption: [每小时降水量24小时均值分布图] ) ``` ) #figure( image("./demo_image/24h_rain.png", width: 8.36cm), caption: [每小时降水量24小时均值分布图] ) #h(2em) 通常情况下,插入图、表等组件后,后续的首个段落会丢失首行缩进,需要使用 `#h(2em)` 手动补充缩进。 如一个插图由两个及以上的分图组成,分图用(a)、(b)、(c)等标出,并标出分图名。目前,本模板尚未实现分图的字母自动编号。如需要分图,建议使用 `#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) 实际使用中,网格划分、网格大小调整需要自行操作。 === 表 表的编排,一般是内容和测试项目由左至右横读,数据依序竖排。表应有自明性并采用阿拉伯数字编排序号,如表 1、表 2 等,表格较多时可按章排序,如表 1.1、@table1 等。 带编号、表名的表格需要使用 `#figure` 包裹,才能自动编号。方式与上方图片相仿,或者查看下面的代码说明。表格本身建议使用函数 `table` 、或第三方库 `tablem` 库绘制。使用 `tablem` 库时,`#figure` 可能会认为其包裹的内容不是 `table` 类型,而编号“图X-X”。可以通过添加 `kind: table` 声明这是一个表格。 #code( ```typst #figure( { set table.cell(stroke: (top: 0.8pt, bottom: 0.8pt, left: 0pt, right: 0pt)) show table.cell.where(y:0): set text(weight: "bold") table( columns: 13, rows: 1.8em, align: center + horizon, table.header( [], 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)], ), [], [Con], [Low], [Medium], [High], [Con], [Low], [Medium], [High], [Con], [Low], [Medium], [High], [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] ) }, caption: "室外细菌气溶胶香农-维纳指数(H)和均匀性指数(E)", ) ``` ) #figure( { set table.cell(stroke: (top: 0.8pt, bottom: 0.8pt, left: 0pt, right: 0pt)) show table.cell.where(y:0): set text(weight: "bold") table( columns: 13, rows: 1.8em, align: center + horizon, table.header( [], 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)], ), [], [Con], [Low], [Medium], [High], [Con], [Low], [Medium], [High], [Con], [Low], [Medium], [High], [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] ) }, caption: "室外细菌气溶胶香农-维纳指数(H)和均匀性指数(E)", )<table1> #h(2em)每一表应有简短确切的题名,连同表号置于表上。必要时,应将表中的符号、标记、代码以及需要说明事项,以最简练的文字,横排于表题下,作为表注,也可以附注于表下。表内附注的序号宜用小号阿拉伯数字并加右圆括号置于被标注对象的右上角,如:×××1),不宜用星号“\*”,以免与数学上共轭的符号相混。目前,本模板暂未实现表内“1)”格式的附注。 表的各栏均应标明“量(或测试项目)、标准规定符号、单位”。只有在无必要标注的情况下方可省略。表中的缩略词和符号,必须与正文中一致。 表内同一栏的数字必须上下对齐。表内不宜用“同上”、“同左”、“″”和类似词,应一律填入具体数字或文字。表内“空白”代表未测或无此项,“-”或“…”代表未发现(当“-”可能与代表阴性反应相混时用“…”代替),“0”表示实测结果确为零。 === 数学、物理符号和化学式 正文中的公式、算式或方程式等应编排序号,序号标注于该式所在行的最右边;当有续行时,应标注于最后一行的最右边。 公式及文字中的一般变量(或一般函数)(如坐标$X$、$Y$,电压$V$,频率$f$)宜用斜体,矢量用粗斜体如$bold(S)$或白斜体上加单箭头$limits(S)^arrow$,常用函数(如三角函数$cos$、对数函数$ln$等)、数字运算符、化学元素符号及分子式、单位符号、产品代号、人名地名的外文字母等用正体。 Typst 的公式与 LaTeX 写法不同,参见 Typst 官方文档。 在 Typst 中,使用 ```typ $$``` 包裹公式以获得行内公式,在公式内容两侧增加空格以获得块公式。如 ```typ $alpha + beta = gamma$``` 会获得行内公式 $alpha + beta = gamma$,而加上两侧空格,写成 ```typ $ alpha + beta = gamma $``` ,就会变成带自动编号的块公式: $ alpha + beta = gamma $ <eqexample> #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)] $ #h(2em) 公式首行的起始位置位于行首算起第五个中文字符之处,即在段落起始行的首行缩进位置再退后两个中文字符。不要用居中、居左或居行首排列。公式编号按阿拉伯数字顺序编号,如(1)(2)……,公式较多时可按章顺序编号,如(1.1)(1.2)……。 *由于目前实现公式首行空四格的做法是修改对齐方式,故如遇多行公式,请手动为每行公式添加对齐,否则公式的位置将错位。* 公式引用使用式 1、式 1.1 等,英语文本中用 Eq.1、Eq.1.1 等。在 Typst 中,可以给公式添加 label 再引用。例如引用 @eqt:eqexample。 请注意,引用公式、图表需要添加相应的前缀,如 ```typ @tbl:``` ```typ @fig:``` ```typ @eqt:```。 #code( ```typst $ alpha + beta = gamma $ <eqexample​> 例如引用@eqt:eqexample。 ``` ) // 上面这处代码请不要直接复制 // 因为为了规避渲染报错,加了一个零宽度空格 #h(2em) 较短的公式一般一式一行并按顺序编号,后面一式若为前面一式的注解(如下标范围 i=1,3,5,……)可用括号括起来与前面一式并排一行。较长的公式必须转行时,只能在=、≈、+、-、×、÷、<、>处转行。上下式尽可能在等号“=”处对齐。公式中符号尚未说明者应有说明,符号说明之间用分号隔开,一般一个符号占一行。 不需编号的公式也可以不用另起行。如:$I=V \/ R$ 。在上文的“行内公式”已经解说,此处不再赘述。由于 Typst 默认尝试使用数学方式表现,例如 ```typ $I=V / R$``` 会显示为 $I=V / R$,而研院的排版要求中说明“不宜采用竖式,以便使行距均匀,编排整齐。”故有时需要使用转义方式输入斜杠,如 ```typ $I=V \/ R$```。 === 计量单位和数字用法 论文必须采用 1984 年 2 月 27 日国务院发布的《中华人民共和国法定计量单位》,并遵照《中华人民共和国法定计量单位使用方法》执行。各种量、单位和符号,必须遵循国家标准的规定执行。数字和单位用法应遵照 GB/T 15835,例如: 不宜在文字中间夹杂使用数学(物理)符号、计量单位符号,例如“钢轨每 m 重量<50kg”应写成“钢轨每米重量小于 50kg”; 纯小数在小数点前面的 0 不能省略; 百分数及幂次数量范围应完整表达,如“20%\~40%”不应写作“20\~40%”,“3×102 \~5×102”不能写成“3\~5×102”;避免让单位误为词头,如力矩单位 N·m 或 Nm 不能写成 mN;组合单位中的斜线不能多于一条,如 w/(m2·℃)不能写成 w/m2/℃。 注意:`~` 在 Typst 的书写环境中是不断行空格。如果需要输入 `~` 本身,可能需要转义为 `\~` 输入。 == 结论 结论应该观点明确、严谨、完整、准确,文字必须简明扼要,要阐明本人在科研工作中的创造性成果、新见解及其意义,本文成果在本领域中的地位和作用,对存在的问题和不足应做出客观的叙述和提出建议。 应严格区分自己的成果与导师科研成果和前人已有研究的界限。 == 为引用文献而添加的章节 #h(2em)参考文献需要使用 bib 格式的引用文献表,再在正文中通过 ```typ @labelname``` 方式引用。如 #code( ```typst 这里有一段话 @kopka2004guide. 引用多个会自动合并 @kopka2004guide @wang2010guide 。 ``` ) #h(2em)这里有一段话 @kopka2004guide,引用多个会自动合并 @kopka2004guide @wang2010guide 。 目前参考文献格式不符合研究生院要求,会在今后重制/寻找合适的 csl 文件。 完成上述操作后,*在致谢章节之后!致谢章节之后!致谢章节之后!*,添加 #code( numbering: true, radius: 0pt, text-style: (font: ("Courier New", "SimHei")), ```typst #bibliography( "ref.bib", // 替换为自己的bib路径 style: "gb-t-7714-2015-numeric-seu-degree.csl" ) ``` ) #h(2em)就会自动生成参考文献表。demo 使用的 `ref.bib` 来自 https://github.com/lucifer1004/pkuthss-typst 。 当前(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-degree.csl` 是“修复”部分 bug 的学位论文用 CSL 文件。该格式和东大格式不完全吻合,但比自带的 `gb7714-2015` 稍微符合一些。 #thanks[ 致谢应当作为正文部分的最后一个章节出现。 可以在正文后对本论文学术研究有特别贡献的组织或个人表达谢意: 1、对提供资助或者支持的基金(基金项目应该包括基金名称、项目名称、项目编号、项目负责人、研究起止年月等)、合同单位、企业、组织或者个人; 2、协助完成研究工作或提供便利的组织或个人; 3、给予转载或者引用权的资料、图片、文献、研究设想的所有者。 致谢章节应当使用 ```typ #thanks[内容]``` 显示。 在致谢章节后,请添加 ```typ #bibliography``` 引用文献表。 参考文献过后,需要使用```typ #show: show-appendix```进入附录部分。 ] #bibliography( "ref.bib", // 替换为自己的bib路径 style: "gb-t-7714-2015-numeric-seu-degree.csl" ) #show: show-appendix // 进入附录部分 = 附录说明 <appendix-1> 如果有必要可以设置附录。该部分包括与论文有关的原始数据明细表,较多的图表,计算程序及说明,过长的公式推导,或取材于复制品而不便于编入正文的材料等。附录一般与论文全文装订在一起,与正文一起编页码。如果附录内容很多,可独立成册。若有多个附录,则按大写英文字母编号排序,如附录 A、附录 B 等,每一个附录均另起一页。附录中的公式及图表编号应冠以附录序号字母加一短划线,如公式(A-2)、图 A-2,表 B-2 等。 $ &1+2+ \ &3+4+\ &66666666 $ <ss1> #figure( { set table.cell(stroke: (top: 0.8pt, bottom: 0.8pt, left: 0pt, right: 0pt)) show table.cell.where(y:0): set text(weight: "bold") table( columns: 13, rows: 1.8em, align: center + horizon, table.header( [], 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)], ), [], [Con], [Low], [Medium], [High], [Con], [Low], [Medium], [High], [Con], [Low], [Medium], [High], [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] ) }, caption: "室外细菌气溶胶香农-维纳指数(H)和均匀性指数(E)", ) = 余下部分说明 在研院的格式要求中,余下部分还有索引、作者简介、后记(或鸣谢)、封底。目前本模板尚未支持这四个部分。
https://github.com/jgm/typst-hs
https://raw.githubusercontent.com/jgm/typst-hs/main/test/typ/compiler/ops-assoc-00.typ
typst
Other
// Math operators are left-associative. #test(10 / 2 / 2 == (10 / 2) / 2, true) #test(10 / 2 / 2 == 10 / (2 / 2), false) #test(1 / 2 * 3, 1.5)
https://github.com/fuchs-fabian/typst-template-aio-studi-and-thesis
https://raw.githubusercontent.com/fuchs-fabian/typst-template-aio-studi-and-thesis/main/src/pm_assets.typ
typst
MIT License
#import "utils.typ": * // Persona #let persona( primary-color: dark-blue, text-color: dark-grey, background-color: light-blue, title: txt-todo, img: image("images/persona.png", width: 6.5em), name: txt-todo, age: txt-todo, family: txt-todo, job: txt-todo, do-and-say: txt-todo, wishes: txt-todo, see-and-hear: txt-todo, challenges: txt-todo, typical-day: txt-todo, goals: txt-todo ) = { import "dictionary.typ": txt-persona-name, txt-persona-age, txt-persona-family, txt-persona-job, txt-persona-do-and-say, txt-persona-wishes, txt-persona-see-and-hear, txt-persona-challenges, txt-persona-typical-day, txt-persona-goals rect(inset: 0.9em)[ #set par(justify: false) #show table.cell.where(x: 0): set text(fill: primary-color, weight: "bold", size: 0.9em) #show table.cell.where(x: 1): set text(fill: text-color, weight: "regular", size: 1em) #set table(fill: (_, y) => if calc.odd(y) { background-color } else { none }) #text("Persona: ", size: 1.4em, weight: "bold")#text(title, size: 1.4em, weight: "bold", fill: primary-color) #grid( columns: (0.7fr, 0.3fr, 0.3fr), [ #table( columns: (auto, 1fr), align: (left, left), stroke: text-color, [#txt-persona-name], [#name], [#txt-persona-age], [#age], [#txt-persona-family], [#family], [#txt-persona-job], [#job] ) ], [], img ) #table( columns: (0.3fr, 0.7fr), align: (left, left), stroke: text-color, [#txt-persona-do-and-say], [#do-and-say], [#txt-persona-wishes], [#wishes], [#txt-persona-see-and-hear], [#see-and-hear], [#txt-persona-challenges], [#challenges], [#txt-persona-typical-day], [#typical-day], [#txt-persona-goals], [#goals] ) ] } // Retro #let retro( primary-color: dark-blue, secondary-color: blue, text-color: dark-grey, background-color: light-blue, heading-starts-with: 2, day: txt-todo, sprint: none, info: none, img: image("images/starfish.png", height: 100pt), more: none, keep: none, start: none, stop: none, less: none, improvements: none, impediments: none, measures: none ) = { import "dictionary.typ": txt-retro, txt-retro-improvements, txt-retro-impediments, txt-retro-measures set par(justify: false) let validate-if-na(body) = { return if is-not-none-or-empty(body) { body } else [#text(fill: secondary-color)[_NA_]] } grid( columns: (70%, auto), align: (left, right), gutter: 0.9em, [ #heading(level: heading-starts-with)[ #txt-retro #if is-not-none-or-empty(sprint) { "Sprint " + sprint } #if is-not-none-or-empty(day) { "(" + day + ")" } ] #if is-not-none-or-empty(info) { info } ], img ) set table(fill: (x, y) => if x == 0 { background-color } else { none }) show table.cell.where(x: 0): set text(fill: primary-color, weight: "bold", size: 0.9em) show table.cell.where(x: 1): set text(fill: text-color, weight: "regular", size: 1em) show table.cell.where(x: 1): set par(justify: false) table( columns: (auto, 10fr), align: (center, horizon), stroke: text-color, table.cell(rowspan: 1, align: horizon, rotate(-90deg, reflow: true)[more of]), [#validate-if-na(more)], table.cell(rowspan: 1, align: horizon, rotate(-90deg, reflow: true)[keep doing]), [#validate-if-na(keep)], table.cell(rowspan: 1, align: horizon, rotate(-90deg, reflow: true)[start doing]), [#validate-if-na(start)], table.cell(rowspan: 1, align: horizon, rotate(-90deg, reflow: true)[stop doing]), [#validate-if-na(stop)], table.cell(rowspan: 1, align: horizon, rotate(-90deg, reflow: true)[less of]), [#validate-if-na(less)], ) if is-not-none-or-empty(improvements) [ #heading(level: heading-starts-with + 1)[#txt-retro-improvements] #improvements ] if is-not-none-or-empty(impediments) [ #heading(level: heading-starts-with + 1)[#txt-retro-impediments] #impediments ] if is-not-none-or-empty(measures) [ #heading(level: heading-starts-with + 1)[#txt-retro-measures] #measures ] } // SMART #let smart( primary-color: dark-blue, text-color: dark-grey, background-color: light-blue, justify: false, s: txt-todo, m: txt-todo, a: txt-todo, r: txt-todo, t: txt-todo ) = { set table(fill: (x, y) => if x == 0 { background-color } else { none }) show table.cell.where(x: 0): set text(fill: primary-color, weight: "bold", size: 0.9em) show table.cell.where(x: 1): set text(fill: text-color, weight: "regular", size: 1em) show table.cell.where(x: 1): set par(justify: justify) table( columns: (auto, 1fr), align: (center, left), stroke: text-color, [S], [#s], [M], [#m], [A], [#a], [R], [#r], [T], [#t] ) } // User Story #let user-story( primary-color: dark-blue, text-color: dark-grey, background-color: light-blue, id: txt-todo, title: txt-todo, sprint: txt-todo, status: txt-todo, description: txt-todo, url: "", url-without-id: "", acceptance-criteria: none, s: none, m: none, a: none, r: none, t: none, body ) = { import "assets.typ": button import "dictionary.typ": txt-user-story-title, txt-user-story-acceptance-criteria rect(inset: 0.9em)[ #set table(fill: (x, y) => if y == 0 { background-color } else { none }) #show table.cell.where(y: 0): set text(fill: primary-color, weight: "bold", size: 0.9em) #show table.cell.where(y: 1): set text(fill: text-color, weight: "regular", size: 1em) #table( columns: (0.15fr, 1fr, 0.15fr, auto), align: (left, left, left, left), stroke: text-color, table.header([ID], [#txt-user-story-title], [Sprint], [Status]), [ #if is-not-none-or-empty(id) and is-not-none-or-empty(url-without-id) { link(url-without-id + id)[#id] } else { if is-not-none-or-empty(id) { id } } ], [ #if is-not-none-or-empty(title) { title } ], [ #if is-not-none-or-empty(sprint) { sprint } ], [ #if is-not-none-or-empty(status) { status } ] ) #text("User Story:", size: 1.1em, weight: "bold", fill: primary-color) #if is-not-none-or-empty(description) { description } #if is-not-none-or-empty(url) { button(url: url)[#url] } #if is-not-none-or-empty(acceptance-criteria) or is-not-none-or-empty(s) or is-not-none-or-empty(m) or is-not-none-or-empty(a) or is-not-none-or-empty(r) or is-not-none-or-empty(t) { text(txt-user-story-acceptance-criteria + ":", size: 1.1em, weight: "bold", fill: primary-color) linebreak() if is-not-none-or-empty(acceptance-criteria) { acceptance-criteria } if is-not-none-or-empty(s) or is-not-none-or-empty(m) or is-not-none-or-empty(a) or is-not-none-or-empty(r) or is-not-none-or-empty(t) { smart(s: s, m: m, a: a, r: r, t: t) } } #body ] }
https://github.com/Myriad-Dreamin/tinymist
https://raw.githubusercontent.com/Myriad-Dreamin/tinymist/main/crates/tinymist-query/src/fixtures/lexical_hierarchy/dict.typ
typst
Apache License 2.0
#let z = 1; #let x = ( y: z, "1 2": z, )
https://github.com/DJmouton/Enseignement
https://raw.githubusercontent.com/DJmouton/Enseignement/main/SNT/Réseaux sociaux/Cours modélisation des réseaux sociaux.typ
typst
#import "/Templates/layouts.typ": SNT, titre, sous_titre #import "/Templates/utils.typ": cadre #import "@preview/cetz:0.2.2" #show: doc => SNT(doc) #sous_titre("SNT - Réseaux sociaux - Partie 3") #titre("Modalisation des Réseaux Sociaux") = Modélisation d'un réseau #cadre(titre: "L'essentiel")[ Un réseau social est composé d'individus reliés par des liens. Pour le modéliser, nous allons utiliser une représentation inspirée de la théorie des graphes. Cette représentation facilite l'étude des réseaux et permet à des algorithmes performants de parcourir le réseau à la recherche dinformations. ] = Sommet, arête et graphe #cadre(titre: "L'essentiel")[ Dans un réseau social, une personne est représentée par un cercle ou un point numéroté appelé *sommet*. Le lien d'amitié entre deux individus est représenté par un trait appelé *arête*. Un *graphe* est un ensemble de sommets et d'arêtes. ] = Distance entre deux sommets d'un graphe #cadre(titre: "L'essentiel")[ La *distance* entre deux sommets est égale à la longueur du plus court "chemin" entre ces sommets. Ce nombre n'a pas d'unité. ] = Caractéristiques d'un graphe #cadre(titre: "L'essentiel")[ - Le *rayon* du graphe est la plus petite distance à laquelle un des sommets se trouve de touts les autres. - Le *diamètre* du graphe est la distance entre les deux sommets les plus éloignés du graphe. - Le *centre* d'un graphe est formé de l'ensemble des sommets (il peut y en avoir plusieurs) se situant à une distance des autres sommets inférieure ou égale au rayon. Les centres d'un graphe sont les personnes à partir desquelles l'information se diffuse plus vite sur le réseau. Ils sont appelés des "*influenceurs*". ] = La notion du "petit monde" #cadre(titre: "L'essentiel")[ En 1967, l'*expérience de Milgram* a montré que toute personne était à une distance moyenne de six liens de tout autre individu dans le monde. On parle d'un effet "*petit monde*". Grâce aux réseaux sociaux, ce nombre se réduit: en 2011, il avait chuté à 4,67 sur Facebook. Les réseaux sociaux favorisent la formation de communautés d'intérêt, et les algorithmes de recommandation renforcent ce phénomène. Certains chercheurs alertent donc sur le cloisonnement de communautés qui cultivent l'entre-soi, avec pour conséquence l'appauvrissement de la pensée critique ] = Résumé
https://github.com/Functional-Bus-Description-Language/Specification
https://raw.githubusercontent.com/Functional-Bus-Description-Language/Specification/master/src/data-types.typ
typst
#pagebreak() = Data types There are 7 data types in FBDL: - bit string, - bool, - integer, - range, - real, - string, - time. Types are implicit and are not declared. The type of the value evaluated from an expression must be checked before any assignment or comparison. If there is a type mismatch that can be resolved with implicit rules, then it shall be resolved. In case of a type mismatch that cannot be resolved, an error must be reported by the compiler. Conversion from bool to integer in expressions is implicit. Conversion from integer to real in expressions is implicit. Conversion from integer to range can be implicit if the interger value is natural. Conversion from real to integer can be implicit if there is no fractional part. If fractional part is present, then conversion from real to integer must be explicit and must be done by calling any function returning integer type, for example `ceil()`, `floor()`. The below picture presents a graph of possible implicit conversions between different data types. #set align(center) #image("images/data-types-conversion.svg", width: 80%) #set align(left) == Bit string The value of the bit string type is used for all *`*-value`* properties. It might be created explicitly using the bit string literal or it might be converted implicitly from the value of integer type. The only way to create a bit string value containing meta values is to explicitly use the bit string literal. #block(breakable:false)[ The below table presents unary negation operation results applied to possible bit string data type values. #set align(center) #table( stroke: none, align: center, columns: (3cm, 3cm), table.vline(x: 1, start: 1), table.cell(colspan: 2)[Bit string unary bitwise negation], table.hline(), [*In Value*], [*Out Value*], table.hline(), [`0`], [`1`], table.hline(stroke: (thickness: 0.1pt)), [`1`], [`0`], table.hline(stroke: (thickness: 0.1pt)), [`-`], [`-`], table.hline(stroke: (thickness: 0.1pt)), [`U`], [`U`], table.hline(stroke: (thickness: 0.1pt)), [`W`], [`W`], table.hline(stroke: (thickness: 0.1pt)), [`X`], [`X`], ) ] #set align(left) Below tables present binary operation results applied to possible bit string data type values. #set align(center) #block(breakable:false)[ #table( stroke: none, align: center, columns: (2cm, 1cm, 1cm, 1cm, 1cm, 1cm, 1cm, 1cm), table.vline(x: 1, start: 1), table.vline(x: 2, start: 1, stroke: (thickness: 0.1pt)), table.vline(x: 3, start: 1, stroke: (thickness: 0.1pt)), table.vline(x: 4, start: 1, stroke: (thickness: 0.1pt)), table.vline(x: 5, start: 1, stroke: (thickness: 0.1pt)), table.vline(x: 6, start: 1, stroke: (thickness: 0.1pt)), table.vline(x: 7, start: 1, stroke: (thickness: 0.1pt)), table.cell(colspan: 8)[Bit string binary bitwise and (&) resolution], table.hline(), [*Operands*], [`0`], [`1`], [`-`], [`U`], [`W`], [`X`], [`Z`], table.hline(), [`0`], [`0`], [`0`], [`0`], [`U`], [`0`], [`X`], [`0`], table.hline(stroke: (thickness: 0.1pt)), [`1`], [`0`], [`1`], [`1`], [`U`], [`1`], [`X`], [`1`], table.hline(stroke: (thickness: 0.1pt)), [`-`], [`0`], [`1`], [`-`], [`U`], [`W`], [`X`], [`Z`], table.hline(stroke: (thickness: 0.1pt)), [`U`], [`U`], [`U`], [`U`], [`U`], [`U`], [`U`], [`U`], table.hline(stroke: (thickness: 0.1pt)), [`W`], [`0`], [`1`], [`X`], [`U`], [`W`], [`X`], [`W`], table.hline(stroke: (thickness: 0.1pt)), [`X`], [`X`], [`X`], [`X`], [`U`], [`X`], [`X`], [`X`], table.hline(stroke: (thickness: 0.1pt)), [`Z`], [`0`], [`1`], [`X`], [`U`], [`W`], [`X`], [`Z`], ) ] #block(breakable:false)[ #table( stroke: none, align: center, columns: (2cm, 1cm, 1cm, 1cm, 1cm, 1cm, 1cm, 1cm), table.vline(x: 1, start: 1), table.vline(x: 2, start: 1, stroke: (thickness: 0.1pt)), table.vline(x: 3, start: 1, stroke: (thickness: 0.1pt)), table.vline(x: 4, start: 1, stroke: (thickness: 0.1pt)), table.vline(x: 5, start: 1, stroke: (thickness: 0.1pt)), table.vline(x: 6, start: 1, stroke: (thickness: 0.1pt)), table.vline(x: 7, start: 1, stroke: (thickness: 0.1pt)), table.cell(colspan: 8)[Bit string binary bitwise or (|) resolution], table.hline(), [*Operands*], [`0`], [`1`], [`-`], [`U`], [`W`], [`X`], [`Z`], table.hline(), [`0`], [`0`], [`1`], [`0`], [`U`], [`0`], [`X`], [`0`], table.hline(stroke: (thickness: 0.1pt)), [`1`], [`1`], [`1`], [`1`], [`U`], [`1`], [`X`], [`1`], table.hline(stroke: (thickness: 0.1pt)), [`-`], [`0`], [`1`], [`-`], [`U`], [`W`], [`X`], [`Z`], table.hline(stroke: (thickness: 0.1pt)), [`U`], [`U`], [`U`], [`U`], [`U`], [`U`], [`U`], [`U`], table.hline(stroke: (thickness: 0.1pt)), [`W`], [`0`], [`1`], [`X`], [`U`], [`W`], [`X`], [`W`], table.hline(stroke: (thickness: 0.1pt)), [`X`], [`X`], [`X`], [`X`], [`U`], [`X`], [`X`], [`X`], table.hline(stroke: (thickness: 0.1pt)), [`Z`], [`0`], [`1`], [`X`], [`U`], [`W`], [`X`], [`Z`], ) ] #block(breakable:false)[ #table( stroke: none, align: center, columns: (2cm, 1cm, 1cm, 1cm, 1cm, 1cm, 1cm, 1cm), table.vline(x: 1, start: 1), table.vline(x: 2, start: 1, stroke: (thickness: 0.1pt)), table.vline(x: 3, start: 1, stroke: (thickness: 0.1pt)), table.vline(x: 4, start: 1, stroke: (thickness: 0.1pt)), table.vline(x: 5, start: 1, stroke: (thickness: 0.1pt)), table.vline(x: 6, start: 1, stroke: (thickness: 0.1pt)), table.vline(x: 7, start: 1, stroke: (thickness: 0.1pt)), table.cell(colspan: 8)[Bit string binary bitwise xor (^) resolution], table.hline(), [*Operands*], [`0`], [`1`], [`-`], [`U`], [`W`], [`X`], [`Z`], table.hline(), [`0`], [`0`], [`1`], [`0`], [`U`], [`0`], [`X`], [`0`], table.hline(stroke: (thickness: 0.1pt)), [`1`], [`1`], [`0`], [`1`], [`U`], [`1`], [`X`], [`1`], table.hline(stroke: (thickness: 0.1pt)), [`-`], [`0`], [`1`], [`-`], [`U`], [`W`], [`X`], [`Z`], table.hline(stroke: (thickness: 0.1pt)), [`U`], [`U`], [`U`], [`U`], [`U`], [`U`], [`U`], [`U`], table.hline(stroke: (thickness: 0.1pt)), [`W`], [`0`], [`1`], [`X`], [`U`], [`W`], [`X`], [`W`], table.hline(stroke: (thickness: 0.1pt)), [`X`], [`X`], [`X`], [`X`], [`U`], [`X`], [`X`], [`X`], table.hline(stroke: (thickness: 0.1pt)), [`Z`], [`0`], [`1`], [`X`], [`U`], [`W`], [`X`], [`Z`], ) ] #set align(left) == Bool The value of the bool type can be created explicitly using `true` or `false` literals. The value of the bool type shall be implicitly converted to the value of the integer type in places where the value of the integer type is required. The boolean `false` value shall be converted to the integer value 0. The boolean `true` value shall be converted to the integer value 1. In the following example, the value of `I1` evaluates to 1, and the value of `I2` evaluates to 2. #block(breakable:false)[ #pad(left: 1em)[ ```fbd const B0 = false const B1 = true const I1 = B0 + B1 const I2 = B1 + B1 ``` ] ] The bool - integer conversion is asymmetric. Implicit conversion of a value of the integer type to a value of the bool type is forbidden. This is becuase values of the bool type are often used to count the number of elements or to arbitrarily enable/disable an element generation. However, a value of the integer type appearing in a place where a value of the bool type is required is usually a sign of a mistake. To convert a value of the integer type to a value of the bool type the built-in `bool()` function must be called. == Integer The integer data type is always signed integer and must be at least 64 bits wide. == Range The range data type is used to assign value to the `range` property. It consists of left and right bounds, both expressed as expressions, separated by the colon character. The range data type can be created solely using the range expression. There is no range literal. `range_expression ::= expression `*`:`*` expression` == Real The real data type is 64 bits IEEE 754 double precision floating-point type. == String The string data type can only be created explicitly using a string literal. The string data type is only used for setting values of some properties, for example `access`. == Time The time data type is only used for assigning value to the properties expressed in time. The value of time type can be created explicitly using the time literal. Values of time type can be added regardless of their time units. Values of the time type can also be multiplied by values of the integer type. All of the below property assignments are valid. #block(breakable:false)[ #pad(left: 1em)[ ```fbd delay = 1 s + 1 ms + 1 us + 1 ns delay = 5 * 60 s # Sleep for 5 minutes. delay = 10 ms * 4 + 7 * 8 us ``` ] ]
https://github.com/rabotaem-incorporated/algebra-conspect-1course
https://raw.githubusercontent.com/rabotaem-incorporated/algebra-conspect-1course/master/sections/04-linear-algebra/02-elementary-things.typ
typst
Other
#import "../../utils/core.typ": * == Элементарные преобразования и элементарные матрицы #def[ Элементарное преобразование $1$ типа: К $i$ строке прибавить $j$ строку, умноженную на $lambda in R$. Обозначается $T_(i j) (lambda)$ ] #def[ Элементарное преобразование $2$ типа: Поменять местами $i$ и $j$ строки. Обозначается $S_(i j)$ ] #def[ Элементарное преобразование $3$ типа: Умножить $i$ строку на $lambda in R, space lambda eq.not 0$. Обозначается $D_(i j) (lambda)$ ] #notice[ Аналогичные преобразования можно делать с столбцами. ] #def[ Матрица $A in M_(m, n) (K)$ называется ступенчатой, если существует $0 <= r <= m$ и числа $j_1, ..., j_r: 1 <= j_1 < ... < j_r <= n$ такие, что: + $a_(k j_k) eq.not 0, space k = 1, ..., r$ + $a_(k j) = 0, space k = 1, ..., r, space j < j_k$ + $a_(k j) = 0, space forall j, k: space k > r$ ] #example[ $display(mat( 1, 1, 1, 1, 1, 1; 0, 0, 1, 1, 1, 1; 0, 0, 0, 0, 0, 1; 0, 0, 0, 0, 0, 0; ))$ ] #pr[ Любую матрицу можно превратить в ступенчатую с помощью преобразования строк $1$ и $2$ типа. ] #proof[(короче Гаусса пишем и работает) $A = a(i, j) in M_(m, n) (K)$ Индукция по $m$. "База": $m = 1$. $A$ ступенчатая по определению. "Переход": $m > 1$: Если $A = 0$, то $A$ ступенчатая по определению. $j_1$ --- номер первого ненулевого столбца. $exists i : a_(i j_1) eq.not 0$ $i eq.not 1 ==>$ применим $S_(1 i)$ Таким образом можно считать $a_(1 j_1) eq.not 0$. Применим $T_(2 1) (-(a_(2 j_1))/(a_(1 j_1)) ), T_(3 1) (-(a_(3 j_1))/(a_(1 j_1))), ..., T_(m 1) (-(a_(m j_1))/(a_(1 j_1)))$ Получим $A' = display(mat( a_(1 1), a_(1 2), ..., a_(1 n); 0, a_(2 2), ..., a_(2n); dots.v, dots.v, dots.down, dots.v; 0, a_(m m), ..., a_(m n); ))$ По индукции $A'$ ступенчатая. ] #def[ Окаймленная единичная матрица --- матрица вида: $display(mat( 1, 0, ..., 0, 0, ..., 0; 0, 1, ..., 0, 0, ..., 0; dots.v, dots.v, dots.down, dots.v, dots.v, dots.down, dots.v; 0, 0, ..., 1, 0, ..., 0; 0, 0, ..., 0, 0, ..., 0; dots.v, dots.v, dots.down, dots.v, dots.v, dots.down, dots.v; 0, 0, ..., 0, 0, ..., 0; ))$ ] #th[ Пусть $A in M_(m, n) (K)$. Тогда ее можно преобразовать в окаймленную единичную матрицу с помощью преобразования строк и столбцов. ] #proof[ Сделаем $A$ ступенчатой. С помощью третьего преобразования сделаем все ведущие элементы равными $1$. Превратим ступеньки разной длины в единичные. (меняя столбцы) Применим $D_1 (a_(11)^(-1)), ..., D_r (a_(r r)^(-1))$. Потом будем от верхней строки к нижней превращать их в строки с одной $1$ и нулями. (вычитая строки и столбцы) ] #example[ $display(mat( 1, 1; 1, 1; )) -> display(mat( 1, 1; 0, 0; )) limits(->)^("вычесть столбцы") display(mat( 1, 0; 0, 0; ))$ ] #def[ Элементарная матрица: "Первого типа": Пусть $1 <= i, j <= n, i eq.not j, lambda in K$ $T_(i j) (lambda) = display(mat( 1, 0, ..., 0, ..., 0; 0, 1, ..., 0, ..., lambda; dots.v, dots.v, dots.down, dots.v, dots.down, dots.v; 0, 0, ..., 1, ..., 0; dots.v, dots.v, dots.down, dots.v, dots.down, dots.v; 0, 0, ..., 0, ..., 1 )) = E_n + lambda e_(i j)$ "Второго типа": $S_(i j) = display(mat( 1, 0, ..., 0, ..., 0; 0, 0, ..., 1, ..., 0; dots.v, dots.v, dots.down, dots.v, dots.down, dots.v; 0, 1, ..., 0, ..., 0; dots.v, dots.v, dots.down, dots.v, dots.down, dots.v; 0, 0, ..., 0, ..., 1 )) = E_n - e_(i i) - e_(j j) + e_(i j) + e_(j i)$ "Третьего типа": $D_i (lambda) = display(mat( 1, 0, ..., 0, ..., 0; 0, 1, ..., 0, ..., 0; dots.v, dots.v, dots.down, dots.v, dots.down, dots.v; 0, 0, ..., lambda, ..., 0; dots.v, dots.v, dots.down, dots.v, dots.down, dots.v; 0, 0, ..., 0, ..., 1 )) = E_n + (lambda - 1) e_(i i)$ ] #pr[ Пусть $A in M_(m, n) (K)$. Тогда при элементарных преобразованиях строк матрицы $A$ получаются матрицы $T_(i j) A, S_(i j) A, D_i A$. ] #proof[ + "Первого типа": #[ Поскольку матрица $T_(i j) (lambda)$ отличается от $E_n$ только в $i$-ой строке, то произведение тоже. В $i$-ой строке $T_(i j) (lambda)$ только две позиции отличаются от нуля, это $i$ и $j$. При умножении получаем следующее: $ display(mat( 0, ..., 1, ..., lambda, ..., 0 )) dot display(mat( a_(1 k); dots.v; a_(i k); dots.v; a_(j k); dots.v; a_(n k); )) = a_(i k) + lambda a_(j k) $ Такое происходит в каждом столбце матрицы, поэтому получаем, что $i$ строка матрицы $T_(i j) A$ равна $display(mat( a_(i 1) + lambda a_(j 1), ..., a_(i k) + lambda a_(j k), ..., a_(i n) + lambda a_(j n); ))$ ] + "Второго типа": #[ Поскольку матрица $S_(i j)$ отличается от $E_n$ только в $i$-ой и $j$-ой строках, то произведение тоже. $i$-ая строка равна произведению $display(mat( 0, ..., 1, ..., 0; ))$ на матрицу $A$, то есть на её $j$-тую строку. Аналогично с $j$-ой строкой. ] + "Третьего типа": #[ Поскольку матрица $D_i (lambda)$ отличается от $E_n$ только в $i$-ой строке, то произведение тоже. $i$-ая строка равна произведению $display(mat( 1, ..., lambda, ..., 1; ))$ на матрицу $A$, то есть на её $i$-тую строку. Что равно произведению $i$-ой строки на $lambda$. ] ] #follow[ Аналогично, преобразования столбцов можно записать в виде $A T_(j i) (lambda), A S_(j i), A D_j (lambda)$. ] #proof[ $A --> A'$ --- результат прибавления к $i$ столбцу $j$-го с коэффицентом $lambda$. $==> (A')^T = T_(i j) (lambda) A^T$ $==> A' = (T_(i j) (lambda) A^T)^T = (A^T)^T (T_(i j) (lambda))^T = A T_(j i) (lambda)$ Аналогично: элементарные преобразования столбцов $2$ и $3$ типов сводятся к умножению справа на $S_(i j)$ и $D_i (lambda)$ соответственно. ] #follow[ + $T_(i j) (-lambda) T_(i j) (lambda) = E_n$ + $S_(i j) S_(i j) = E_n$ + $D_i (lambda) D_i (lambda^(-1)) = E_n$ ] #follow[ $T_(i j) (lambda), S_(i j), D_i (lambda) in GL_n (K)$ --- все они обратимы. ] #pr(name: [PDQ разложение матриц])[ Пусть $A in M_(m, n) (K)$. Тогда существуют элементарные матрицы $P_1, ..., P_k in GL_m (K), space Q_1, ..., Q_l in GL_n (K)$, окаймленная единичная матрица $D in M_(m, n) (K)$, такие, что $A = P_1 ... P_k D Q_1 ... Q_l$. ] #proof[ Существуют элементарные преобразования строк и столбцов, превращающие $A$ в окаймленную единичную матрицу $D$. $==> D = underbrace(u_k ... u_1, "обратимы") A underbrace(v_1 ... v_l, "обратимы")$, где $u_1, ..., u_k, space v_1, ..., v_l$ --- элементарные матрицы $==> A = u_1^(-1) ... u_k^(-1) D v_l^(-1) ... v_1^(-1)$ ] #follow[ Пусть $A in M_n (K)$? Тогда условия эквивалентны: + $A in GL_n (K)$ + $A = P_1 ... P_m$, где $P_1, ..., P_m$ --- элементарные матрицы ] #proof[ "$2 ==> 1$": так как все $P_i in GL_n (K)$ "$1 ==> 2$": $A = P_1 ... P_k D Q_1 ... Q_l, space D = display(mat( E_n, 0; 0, 0; ))$ $==> D = P_k^(-1) ... P_1^(-1) A Q_l^(-1) ... Q_1^(-1) ==> D in GL_n (K)$ В $D$ есть нулевая строка, значит $forall C in M_n (K)$: в $D C$ есть нулевая строка $==> D C eq.not E_n$, но ведь $D in GL_n (K)$, значит $D = E_n ==> A = P_1 ... P_k Q_1 ... Q_l$, где все матрицы элементарны. ]
https://github.com/typst/packages
https://raw.githubusercontent.com/typst/packages/main/packages/preview/g-exam/0.3.0/src/g-exam.typ
typst
Apache License 2.0
#import "@preview/oxifmt:0.2.0": strfmt #import "./global.typ" : * #import "./auxiliary.typ": * #import "./g-question.typ": * #import "./g-solution.typ": * #import "./g-clarification.typ": * /// Template for creating an exam. /// /// - autor: Infomation of autor of exam. /// - name (string, content): Name of author of exam. /// - email (string): e-mail of author of exam. /// - watermark (string): Watermark with information about the author of the document. /// - scholl: Information of scholl. /// - name (string, content): Name of the school or institution generating the exam. /// - logo (none, content, bytes): Logo of the school or institution generating the exam. /// - exam-info: Information of exam /// - academic-period(none, content, str): academic period. /// - academic-level(none, content, str): acadmic level. /// - academic-subject(none, content, str): acadmic subname, /// - number(none, content, str): Number of exam. /// - content(none, content, str): Conten of exam. /// - model(none, content, str): Model of exam. /// - date (sting): Date of generate document. /// - keywords (string): keywords of document. /// - languaje (en, es, de, fr, pt, it): Languaje of docuemnt. English, Spanish, German, Portuguese and Italian are defined. /// Ejemplo buy bonito: /// - clarifications (string, content, array): Clarifications of exam. It will appear in a box on the first page. /// - question-text-parameters: Parameter of text in question and subquestion. For example, it allows us to change the text size of the questions. /// - show-studen-data(none, true, false, "first-page", "odd-pages"): It shows a box for the student to enter their details. It can appear on the first page or on all odd-numbered pages. /// - show-grade-table: (bool): Show grade table. /// - decimal-separator: (".", ","): Indicates the decimal separation character. /// - question-point-position: (none, left, right): Position of question point. /// - show-solution: (true, false): It shows the solutions to the questions. #let g-exam( author: ( name: "", email: none, watermark: none ), school: ( name: none, logo: none, ), exam-info: ( academic-period: none, academic-level: none, academic-subject: none, number: none, content: none, model: none ), languaje: "en", localization: ( grade-table-queston: none, grade-table-total: none, grade-table-points: none, grade-table-calification: none, point: none, points: none, page: none, page-counter-display: none, family-name: none, given-name: none, group: none, date: none ), date: none, keywords: none, clarifications: none, question-text-parameters: none, show-studen-data: "first-page", show-grade-table: true, decimal-separator: ".", question-point-position: left, show-solution: true, body, ) = { assert(show-studen-data in (none, true, false, "first-page", "odd-pages"), message: "Invalid show studen data") assert(question-point-position in (none, left, right), message: "Invalid question point position") assert(decimal-separator in (".", ","), message: "Invalid decimal separator") assert(show-solution in (true, false), message: "Invalid show solution value") set document( title: __document-name(exam-info: exam-info).trim(" "), author: author.name ) let margin-right = 2.5cm if (question-point-position == right) { margin-right = 3cm } set page( paper: "a4", margin: (top: 5cm, right:margin-right), numbering: "1 / 1", number-align: right, header-ascent: 20%, header:locate(loc => { let page-number = counter(page).at(loc).first() if (page-number==1) { align(right)[#box( width:108%, grid( columns: (auto, auto), gutter:0.7em, align(left + top)[ #if(school.at("logo", default : none) != none) { set image(height:2.5cm, width: 2.7cm, fit:"contain") if(type(school.logo) == "content") { school.logo } else if(type(school.logo) == "bytes") { image.decode(school.logo, height:2.5cm, fit:"contain") } else { assert(type(school.logo) in (none, "content", "bytes") , message: "school.logo be of type content or bytes.") } } ], grid( rows: (auto, auto, auto), gutter:1em, grid( columns: (auto, 1fr, auto), align(left + top)[ #school.name \ #exam-info.academic-period \ #exam-info.academic-level ], align(center + top)[ // #exam-info.number #exam-info.content \ ], align(right + top)[ #exam-info.at("academic-subject", default: none) \ #exam-info.number \ #exam-info.content ], ), line(length: 100%, stroke: 1pt + gray), if show-studen-data in (true, "first-page", "odd-pages") { __g-student-data() } ) ) )] } else if calc.rem-euclid(page-number, 2) == 1 { grid( columns: (auto, 1fr, auto), gutter:0.3em, align(left + top)[ #school.name \ #exam-info.academic-period \ #exam-info.academic-level ], align(center + top)[ // #exam-info.number #exam-info.content \ ], align(right + top)[ #exam-info.at("academic-subject", default: none) \ #exam-info.number \ #exam-info.content ] ) line(length: 100%, stroke: 1pt + gray) if show-studen-data == "odd-pages" { __g-student-data(show-line-two: false) } } else { grid( columns: (auto, 1fr, auto), gutter:0.3em, align(left + top)[ #school.name \ #exam-info.academic-period \ #exam-info.academic-level ], align(center + top)[ // #exam-info.number #exam-info.content \ ], align(right + top)[ #exam-info.at("academic-subject", default: none) \ #exam-info.number \ #exam-info.content \ ] ) line(length: 100%, stroke: 1pt + gray) } } ), footer: locate(loc => { line(length: 100%, stroke: 1pt + gray) align(right)[ #__g-localization.final(loc).page #counter(page).display(__g-localization.final(loc).page-counter-display, both: true, ) ] // grid( // columns: (1fr, 1fr, 1fr), // align(left)[#school.name], // align(center)[#exam-info.academic-period], // align(right)[ // Página // #counter(page).display({ // "1 de 1"}, // both: true, // ) // ] // ) __show-watermark(author: author, school: school, exam-info: exam-info, question-point-position:question-point-position) } ) ) set par(justify: true) set text(font: "New Computer Modern") __read-localization(languaje: languaje, localization: localization) __g-question-point-position-state.update(u => question-point-position) __g-question-text-parameters-state.update(question-text-parameters) set text(lang:languaje) if show-grade-table == true { __g-grade-table-header( decimal-separator: decimal-separator, ) v(10pt) } __g-show-solution.update(show-solution) set par(justify: true) if clarifications != none { __g-show_clarifications(clarifications: clarifications) } show regex("=\?"): it => { let (sugar) = it.text.split() g-question[] } show regex("=\? (.+)"): it => { let (sugar, ..rest) = it.text.split() g-question[#rest.join(" ")] } show regex("=\? [[:digit:]] (.+)"): it => { let (sugar, point, ..rest) = it.text.split() g-question(point:float(point))[#rest.join(" ")] } show regex("==\?"): it => { let (sugar) = it.text.split() g-subquestion[] } show regex("==\? (.+)"): it => { let (sugar, ..rest) = it.text.split() g-subquestion[#rest.join(" ")] } show regex("==\? [[:digit:]] (.+)"): it => { let (sugar, point, ..rest) = it.text.split() g-subquestion(point:float(point))[#rest.join(" ")] } show regex("=! (.+)"): it => { let (sugar, ..rest) = it.text.split() g-solution[#rest.join(" ")] } show regex("=% (.+)"): it => { let (sugar, ..rest) = it.text.split() g-clarification[#rest.join(" ")] } body [#hide[]<end-g-question-localization>] [#hide[]<end-g-exam>] }
https://github.com/Myriad-Dreamin/tinymist
https://raw.githubusercontent.com/Myriad-Dreamin/tinymist/main/crates/tinymist-query/src/fixtures/type_check/external.typ
typst
Apache License 2.0
// path: base.typ #let bad-instantiate(x) = { let y; let z; let w; x + y + z + w }; ----- #import "base.typ": * #let prefix(title: none) = { bad-instantiate(title) }
https://github.com/alberto-lazari/cv
https://raw.githubusercontent.com/alberto-lazari/cv/main/modules_en/experience.typ
typst
#import "/common.typ": * = Experience #entry( title: [Back End Developer], society: [Moku S.r.l.], date: [Apr 2022 - Jun 2022], location: [Treviso, Italy], description: [Internship], tags: ("Ruby on Rails", "REST APIs", "Ruby", "Git", "Scrum"), )
https://github.com/Doublonmousse/pandoc-typst-reproducer
https://raw.githubusercontent.com/Doublonmousse/pandoc-typst-reproducer/main/color_issues/hsl.typ
typst
#square( fill: color.hsl(30deg, 50%, 60%) )
https://github.com/maxgraw/bachelor
https://raw.githubusercontent.com/maxgraw/bachelor/main/apps/document/src/1-introduction/motivation.typ
typst
Im Rahmen der fortschreitenden Digitalisierung erweist sich der Online-Handel als ein besonders Wachstumsfeld. Zwischen 2019 und 2023 konnte in diesem Sektor ein Umsatzanstieg von 42% verzeichnet werden. Grundlage hierfür ist die bereits genannten Digitalisierung, welche durch die Corona-Sonderkonjunktur weiter beschleunigt wurde und das Einkaufsverhalten der Verbraucher nachhaltig veränderte. Trotz dieses Wachstums zeigte sich ab 2022 eine Dämpfung der Wachstumsraten, bedingt durch inflationsbedingte wirtschaftliche Herausforderungen, die zu einem erhöhten Konsumverzicht führten @hde-online-monitor-2023. Gesondert betrachtet spiegelt das Segment "Wohnen und Einrichten" die allgemeine Entwicklung im Online-Handel wider. Im Vergleich zu 2022 ging der Umsatz in diesem Segment um 8,1% zurück, zeigt jedoch im Vergleich zu 2019 ein Wachstum von 45,4% @hde-online-monitor-2023. Vor diesem Hintergrund bietet Augmented Reality neue Ansätze und Möglichkeiten für die Interaktion im Bereich des Online-Handels @ar-customer-journey. Hierbei beschreibt Augmented Reality die Überlagerung von Realität und Virtualität, die interaktiv und in Echtzeit erfolgt @azuma-survey. Die Anwendungsgebiete sind hierbei nicht auf den Online-Handel beschränkt, sondern finden branchenübergreifend statt. So wird Augmented Reality bereits in der Medizin, der Unterhaltungsindustrie und weiteren Bereichen eingesetzt @vr-ar-doener. Augmented Reality findet bereits in unterschiedlichen Anwendungen im Bereich der Möbelindustrie Anwendung. So bieten beispielsweise IKEA und Wayfair die Möglichkeit, Produkte in der eigenen Umgebung zu platzieren und zu visualisieren @ikea-mobile-app @wayfair-ar-blog. Viele dieser Anwendungen beschränken sich jedoch auf die reine Darstellung der Produkte und bieten keine Möglichkeiten der Individualisierung oder Konfiguration. Des Weiteren werden die Augmented Reality Funktionen an die Nutzung einer App gebunden. Die Entwicklung von WebXR, einem Standard des World Wide Web Consortiums für Augmented Reality und Virtual Reality, stellt in diesem Kontext einen bedeutenden Fortschritt dar. WebXR ermöglicht die Nutzung von AR-Anwendungen direkt im Webbrowser, was die Zugänglichkeit unabhängig vom Betriebssystem oder Gerätetyp erheblich verbessert @webxr-spec.
https://github.com/rabotaem-incorporated/probability-theory-notes
https://raw.githubusercontent.com/rabotaem-incorporated/probability-theory-notes/master/sections/04-discrete-random-processes/!sec.typ
typst
= Дискретные случайные процессы #include "01-conditional-expected-values.typ" #include "02-branching-processes.typ" #include "03-markov-chains.typ" #include "04-random-walk.typ"
https://github.com/usertam/curriculum-vitae
https://raw.githubusercontent.com/usertam/curriculum-vitae/resume/README.md
markdown
Other
# Curriculum Vitae My short curriculum vitae or résumé, primarily built with Typst and Nix. The built PDF is PDF/A-2b compliant and optimized, supported by Ghostscript and qpdf. Native PDF/A-2 support is still under [development](https://github.com/typst/typst/issues/2942) in Typst. ## License This project is licensed under the MIT License, except for Typst files (.typ) which are licensed under CC BY-ND 4.0, and all assets under `icons` directory which remain under their respective original licenses. See [LICENSE-MIT](LICENSE-MIT) and [LICENSE-CC-BY-ND](LICENSE-CC-BY-ND) for more information.
https://github.com/SpaceWAGdev/fourier-transform
https://raw.githubusercontent.com/SpaceWAGdev/fourier-transform/main/main.typ
typst
#import "@preview/polylux:0.3.1": * #import "@preview/cetz:0.2.2" #import themes.university: * #set text(lang: "de") #show: university-theme.with(short-title: "Fourier-Transformation", short-author: [Helmbold, Krämer, Stedman], progress-bar: true) #title-slide(title: "Die Fourier-Transformation", institution-name: none, authors: ("<NAME>", "<NAME>", "<NAME>"), date: datetime.today().display("[month]/[year]")) #focus-slide("Was?") #slide[ Aufwickeln von einem Signal auf einem Kreis. Bei den richtigen Windungsfrequenzen geht die $accent(f, hat)$-Funktion $>> 0$. #cetz.canvas(length: 3em, { import cetz.draw: * let opts = (x-tick-step: 1, y-tick-step: 1, size: (3,3), x-min: 0, x-max: 10,y-min: -2, y-max: 2, line: "spline") let data = cetz.plot.add(x => (calc.sin(x) + calc.sin(2 * x)), domain: (0,10), label: $f: x -> sin(x) + sin(2x)$) cetz.plot.plot(axis-style: "school-book", ..opts, {data}, name: "complex_plane", size: (5, 2)) }) ] #focus-slide("Warum?") #slide(title: "Fallbeispiel")[ // TODO: Freibier-song dekomponieren ] #focus-slide("Wie?") #focus-slide[ #align(horizon + center)[ $ i = sqrt(-1) \ "oder" \ x^2 + 1 = 0 $ ] ] #matrix-slide(title: "Komplexe Zahlen", [ #cetz.canvas({ import cetz.draw: * circle((0,0), radius: 5cm , fill: color.hsv(220deg, 255, 255, 50), name: "complex") circle("complex.north", radius: 10mm, fill: white) content("complex.north", $CC$) circle((0, 0), radius: 3.8cm, fill: white, name: "real-imaginary") line("real-imaginary.north", "real-imaginary.south") content((-1.5, 0), $RR$) content((1.5, 0), $II$) }) ], [ #image("complex-plane.svg", width: 100%) // #cetz.canvas(length: 4cm, { // import cetz.draw: * // let opts = (x-tick-step: 1, y-tick-step: 1, size: (3,3), x-label: $RR$, y-label: $II$, grid: true, y-unit: $i$, x-min: -3, y-min: -3, x-max: 3, y-max: 3) // let data = cetz.plot.add(((-1,-1), (1, 2)), mark: "o", mark-size: 10pt, style: (stroke: none)) // cetz.plot.plot(axis-style: "school-book", ..opts, data, name: "complex_plane") // }) ]) #matrix-slide(title: "Die eulersche Identität",[ #show math.equation: set text(40pt) #align(center)[ $e^(i phi) = cos phi + i sin phi \ arrow.b.double $ $e^(i pi) = -1 + 0 i$ ] ], [ #image("euler-identity.svg") ]) #slide(title: "Definition")[ #align(horizon + center)[ / Fourier-Transformation: $ accent(f, hat)(xi) = integral_(-infinity)^(infinity)f(x) e^(-i 2 pi xi x) d x $ / Inverse Fourier-Transformation: $ f(x) = integral_(-infinity)^(infinity)f(xi) e^(i 2 pi xi x) d xi $ ] ] #slide(title: "Bibliographie")[ #bibliography("bib.yaml", full: true, title: none, style: "institute-of-electrical-and-electronics-engineers") ]
https://github.com/AnsgarLichter/light-cv
https://raw.githubusercontent.com/AnsgarLichter/light-cv/main/README.md
markdown
MIT License
![alt text](media/image.png) # CV Template in Typst This is my CV template written in Typst. You can find a two example CVs in this repository as PDFs: - [German CV](https://github.com/AnsgarLichter/light-cv/blob/main/cv-de.pdf) - [English CV](https://github.com/AnsgarLichter/light-cv/blob/main/cv-en.pdf) ## Setup To use the CV you have to install the font awesome fonts for the icons to work. Please refer to the [guide from the font awesome package](https://github.com/duskmoon314/typst-fontawesome). ## Functions 1. `header`: Creates a page haeder including your name, current job title or any other sub title, socials and profile picture - `full-name`: your full name - `job-title`: your current job title rendered below your name - `socials`: array containing all socials. Every social must have the following properties: `icon`, `link` and `text` - `profile-picture`: path to your profile picture 2. `section`: Creates a new section, e. g. `Professional Experience` or `Education` - `title`: section's title 3. `entry`: Adds an entry / item to the current section - `title`: the entry's title, e. g. your job title - `company-or-university`: the name of the institution which you were at, e. g. company or university - `date`: start and end date of this entry, e. g. 2020 - 2022 - `location`: describes where you worked, e. g. London, UK - `logo`: path to the logo of this entry - ``description`: description what you have done - normally supplied as a list ## Customization In the folder `settings` you will a file `styles.typ` which includes all used styles. You can customize them as you want to. ## Multi Language Support If you want to add a new language, copy the `cv-en.typ` and rename it. Afterwards you can adapt the text correspondingly. Maybe I will introduce i18n in the future. ## Insipration A big thanks to [brilliant-CV](https://github.com/mintyfrankie/brilliant-CV) as this project was an inspiraton for my CV and for the scripting. ## Questions & Issues If you have questions, plase create a [discussion](https://github.com/AnsgarLichter/light-cv/discussions). If you have an issue, please create an [issue](https://github.com/AnsgarLichter/light-cv/issues).
https://github.com/jomaway/typst-teacher-templates
https://raw.githubusercontent.com/jomaway/typst-teacher-templates/main/ttt-lists/lib/lib.typ
typst
MIT License
#import "studentlist.typ"
https://github.com/sitandr/typst-examples-book
https://raw.githubusercontent.com/sitandr/typst-examples-book/main/src/snippets/index.md
markdown
MIT License
# Typst Snippets Useful snippets for common (and not) tasks.
https://github.com/TypstApp-team/typst
https://raw.githubusercontent.com/TypstApp-team/typst/master/tests/typ/compute/data.typ
typst
Apache License 2.0
// Test reading structured data and files. // Ref: false --- // Test reading plain text files #let data = read("/files/hello.txt") #test(data, "Hello, world!\n") --- // Error: 18-38 file not found (searched at files/missing.txt) #let data = read("/files/missing.txt") --- // Error: 18-34 file is not valid utf-8 #let data = read("/files/bad.txt") --- // Test reading CSV data. // Ref: true #set page(width: auto) #let data = csv("/files/zoo.csv") #let cells = data.at(0).map(strong) + data.slice(1).flatten() #table(columns: data.at(0).len(), ..cells) --- // Error: 6-16 file not found (searched at typ/compute/nope.csv) #csv("nope.csv") --- // Error: 6-22 failed to parse CSV (found 3 instead of 2 fields in line 3) #csv("/files/bad.csv") --- // Test reading JSON data. #let data = json("/files/zoo.json") #test(data.len(), 3) #test(data.at(0).name, "Debby") #test(data.at(2).weight, 150) --- // Error: 7-24 failed to parse JSON (expected value at line 3 column 14) #json("/files/bad.json") --- // Test reading TOML data. #let data = toml("/files/toml-types.toml") #test(data.string, "wonderful") #test(data.integer, 42) #test(data.float, 3.14) #test(data.boolean, true) #test(data.array, (1, "string", 3.0, false)) #test(data.inline_table, ("first": "amazing", "second": "greater") ) #test(data.table.element, 5) #test(data.table.others, (false, "indeed", 7)) #test(data.date_time, datetime( year: 2023, month: 2, day: 1, hour: 15, minute: 38, second: 57, )) #test(data.date_time2, datetime( year: 2023, month: 2, day: 1, hour: 15, minute: 38, second: 57, )) #test(data.date, datetime( year: 2023, month: 2, day: 1, )) #test(data.time, datetime( hour: 15, minute: 38, second: 57, )) --- // Error: 7-24 failed to parse TOML (expected `.`, `=` at line 1 column 16) #toml("/files/bad.toml") --- // Test reading YAML data #let data = yaml("/files/yaml-types.yaml") #test(data.len(), 9) #test(data.null_key, (none, none)) #test(data.string, "text") #test(data.integer, 5) #test(data.float, 1.12) #test(data.mapping, ("1": "one", "2": "two")) #test(data.seq, (1,2,3,4)) #test(data.bool, false) #test(data.keys().contains("true"), true) #test(data.at("1"), "ok") --- // Error: 7-24 failed to parse YAML (did not find expected ',' or ']' at line 2 column 1, while parsing a flow sequence at line 1 column 18) #yaml("/files/bad.yaml") --- // Test reading XML data. #let data = xml("/files/data.xml") #test(data, (( tag: "data", attrs: (:), children: ( "\n ", (tag: "hello", attrs: (name: "hi"), children: ("1",)), "\n ", ( tag: "data", attrs: (:), children: ( "\n ", (tag: "hello", attrs: (:), children: ("World",)), "\n ", (tag: "hello", attrs: (:), children: ("World",)), "\n ", ), ), "\n", ), ),)) --- // Error: 6-22 failed to parse XML (found closing tag 'data' instead of 'hello' in line 3) #xml("/files/bad.xml")
https://github.com/0xmycf/typst-template
https://raw.githubusercontent.com/0xmycf/typst-template/main/Prelude.typ
typst
#let applyStyle( author: "mycf" , title: "Template" , bibPath: "./bib.bib" , lang: "de" , doc ) = { /******************************************************************************** * Document ********************************************************************************/ set document( title: title , author: author ) /******************************************************************************** * Page ********************************************************************************/ set page( paper: "a4" , margin: ( top: 3cm , bottom: 3cm , right: 3cm , left: 3cm ) , header: align(right)[ #set text(12pt) #smallcaps[#author] #h(1fr) #title ] , numbering: "1" ) /******************************************************************************** * Text ********************************************************************************/ set text( font: ( "KpRoman" , "Courier New" , "Times New Roman" , "Fira Code" , "Noto Sans CJK TC" , "Adobe Kaiti Std" ) , fallback: false // so we don't inject some proprietary font , style: "normal" , weight: "regular" , overhang: false // true might make pars visually more pleasing , lang: lang , ligatures: true , number-type: "lining" // I like this more in text , slashed-zero: true , fractions: false // displays 3/4 as one glyph , size: 12pt ) show raw: set text( font: ( "Fira Code" ) // buggy otherwise , fractions: false ) /******************************************************************************** * paragraphs ********************************************************************************/ set par(justify: true) // idk if this is the proper way show heading.where( level: 1 ): it => { it v(0.4em) } show heading.where( level: 2 ): it => { it v(0.3em) } show heading.where( level: 3 ): it => { it v(0.2em) } show heading.where( level: 4 ): it => [ *#it.body:* ] /******************************************************************************** * Headings ********************************************************************************/ set heading(numbering: "1.1.1") /******************************************************************************** * outline ********************************************************************************/ set outline( depth: 3 , indent: true ) /******************************************************************************** * Bibliography ********************************************************************************/ set bibliography(style: "apa") set bibliography(title: "Literaturverzeichnis") if lang == "de" /******************************************************************************** * * Content * ********************************************************************************/ set page(numbering: "I") outline() pagebreak() set page(numbering: "1") counter(page).update(1) doc pagebreak() set page(numbering: "i") counter(page).update(1) bibliography(bibPath) } // this is not the correct way to do this #let citep(..keys) = cite(..keys, brackets: false)
https://github.com/protohaven/printed_materials
https://raw.githubusercontent.com/protohaven/printed_materials/main/common-tools/metal_grinder_dust_collection.typ
typst
#import "/meta-environments/env-features.typ": * = Metal Shop Dust Collection (Grinder Area) Dust collection is an important part of any shop. Dust is a health hazard: dust is an irritant, and specific sizes of dust particles (PM2.5) can lodge in the lungs and accumulate there, leading to long-term and possibly severe health issues. Dust is also hard on metal tools, and can encourage surface rust and pitting. == Notes === Safety Always use the metal grinder dust collector when using the bench grinders or the disk grinder. Check the ducting from the metal dust collector to the grinders. Make sure all of the ducts are attached firmly to the grinders. == Parts of the Metal Shop Dust Collection === Front Quarter View #figure( image("./images/metal_dust_collection-annotated.png", width: 100%), caption: [An annotated view of the metal dust collection in the grinder area.] ) === On/Off Switch Put the switch in the *on* position to turn on the metal dust collection. Put the switch in the *off* position to turn off the metal dust collection. == Basic Operation === Setting Up Turn on the metal dust collection before grinding. === Cleaning Up Turn off the metal dust collection after grinding.
https://github.com/AU-Master-Thesis/thesis
https://raw.githubusercontent.com/AU-Master-Thesis/thesis/main/lib/statistics.typ
typst
MIT License
#let mean(xs) = xs.sum() / xs.len() // #let median(xs) = { // let xs = xs.sort(); // let n = xs.len(); // if n % 2 == 0 { // (xs[n / 2 - 1] + xs[n / 2]) / 2 // } else { // xs[n / 2] // } // }
https://github.com/Area-53-Robotics/53E-Notebook-Over-Under-2023-2024
https://raw.githubusercontent.com/Area-53-Robotics/53E-Notebook-Over-Under-2023-2024/giga-notebook/entries/robot-rebuild/brainstorm.typ
typst
Creative Commons Attribution Share Alike 4.0 International
#import "/packages.typ": notebookinator #import notebookinator: * #import themes.radial.components: * #import "/utils.typ": grid #show: create-body-entry.with( title: "Brainstorm: Robot Rebuild", type: "brainstorm", date: datetime(year: 2024, month: 3, day: 5), author: "<NAME>", witness: "<NAME>", ) = Options Originally it seemed like having our robot be optimized for both skills and match play seemed like a conflict of interest. Match play almost never uses shooting mechanisms, and if your elevation tier isn't above A tier, then elevating during skills is also useless. We came up with some options to reduce the amount of compromise we'd have to make: #grid( // columns: (1fr, 1fr), [ // == Modular Shooting Mechanism/Elevation Since a low tier hang mechanism and a shooting mechanism typically aren't used together, we thought we could make them detachable. This way we could only use what we need. This design seems like the best balance between simplicity and competitive viability. While there are maybe more optimal configurations, they are also more complex, and will take longer to build/debug. #pro-con(pros: [ - Only field what subsystems we need at the time (no extra weight) ], cons: [ - Swapping subsystems will take time ]) ], image("./modular.svg", width: 70%), [ == PTO to Elevation This design uses a power transfer off (PTO) to transfer the power of the drivetrain to the elevation mechanism at the end of the match. This is a design we considered earlier in the season, but we decided we didn't have enough time to complete it. With a lot more power to work with this design can pull the robot much farther into the air than any of our other ideas so far. This also means that the elevation mechanism becomes useful during both match play and skills. #pro-con(pros: [ - Very high hang potential - No need to swap subsystems ], cons: [ - Shooting mechanism is mounted during match play - Complicated to build ]) ], image("./pto.svg", width: 70%), [ == Descore Bot This bot is as flat as possible to fit under the goal. This bot layout would be extremely simple and generally only useful during matches. It lacks a shooting mechanism, and prioritizes a fast and small drivetrain over everything else. #pro-con(pros: [ - Good for match play ], cons: [ - Very simple to build - Doesn't perform well during skills ]) ], image("./descore.svg"), )
https://github.com/sa-concept-refactoring/doc
https://raw.githubusercontent.com/sa-concept-refactoring/doc/main/chapters/projectManagement.typ
typst
= Project Management <project_management> The approach of the project is explained in @approach. The planning of the project is looked into in @project-plan, including a comparative analysis between the initial plan and its effective implementation. Finally, @time-tracking provides a summarized overview of the allocated working hours coupled with a reflective assessment of the time invested. == Approach <approach> To discuss the ongoing process a weekly meeting with the advisor was held where it was discussed what work has been done and what is planned for the next week. Receiving a feedback of the ongoing development is quite important as the direction we are going towards can be assessed and adjusted in just a week. The development is managed using GitHub as described in @development_process. For better overview on what is already done, pull requests are used to review each others changes. This same method is also used for writing the documentation which allows tracking all changes easily. For the documentation, Typst @typst was used, which is a new markup-based typesetting system. In VS Code, there is an extension supporting Typst @typst_extension, no other tool is needed. After the document had a stable state, pull requests were used here as well to double-check that both team members agree on what the other was writing about. GitHub issues @github_issues were sometimes also used to keep track of the documentations state. The project is split into three main steps. / Project Setup : #[ Before implementing a project, a setup needs to be in place, therefore some research needed to be done to figure out what is needed to build the LLVM project and clangd specifically. The setup needed to work on Linux and Windows as both systems were used for this project. ] / Analysis : #[ The analysis consists of a lot of research on how the clangd language server works and how it is communicating with the IDE. This step also contains cathering all knowledge needed for implementation, such as looking into the idea of concepts and figuring out which refactoring features would be a good addition to have within the language server. ] / Implementation and Finalization: #[ In the implementation phase the actual refactoring features are implemented according to the analysis. To make the implementation ready for contribution it needs to be refined, which means the code needs to be readable and follow the development guidelines @llvm_coding_standards. When the refinement is done, a pull request can be created to contribute the changes upstream and to finalize the implementation step. ] #set page(flipped: true) == Project Plan <project-plan> The project plan was developed in week 3 after the ideas for the refactoring features were set. Without concrete ideas a good project plan can not be worked out. The documentation part is spread over the whole project duration as it is important to keep it up to date and consistent. All implementation work should be completed two weeks before the deadline to ensure that the documentation is finished and ready for submission. @project-plan-figure shows the project plan (on top, in lighter hue) compared to the actual progress made (on the bottom, in darker hue). There is almost no deviation from the plan, except for the first refactoring, which was implemented faster than expected, and the documentation, where the abstract and management summary were written before the refinement phase, because of the earlier submission date. #[ #show figure: set block(width: 100%) #figure([ #let numberOfWeeks = 14 #let epic( title: none, startWeek: int, backgroundColor: color, foregroundColor: color, inset: 6.5pt, textSize: 0.75em, itemStroke: white + 2pt, items ) = [ #set align(start) #let itemBox(width, content) = box( width: 100% * width / (numberOfWeeks - (startWeek - 1)), inset: inset, fill: backgroundColor, stroke: itemStroke, text( spacing: 100%, fill: foregroundColor, weight: "bold", content ), ) #pad(left: 100% * (startWeek - 1) / numberOfWeeks, [ #set text(size: textSize) #if title != none [ #v(0.6cm) *#title* \ ] #set text(spacing: 0%) #for item in items { itemBox(item.at(0), item.at(1)) } #v(-0.6cm) ]) ] #epic( startWeek: 1, backgroundColor: aqua, foregroundColor: black, inset: 4pt, itemStroke: none, range(1, numberOfWeeks + 1) .map(weekNum => (1, align(center, [w#str(weekNum)]))), ) #epic( title: "Documentation", startWeek: 1, backgroundColor: blue.lighten(50%), foregroundColor: white, ( (2, "Setup"), (7, "Ongoing documentation"), (2, "Refinement"), (2, [Abstract & MS #footnote[Management Summary]<MS>]), (1, "Final"), ), ) #epic( startWeek: 1, backgroundColor: blue, foregroundColor: white, ( (2, "Setup"), (7, "Ongoing documentation"), (2, [Abstract & MS @MS]), (2, "Refinement"), (1, "Final"), ), ) #epic( title: "1. Refactoring", startWeek: 2, backgroundColor: maroon.lighten(50%), foregroundColor: white, ( (2, "Analysis"), (3, "Implementation"), (2, [Refinement & PR #footnote[Pull Request]<PR>]), ), ) #epic( startWeek: 2, backgroundColor: maroon, foregroundColor: white, ( (1, "Analysis"), (3, "Implementation"), (2, [Refinement & PR @PR]), ), ) #epic( title: "2. Refactoring", startWeek: 6, backgroundColor: orange.lighten(50%), foregroundColor: white, ( (2, "Analysis"), (3, "Implementation"), (2, [Refinement & PR @PR]), ), ) #epic( startWeek: 6, backgroundColor: orange, foregroundColor: white, ( (1, "Analysis"), (4, "Implementation"), (2, [Refinement & PR @PR]), ), ) #v(1cm) ], caption: "Project plan") <project-plan-figure> ] #pagebreak() #set page(flipped: false) == Time Tracking <time-tracking> To monitor the working hours effectively, a Google Sheet was established where information about the time spent was meticulously recorded. Each record contains a date, the amount of time spent, name of executor, task category and a brief comment detailing the specific work performed during that time. @time-tracking-report-1 and @time-tracking-report-2 show the total time spent on each category per project week. @time-invested-per-category shows the share of time invested per category. Most of the time spent was invested into the documentation and implementation, with the former being the main focus at the end of the project. @time-invested-per-person shows the time spent by each project author. Both authors contributed a similar amount to both documentation and implementation. #figure( image("../images/time_invested_per_category_and_project_week.png"), kind: table, caption: "Time invested per category and project week", ) <time-tracking-report-1> #figure( image("../images/time_invested_per_category_and_project_week.svg"), caption: "Time invested per category and project week", ) <time-tracking-report-2> #figure( image("../images/time_invested_per_category.svg", width: 80%), caption: "Time invested per category", ) <time-invested-per-category> #figure( image("../images/time_invested_per_person.svg", width: 80%), caption: "Time invested per person", ) <time-invested-per-person>
https://github.com/DashieTM/ost-5semester
https://raw.githubusercontent.com/DashieTM/ost-5semester/main/compiler/summary.typ
typst
#set page( "a4", columns: 4, flipped: true, foreground: [ #columns(4, [#line(stroke: .5pt + black, start: (105%, 2%), end: (105%, 98%)), #colbreak() #line(stroke: .5pt + black, start: (-51%, 2%), end: (-51%, 98%)) #colbreak() #line(stroke: .5pt + black, start: (-54%, 2%), end: (-54%, 98%)) ]) ], margin: 12pt, ) #set columns(gutter: 2pt) #set text(12pt, font: "Arial", spacing: 50%, stretch: 10%) #set list(spacing: 0pt, tight: true, body-indent: 0em) #set block(below: 0.5em) #text(blue)[*Lexer*]\ - Input: text, Output: Tokens (Lexems) - remove comments and whitespaces - remember error location for debugging purposes - token: fixtoken, identifiertoken, stringtoken, integertoken #text(blue)[*Regular Language*]\ A language is only regular in EBNF if it doesn't feature recursion.\ A lexer can only use regular languages, as it's otherwise not deterministic. Integer = Digit [ Integer ]. should be made to Integer = Digit { Digit }. - #text(red)[Lexer: regular language] - #text(red)[parser: context free language] - #text(red)[semantic checker: context-sensitive language] #text(blue)[*Extended Backus Naur*]\ Expression = "A" "B" | { "B" } | [ "C" ]\ Term = Expression + "Number" A and B OR\ one or more B OR 0 or more C\ #text(red)[Note, for a lexer, the grammar needs to be specific:] Expression = "Number" | Expression + Expression\ This results in issues since the resulting grammar can mean number + expression or expression + number\ #text(blue)[*Parser*]\ Input: tokens, Output: Syntax Tree and/or AST(Abstract Syntax Tree)\ recursive rules allowed here -> not regular\ bottom-up(LR(k)) or top-down(LL(k))\ L: left to right, LR: top or bottom, k: lookup amount\ - top-down: Expr → Term + Term → ... → 1 + (2 - 3) #text(blue)[*Recursive Descent*]\ - one function per non terminal symbol - parseExpression, parseTerm, parseFactor - lookahead -> tokens.peek() or similar - can be 1 or more - also resolved by restructuring EBNF - stack via method calls -> push down automaton - predictive direct, always clear what is taken, (preferred) - backtracking, just don't dude #text(blue)[*Bottom Up:*]Expr ← Term + Term ← ... ← 1 + (2 - 3)\ - read until reduceable -> aka until match rule in EBNF - SHIFT, REDUCE, ACCEPT, ERROR - if no match is found shift -> aka move right with token - #text(red)[less performance, but more powerful compared to LL] - LR(0) -> no lookup, table(EBNF) is enough - SLR(k) (Simple LR) - lookahead on reduce to solve conflicts - no new states - LALR(Look-Ahear LR) - analyzes language on LR(0) conflicts - uses lookahead on conflicts with solves it with new states - LR(k) - per (grammar step + lookahead) one state - not pragmatical #text(blue)[*Semantic Analysis*]\ - different scopes -> global scope, method scope etc. - differentiation between reference and primitive types - reference variables need additional information - structure\ 1: create all declared types\ traverse AST, start with global scope\ 2: resolve types of all declarations\ go into identifier and resolve to declaration\ add ClassSymbol, TypeSymbols etc into variable symbols\ 3: resolve usage of types in AST\ add type to symbol\ 4: check types in AST\ post-order traversal -> check if types match\ additional checks:\ operators ,redeclarations, only one main method, array length read only, return methods match, left hand of expression #text(blue)[*Code Generation*]\ - turns code into either byte-code or machine-code - usually done with evaluation stack - registers for machine code (not for byte code!) - byte code languages need to store additional metadata -> types etc - variable names will still be stored as numbers -> mangling - structure + traverse symboltable - create bytecode metdata + traverse AST per method - create instructions via bytecode assembler + serialize in output format - backpatching: expressions that move lines up or down... - traversal order: - expressions: post-order - statements: depends on code template - parameters: load like in assembly #text(blue)[*VM*]\ #text(blue)[*Loader*]\ - loads file into memory - creates metadata for classes and methods, variables, etc. - defines layouts for fields, variables, parameters - resolves references to methods, types and other assemblies → patching - initializes program -> interpreter or JIT - optional: Code verification #text(blue)[*Interpreter*]\ - interpreter loop - emulates one instruction after the other - instruction pointer (IP) - address of the next instruction - evaluation stack - virtual version for the VM - locals and parameters for active methods - method descriptor for active method - terms: - activation frame -> data of current method, including its own evaluation stack - call stack -> stack of activation frames according to call order - call stack managed for interpreter -> unmanaged in HW #text(blue)[*Verification*]\ - check for errors or manipulation - at runtime -> verification in interpreter\ check types -> CheckInt(Pop()), check jumps, check op codes, stack over or underflow, index bounds etc. - at loading -> static analysis #text(blue)[*OOP shit*]\ - Ancestor Table -> Array - first: root parent, last: self - works only on single inheritance, but has constant time - Vtable - linear -> one by one, works only with single inheritance - fixed method -> each method has a fixed position in the Vtable - Vtable interfaces: - fixed method is hard with multiple interfaces! - double array: store methods in a separate array for each interface - flexible, but costs memory and has indirection overhead - offset based: more complex, but solves the issue #text(blue)[*Garbage Collector*]\ - can only be done with metadata -> gc without it is not feasible! - behavior based gc have been tried, they do not work - solves dangling pointers and memory leaks - structure\ 1: (mark phase)mark all objects in root set - Pointer Rotation Algorithm - or just traverse recursive (requires more memory!) 2: (sweep phase)if marked(linear scan), ignore, else free\ #text(purple)[Note, this requires the program(mutator) to stop running.] - root set - pointers in parameter, local variables, evaluation stack and this-reference #text(blue)[*Free List*]\ - holds pointers to free memory - various allocation strategies - first-fit -> (default) first fitting block - best fit -> sort ascending on size, creates unusable fragments - worst fit -> sort descending on size -> find block immediately - segregated free list -> different free list with different blocksizes can exist - #text(purple)[remerge empty space on sweep] - buddy system -> linux -> take smallest block possible divide by 2 - if bigger than double your memory -> divide block by 2 - remerging of divided empty blocks #text(blue)[*Reference Counting*]\ - can also solve garbage collection - uses strong and weak references - so called "teure" updates - atomic or unatomic #text(blue)[*Finalizer*]\ - run when object becomes garbage -> after mark - can lead to resurrection in java - done via finalizer set which has weak reference - put into pending queue which gets a *new* strong reference - hence object not cleaned - #text(red)[GC now requires 2 mark phases before sweep!]\ One with finalizer and one without - can create new objects - can potentially crash - runs only once (optional rerun for dotnot) - *order of finalizer is undefined!* #text(blue)[*other GCs*]\ - Compacting GC -> mark and copy - allocate at end of list and copy non garbage to front - not possible without metadata - Incremental GC - ""parallel"" to program -> small increments of GC -> GO - Generational GC -> G2, G1, G0 - old objects live longer - references from old to new - if old is cleaned -> newer cleaned - objects move from one generation to the other - write barriers when writing into references of other generations - Paritioned GC - move objects into an empty partition, sweep now fully garbage partition - concurrent marking with a second mark phase that stops program - requires forwarding pointers for concurrent *evacuation* of objects - *and read barriers*! #text(blue)[*JIT*]\ - hot spot -> code that is run again and again -> usually loops - checked with profiling -> how many times did i run this code -> increment #text(blue)[*Processor Registers*]\ - local AL bit 0-7, AH bit 0-7, AX bit 0-15, EAX bit 0-31, RAX bit 0-63, RSP stack pointer, RBP base pointer, RIP instruction pointer - global (depends on OS) - RDI, RSI, RDX, RXS, R8, R9 - #text( purple, )[used for parameters -> global are not overwritten on function call!] - register clobbering - some operations overwrite registers, make sure you saved values from there before (idiv -> RAX RDX) - op codes in smallj -> 1-p parameters -> p+1 - unlimited locals #text(blue)[*Code Optimization*]\ - convert divisions, multiplications and modulo to bit operations -> cheaper - run expressions in code at compile time - constant propagation -> can also apply to variables that do not change! - expressions that do not change in loops can be extracted into a variable -> no op - in general multiple operations for the same value -> into variable - removal of dead code - redundant code e.g. unnecessary variables removed and expression inlined, reversal of extraction - copy propagation - Static Single Assignment (SSA) - re-assigment to new variable, this allows for numbering of variable - if old variable is never used, drop - Peephole Optimization - peek next op codes, substitution op
https://github.com/frectonz/the-pg-book
https://raw.githubusercontent.com/frectonz/the-pg-book/main/book/054.%20love.html.typ
typst
love.html How to Do What You Love Want to start a startup? Get funded by Y Combinator. January 2006To do something well you have to like it. That idea is not exactly novel. We've got it down to four words: "Do what you love." But it's not enough just to tell people that. Doing what you love is complicated.The very idea is foreign to what most of us learn as kids. When I was a kid, it seemed as if work and fun were opposites by definition. Life had two states: some of the time adults were making you do things, and that was called work; the rest of the time you could do what you wanted, and that was called playing. Occasionally the things adults made you do were fun, just as, occasionally, playing wasn't — for example, if you fell and hurt yourself. But except for these few anomalous cases, work was pretty much defined as not-fun.And it did not seem to be an accident. School, it was implied, was tedious because it was preparation for grownup work.The world then was divided into two groups, grownups and kids. Grownups, like some kind of cursed race, had to work. Kids didn't, but they did have to go to school, which was a dilute version of work meant to prepare us for the real thing. Much as we disliked school, the grownups all agreed that grownup work was worse, and that we had it easy.Teachers in particular all seemed to believe implicitly that work was not fun. Which is not surprising: work wasn't fun for most of them. Why did we have to memorize state capitals instead of playing dodgeball? For the same reason they had to watch over a bunch of kids instead of lying on a beach. You couldn't just do what you wanted.I'm not saying we should let little kids do whatever they want. They may have to be made to work on certain things. But if we make kids work on dull stuff, it might be wise to tell them that tediousness is not the defining quality of work, and indeed that the reason they have to work on dull stuff now is so they can work on more interesting stuff later. [1]Once, when I was about 9 or 10, my father told me I could be whatever I wanted when I grew up, so long as I enjoyed it. I remember that precisely because it seemed so anomalous. It was like being told to use dry water. Whatever I thought he meant, I didn't think he meant work could literally be fun — fun like playing. It took me years to grasp that.JobsBy high school, the prospect of an actual job was on the horizon. Adults would sometimes come to speak to us about their work, or we would go to see them at work. It was always understood that they enjoyed what they did. In retrospect I think one may have: the private jet pilot. But I don't think the bank manager really did.The main reason they all acted as if they enjoyed their work was presumably the upper-middle class convention that you're supposed to. It would not merely be bad for your career to say that you despised your job, but a social faux-pas.Why is it conventional to pretend to like what you do? The first sentence of this essay explains that. If you have to like something to do it well, then the most successful people will all like what they do. That's where the upper-middle class tradition comes from. Just as houses all over America are full of chairs that are, without the owners even knowing it, nth-degree imitations of chairs designed 250 years ago for French kings, conventional attitudes about work are, without the owners even knowing it, nth-degree imitations of the attitudes of people who've done great things.What a recipe for alienation. By the time they reach an age to think about what they'd like to do, most kids have been thoroughly misled about the idea of loving one's work. School has trained them to regard work as an unpleasant duty. Having a job is said to be even more onerous than schoolwork. And yet all the adults claim to like what they do. You can't blame kids for thinking "I am not like these people; I am not suited to this world."Actually they've been told three lies: the stuff they've been taught to regard as work in school is not real work; grownup work is not (necessarily) worse than schoolwork; and many of the adults around them are lying when they say they like what they do.The most dangerous liars can be the kids' own parents. If you take a boring job to give your family a high standard of living, as so many people do, you risk infecting your kids with the idea that work is boring. [2] Maybe it would be better for kids in this one case if parents were not so unselfish. A parent who set an example of loving their work might help their kids more than an expensive house. [3]It was not till I was in college that the idea of work finally broke free from the idea of making a living. Then the important question became not how to make money, but what to work on. Ideally these coincided, but some spectacular boundary cases (like Einstein in the patent office) proved they weren't identical.The definition of work was now to make some original contribution to the world, and in the process not to starve. But after the habit of so many years my idea of work still included a large component of pain. Work still seemed to require discipline, because only hard problems yielded grand results, and hard problems couldn't literally be fun. Surely one had to force oneself to work on them.If you think something's supposed to hurt, you're less likely to notice if you're doing it wrong. That about sums up my experience of graduate school.BoundsHow much are you supposed to like what you do? Unless you know that, you don't know when to stop searching. And if, like most people, you underestimate it, you'll tend to stop searching too early. You'll end up doing something chosen for you by your parents, or the desire to make money, or prestige — or sheer inertia.Here's an upper bound: Do what you love doesn't mean, do what you would like to do most this second. Even Einstein probably had moments when he wanted to have a cup of coffee, but told himself he ought to finish what he was working on first.It used to perplex me when I read about people who liked what they did so much that there was nothing they'd rather do. There didn't seem to be any sort of work I liked that much. If I had a choice of (a) spending the next hour working on something or (b) be teleported to Rome and spend the next hour wandering about, was there any sort of work I'd prefer? Honestly, no.But the fact is, almost anyone would rather, at any given moment, float about in the Carribbean, or have sex, or eat some delicious food, than work on hard problems. The rule about doing what you love assumes a certain length of time. It doesn't mean, do what will make you happiest this second, but what will make you happiest over some longer period, like a week or a month.Unproductive pleasures pall eventually. After a while you get tired of lying on the beach. If you want to stay happy, you have to do something.As a lower bound, you have to like your work more than any unproductive pleasure. You have to like what you do enough that the concept of "spare time" seems mistaken. Which is not to say you have to spend all your time working. You can only work so much before you get tired and start to screw up. Then you want to do something else — even something mindless. But you don't regard this time as the prize and the time you spend working as the pain you endure to earn it.I put the lower bound there for practical reasons. If your work is not your favorite thing to do, you'll have terrible problems with procrastination. You'll have to force yourself to work, and when you resort to that the results are distinctly inferior.To be happy I think you have to be doing something you not only enjoy, but admire. You have to be able to say, at the end, wow, that's pretty cool. This doesn't mean you have to make something. If you learn how to hang glide, or to speak a foreign language fluently, that will be enough to make you say, for a while at least, wow, that's pretty cool. What there has to be is a test.So one thing that falls just short of the standard, I think, is reading books. Except for some books in math and the hard sciences, there's no test of how well you've read a book, and that's why merely reading books doesn't quite feel like work. You have to do something with what you've read to feel productive.I think the best test is one Gino Lee taught me: to try to do things that would make your friends say wow. But it probably wouldn't start to work properly till about age 22, because most people haven't had a big enough sample to pick friends from before then.SirensWhat you should not do, I think, is worry about the opinion of anyone beyond your friends. You shouldn't worry about prestige. Prestige is the opinion of the rest of the world. When you can ask the opinions of people whose judgement you respect, what does it add to consider the opinions of people you don't even know? [4]This is easy advice to give. It's hard to follow, especially when you're young. [5] Prestige is like a powerful magnet that warps even your beliefs about what you enjoy. It causes you to work not on what you like, but what you'd like to like.That's what leads people to try to write novels, for example. They like reading novels. They notice that people who write them win Nobel prizes. What could be more wonderful, they think, than to be a novelist? But liking the idea of being a novelist is not enough; you have to like the actual work of novel-writing if you're going to be good at it; you have to like making up elaborate lies.Prestige is just fossilized inspiration. If you do anything well enough, you'll make it prestigious. Plenty of things we now consider prestigious were anything but at first. Jazz comes to mind — though almost any established art form would do. So just do what you like, and let prestige take care of itself.Prestige is especially dangerous to the ambitious. If you want to make ambitious people waste their time on errands, the way to do it is to bait the hook with prestige. That's the recipe for getting people to give talks, write forewords, serve on committees, be department heads, and so on. It might be a good rule simply to avoid any prestigious task. If it didn't suck, they wouldn't have had to make it prestigious.Similarly, if you admire two kinds of work equally, but one is more prestigious, you should probably choose the other. Your opinions about what's admirable are always going to be slightly influenced by prestige, so if the two seem equal to you, you probably have more genuine admiration for the less prestigious one.The other big force leading people astray is money. Money by itself is not that dangerous. When something pays well but is regarded with contempt, like telemarketing, or prostitution, or personal injury litigation, ambitious people aren't tempted by it. That kind of work ends up being done by people who are "just trying to make a living." (Tip: avoid any field whose practitioners say this.) The danger is when money is combined with prestige, as in, say, corporate law, or medicine. A comparatively safe and prosperous career with some automatic baseline prestige is dangerously tempting to someone young, who hasn't thought much about what they really like.The test of whether people love what they do is whether they'd do it even if they weren't paid for it — even if they had to work at another job to make a living. How many corporate lawyers would do their current work if they had to do it for free, in their spare time, and take day jobs as waiters to support themselves?This test is especially helpful in deciding between different kinds of academic work, because fields vary greatly in this respect. Most good mathematicians would work on math even if there were no jobs as math professors, whereas in the departments at the other end of the spectrum, the availability of teaching jobs is the driver: people would rather be English professors than work in ad agencies, and publishing papers is the way you compete for such jobs. Math would happen without math departments, but it is the existence of English majors, and therefore jobs teaching them, that calls into being all those thousands of dreary papers about gender and identity in the novels of Conrad. No one does that kind of thing for fun.The advice of parents will tend to err on the side of money. It seems safe to say there are more undergrads who want to be novelists and whose parents want them to be doctors than who want to be doctors and whose parents want them to be novelists. The kids think their parents are "materialistic." Not necessarily. All parents tend to be more conservative for their kids than they would for themselves, simply because, as parents, they share risks more than rewards. If your eight year old son decides to climb a tall tree, or your teenage daughter decides to date the local bad boy, you won't get a share in the excitement, but if your son falls, or your daughter gets pregnant, you'll have to deal with the consequences.DisciplineWith such powerful forces leading us astray, it's not surprising we find it so hard to discover what we like to work on. Most people are doomed in childhood by accepting the axiom that work = pain. Those who escape this are nearly all lured onto the rocks by prestige or money. How many even discover something they love to work on? A few hundred thousand, perhaps, out of billions.It's hard to find work you love; it must be, if so few do. So don't underestimate this task. And don't feel bad if you haven't succeeded yet. In fact, if you admit to yourself that you're discontented, you're a step ahead of most people, who are still in denial. If you're surrounded by colleagues who claim to enjoy work that you find contemptible, odds are they're lying to themselves. Not necessarily, but probably.Although doing great work takes less discipline than people think — because the way to do great work is to find something you like so much that you don't have to force yourself to do it — finding work you love does usually require discipline. Some people are lucky enough to know what they want to do when they're 12, and just glide along as if they were on railroad tracks. But this seems the exception. More often people who do great things have careers with the trajectory of a ping-pong ball. They go to school to study A, drop out and get a job doing B, and then become famous for C after taking it up on the side.Sometimes jumping from one sort of work to another is a sign of energy, and sometimes it's a sign of laziness. Are you dropping out, or boldly carving a new path? You often can't tell yourself. Plenty of people who will later do great things seem to be disappointments early on, when they're trying to find their niche.Is there some test you can use to keep yourself honest? One is to try to do a good job at whatever you're doing, even if you don't like it. Then at least you'll know you're not using dissatisfaction as an excuse for being lazy. Perhaps more importantly, you'll get into the habit of doing things well.Another test you can use is: always produce. For example, if you have a day job you don't take seriously because you plan to be a novelist, are you producing? Are you writing pages of fiction, however bad? As long as you're producing, you'll know you're not merely using the hazy vision of the grand novel you plan to write one day as an opiate. The view of it will be obstructed by the all too palpably flawed one you're actually writing."Always produce" is also a heuristic for finding the work you love. If you subject yourself to that constraint, it will automatically push you away from things you think you're supposed to work on, toward things you actually like. "Always produce" will discover your life's work the way water, with the aid of gravity, finds the hole in your roof.Of course, figuring out what you like to work on doesn't mean you get to work on it. That's a separate question. And if you're ambitious you have to keep them separate: you have to make a conscious effort to keep your ideas about what you want from being contaminated by what seems possible. [6]It's painful to keep them apart, because it's painful to observe the gap between them. So most people pre-emptively lower their expectations. For example, if you asked random people on the street if they'd like to be able to draw like Leonardo, you'd find most would say something like "Oh, I can't draw." This is more a statement of intention than fact; it means, I'm not going to try. Because the fact is, if you took a random person off the street and somehow got them to work as hard as they possibly could at drawing for the next twenty years, they'd get surprisingly far. But it would require a great moral effort; it would mean staring failure in the eye every day for years. And so to protect themselves people say "I can't."Another related line you often hear is that not everyone can do work they love — that someone has to do the unpleasant jobs. Really? How do you make them? In the US the only mechanism for forcing people to do unpleasant jobs is the draft, and that hasn't been invoked for over 30 years. All we can do is encourage people to do unpleasant work, with money and prestige.If there's something people still won't do, it seems as if society just has to make do without. That's what happened with domestic servants. For millennia that was the canonical example of a job "someone had to do." And yet in the mid twentieth century servants practically disappeared in rich countries, and the rich have just had to do without.So while there may be some things someone has to do, there's a good chance anyone saying that about any particular job is mistaken. Most unpleasant jobs would either get automated or go undone if no one were willing to do them.Two RoutesThere's another sense of "not everyone can do work they love" that's all too true, however. One has to make a living, and it's hard to get paid for doing work you love. There are two routes to that destination: The organic route: as you become more eminent, gradually to increase the parts of your job that you like at the expense of those you don't.The two-job route: to work at things you don't like to get money to work on things you do. The organic route is more common. It happens naturally to anyone who does good work. A young architect has to take whatever work he can get, but if he does well he'll gradually be in a position to pick and choose among projects. The disadvantage of this route is that it's slow and uncertain. Even tenure is not real freedom.The two-job route has several variants depending on how long you work for money at a time. At one extreme is the "day job," where you work regular hours at one job to make money, and work on what you love in your spare time. At the other extreme you work at something till you make enough not to have to work for money again.The two-job route is less common than the organic route, because it requires a deliberate choice. It's also more dangerous. Life tends to get more expensive as you get older, so it's easy to get sucked into working longer than you expected at the money job. Worse still, anything you work on changes you. If you work too long on tedious stuff, it will rot your brain. And the best paying jobs are most dangerous, because they require your full attention.The advantage of the two-job route is that it lets you jump over obstacles. The landscape of possible jobs isn't flat; there are walls of varying heights between different kinds of work. [7] The trick of maximizing the parts of your job that you like can get you from architecture to product design, but not, probably, to music. If you make money doing one thing and then work on another, you have more freedom of choice.Which route should you take? That depends on how sure you are of what you want to do, how good you are at taking orders, how much risk you can stand, and the odds that anyone will pay (in your lifetime) for what you want to do. If you're sure of the general area you want to work in and it's something people are likely to pay you for, then you should probably take the organic route. But if you don't know what you want to work on, or don't like to take orders, you may want to take the two-job route, if you can stand the risk.Don't decide too soon. Kids who know early what they want to do seem impressive, as if they got the answer to some math question before the other kids. They have an answer, certainly, but odds are it's wrong.A friend of mine who is a quite successful doctor complains constantly about her job. When people applying to medical school ask her for advice, she wants to shake them and yell "Don't do it!" (But she never does.) How did she get into this fix? In high school she already wanted to be a doctor. And she is so ambitious and determined that she overcame every obstacle along the way — including, unfortunately, not liking it.Now she has a life chosen for her by a high-school kid.When you're young, you're given the impression that you'll get enough information to make each choice before you need to make it. But this is certainly not so with work. When you're deciding what to do, you have to operate on ridiculously incomplete information. Even in college you get little idea what various types of work are like. At best you may have a couple internships, but not all jobs offer internships, and those that do don't teach you much more about the work than being a batboy teaches you about playing baseball.In the design of lives, as in the design of most other things, you get better results if you use flexible media. So unless you're fairly sure what you want to do, your best bet may be to choose a type of work that could turn into either an organic or two-job career. That was probably part of the reason I chose computers. You can be a professor, or make a lot of money, or morph it into any number of other kinds of work.It's also wise, early on, to seek jobs that let you do many different things, so you can learn faster what various kinds of work are like. Conversely, the extreme version of the two-job route is dangerous because it teaches you so little about what you like. If you work hard at being a bond trader for ten years, thinking that you'll quit and write novels when you have enough money, what happens when you quit and then discover that you don't actually like writing novels?Most people would say, I'd take that problem. Give me a million dollars and I'll figure out what to do. But it's harder than it looks. Constraints give your life shape. Remove them and most people have no idea what to do: look at what happens to those who win lotteries or inherit money. Much as everyone thinks they want financial security, the happiest people are not those who have it, but those who like what they do. So a plan that promises freedom at the expense of knowing what to do with it may not be as good as it seems.Whichever route you take, expect a struggle. Finding work you love is very difficult. Most people fail. Even if you succeed, it's rare to be free to work on what you want till your thirties or forties. But if you have the destination in sight you'll be more likely to arrive at it. If you know you can love work, you're in the home stretch, and if you know what work you love, you're practically there.Notes[1] Currently we do the opposite: when we make kids do boring work, like arithmetic drills, instead of admitting frankly that it's boring, we try to disguise it with superficial decorations.[2] One father told me about a related phenomenon: he found himself concealing from his family how much he liked his work. When he wanted to go to work on a saturday, he found it easier to say that it was because he "had to" for some reason, rather than admitting he preferred to work than stay home with them.[3] Something similar happens with suburbs. Parents move to suburbs to raise their kids in a safe environment, but suburbs are so dull and artificial that by the time they're fifteen the kids are convinced the whole world is boring.[4] I'm not saying friends should be the only audience for your work. The more people you can help, the better. But friends should be your compass.[5] Donald Hall said young would-be poets were mistaken to be so obsessed with being published. But you can imagine what it would do for a 24 year old to get a poem published in The New Yorker. Now to people he meets at parties he's a real poet. Actually he's no better or worse than he was before, but to a clueless audience like that, the approval of an official authority makes all the difference. So it's a harder problem than Hall realizes. The reason the young care so much about prestige is that the people they want to impress are not very discerning.[6] This is isomorphic to the principle that you should prevent your beliefs about how things are from being contaminated by how you wish they were. Most people let them mix pretty promiscuously. The continuing popularity of religion is the most visible index of that.[7] A more accurate metaphor would be to say that the graph of jobs is not very well connected.Thanks to <NAME>, <NAME>, <NAME>, <NAME>, <NAME>, <NAME>, <NAME>, <NAME>, and <NAME> for reading drafts of this.Hebrew TranslationJapanese TranslationChinese TranslationRussian TranslationSlovak TranslationItalian TranslationGerman TranslationSpanish TranslationFrench TranslationHungarian TranslationPortuguese TranslationSerbian TranslationGreek TranslationVietnamese Translation
https://github.com/typst-doc-cn/tutorial
https://raw.githubusercontent.com/typst-doc-cn/tutorial/main/src/intermediate/writing.typ
typst
Apache License 2.0
#import "mod.typ": * #show: book.page.with(title: "编写一篇进阶文档") // document // list again // figure again // footnote // quote // smallcaps // upper // lower // heading // - outlined // - bookmarked // outline // par // parbreak // table again // lorem // color again // read/query/metadata // # sys.version
https://github.com/Joelius300/hslu-typst-template
https://raw.githubusercontent.com/Joelius300/hslu-typst-template/main/chapters/06_evaluation.typ
typst
MIT License
= Evaluation Auswertung und Interpretation der Ergebnisse. Nachweis, dass die Ziele erreicht wurden, oder warum welche nicht erreicht wurden. #pagebreak()
https://github.com/typst/packages
https://raw.githubusercontent.com/typst/packages/main/packages/preview/circuiteria/0.1.0/src/elements/element.typ
typst
Apache License 2.0
#import "@preview/cetz:0.2.2": draw, coordinate #import "ports.typ": add-ports, add-port #import "../util.typ" #let find-port(ports, id) = { for (side, side-ports) in ports { for (i, port) in side-ports.enumerate() { if port.id == id { return (side, i) } } } panic("Could not find port with id " + str(id)) } #let default-draw-shape(id, tl, tr, br, bl, fill, stroke) = { return ({}, tl, tr, br, bl) } /// Draws an element /// - draw-shape (function): Draw function /// - x (number, dictionary): The x position (bottom-left corner). /// /// If it is a dictionary, it should be in the format `(rel: number, to: str)`, where `rel` is the offset and `to` the base anchor /// - y (number, dictionary): The y position (bottom-left corner). /// /// If it is a dictionary, it should be in the format `(from: str, to: str)`, where `from` is the base anchor and `to` is the id of the port to align with the anchor /// - w (number): Width of the element /// - h (number): Height of the element /// - name (none, str): Optional name of the block /// - name-anchor (str): Anchor for the optional name /// - ports (dictionary): Dictionary of ports. The keys are cardinal directions ("north", "east", "south" and/or "west"). The values are arrays of ports (dictionaries) with the following fields: /// - `id` (`str`): (Required) Port id /// - `name` (`str`): Optional name displayed *in* the block /// - `clock` (`bool`): Whether it is a clock port (triangle symbol) /// - `vertical` (`bool`): Whether the name should be drawn vertically /// - ports-margins (dictionary): Dictionary of ports margins (used with automatic port placement). They keys are cardinal directions ("north", "east", "south", "west"). The values are tuples of (`<start>`, `<end>`) margins (numbers) /// - fill (none, color): Fill color /// - stroke (stroke): Border stroke /// - id (str): The block id (for future reference) /// - auto-ports (bool): Whether to use auto port placements or not. If false, `draw-shape` is responsible for adding the appropiate ports /// - ports-y (dictionary): Dictionary of the ports y offsets (used with `auto-ports: false`) /// - debug (dictionary): Dictionary of debug options. /// /// Supported fields include: /// - `ports`: if true, shows dots on all ports of the element #let elmt( draw-shape: default-draw-shape, x: none, y: none, w: none, h: none, name: none, name-anchor: "center", ports: (:), ports-margins: (:), fill: none, stroke: black + 1pt, id: "", auto-ports: true, ports-y: (:), debug: ( ports: false ) ) = draw.get-ctx(ctx => { let width = w let height = h let x = x let y = y if x == none { panic("Parameter x must be set") } if y == none { panic("Parameter y must be set") } if w == none { panic("Parameter w must be set") } if h == none { panic("Parameter h must be set") } if (type(x) == dictionary) { let offset = x.rel let to = x.to let (ctx, to-pos) = coordinate.resolve(ctx, (rel: (offset, 0), to: to)) x = to-pos.at(0) } if (type(y) == dictionary) { let from = y.from let to = y.to let (to-side, i) = find-port(ports, to) let margins = (0%, 0%) if to-side in ports-margins { margins = ports-margins.at(to-side) } let used-pct = 100% - margins.at(0) - margins.at(1) let used-height = height * used-pct / 100% let top-margin = height * margins.at(0) / 100% let dy = used-height * (i + 1) / (ports.at(to-side).len() + 1) if not auto-ports { top-margin = 0 dy = ports-y.at(to)(height) } let (ctx, from-pos) = coordinate.resolve(ctx, from) y = from-pos.at(1) + dy - height + top-margin } let tl = (x, y + height) let tr = (x + width, y + height) let br = (x + width, y) let bl = (x, y) // Workaround because CeTZ needs to have all draw functions in the body let func = {} (func, tl, tr, br, bl) = draw-shape(id, tl, tr, br, bl, fill, stroke) func if (name != none) { draw.content( (name: id, anchor: name-anchor), anchor: if name-anchor in util.valid-anchors {name-anchor} else {"center"}, padding: 0.5em, align(center)[*#name*] ) } if auto-ports { add-ports( id, tl, tr, br, bl, ports, ports-margins, debug: debug.ports ) } })
https://github.com/jakobjpeters/Typstry.jl
https://raw.githubusercontent.com/jakobjpeters/Typstry.jl/main/docs/source/tutorials/getting_started.md
markdown
MIT License
```@meta DocTestSetup = :(using Typstry) ``` # Getting Started This tutorial demonstrates the basic features of Typstry.jl and how to use them. ## Strings Print Julia values in [`Typst`](@ref) format using `show` with the `text/typst` MIME type. This formatting is also used to construct a [`TypstString`](@ref). ```jldoctest 1 julia> show(stdout, "text/typst", Typst(π)) $π$ julia> TypstString(π) typst"$π$" ``` Formatting may be configured in `show` using an `IOContext` and in `TypstString` using keyword parameters. ```jldoctest 1 julia> show(IOContext(stdout, :mode => code), "text/typst", Typst(π)) 3.141592653589793 julia> TypstString(π; mode = code) typst"3.141592653589793" ``` Use [`@typst_str`](@ref) to directly write Typst source text. This also supports formatted interpolation by calling the `TypstString` constructor. ```jldoctest 1 julia> typst"$ \(pi; mode = math) approx \(pi; mode = code) $" typst"$ π approx 3.141592653589793 $" ``` ## Commands Use the Typst command-line interface by [`run`](@ref)ning a [`TypstCommand`](@ref) created with its constructor or [`@typst_cmd`](@ref). ```jldoctest 1 julia> TypstCommand(["help"]) typst`help` julia> typst`compile input.typ output.pdf` typst`compile input.typ output.pdf` ``` Easily generate a Typst source file and compile it into a document using [`render`](@ref). ```jldoctest 1 julia> render(Any[true 1; 1.2 1 // 2]); ```
https://github.com/messense/typst-py
https://raw.githubusercontent.com/messense/typst-py/main/README.md
markdown
Apache License 2.0
# typst-py ![CI](https://github.com/messense/typst-py/workflows/CI/badge.svg) [![PyPI](https://img.shields.io/pypi/v/typst.svg)](https://pypi.org/project/typst) Python binding to [typst](https://github.com/typst/typst), a new markup-based typesetting system that is powerful and easy to learn. ## Installation ```bash pip install typst ``` ## Usage ```python import typst # Compile `hello.typ` to PDF and save as `hello.pdf` typst.compile("hello.typ", output="hello.pdf") # Compile `hello.typ` to PNG and save as `hello.png` typst.compile("hello.typ", output="hello.png", format="png", ppi=144.0) # Or return PDF content as bytes pdf_bytes = typst.compile("hello.typ") # Also for svg svg_bytes = typst.compile("hello.typ", format="svg") # For multi-page export (the template is the same as the typst cli) images = typst.compile("hello.typ", output="hello{n}.png", format="png") # Or use Compiler class to avoid reinitialization compiler = typst.Compiler("hello.typ") compiler.compile(format="png", ppi=144.0) # Query something import json values = json.loads(typst.query("hello.typ", "<note>", field="value", one=True)) ``` ## License This work is released under the Apache-2.0 license. A copy of the license is provided in the [LICENSE](./LICENSE) file.
https://github.com/typst/packages
https://raw.githubusercontent.com/typst/packages/main/packages/preview/glossarium/0.4.0/glossarium.typ
typst
Apache License 2.0
/* 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.*/ // glossarium figure kind #let __glossarium_figure = "glossarium_entry" // prefix of label for references query #let __glossary_label_prefix = "glossary:" // global state containing the glossary entry and their location #let __glossary_entries = state("__glossary_entries", (:)) #let __glossarium_error_prefix = "glossarium error : " #let __query_labels_with_key(loc, key, before: false) = { if before { query( selector(label(__glossary_label_prefix + key)).before(loc, inclusive: false), loc, ) } else { query(selector(label(__glossary_label_prefix + key)), loc) } } // key not found error #let __not-found-panic-error-msg(key) = { __glossarium_error_prefix+"key '"+key+"' not found" } // Reference a term #let gls(key, suffix: none, long: none, display: none) = { context { let __glossary_entries = __glossary_entries.final(here()) if key in __glossary_entries { let entry = __glossary_entries.at(key) let gloss = __query_labels_with_key(here(), key, before: true) let is_first = gloss == () let entlong = entry.at("long", default: "") let textLink = if display != none { [#display] } else if (is_first or long == true) and entlong != [] and entlong != "" and long != false { [#entlong (#entry.short#suffix)] } else { [#entry.short#suffix] } [#link(label(entry.key), textLink)#label(__glossary_label_prefix + entry.key)] } else { panic(__not-found-panic-error-msg(key)) } } } // Reference to term with pluralisation #let glspl(key, long: none) = { let suffix = "s" context { let __glossary_entries = __glossary_entries.final(here()) if key in __glossary_entries { let entry = __glossary_entries.at(key) let gloss = __query_labels_with_key(here(), key, before: true) let is_first = gloss == () let entlongplural = entry.at("longplural", default: ""); let entlong = if entlongplural == [] or entlongplural == "" { // if the entry long plural is not provided, then fallback to adding 's' suffix let entlong = entry.at("long", default: ""); if entlong != [] and entlong != "" { [#entlong#suffix] } else { entlong } } else { [#entlongplural] } let entplural = entry.at("plural", default: ""); let short = if entplural == [] or entplural == "" { [#entry.short#suffix] } else { [#entplural] } let textLink = if (is_first or long == true) and entlong != [] and entlong != "" and long != false { [#entlong (#short)] } else { [#short] } [#link(label(entry.key), textLink)#label(__glossary_label_prefix + entry.key)] } else { panic(__not-found-panic-error-msg(key)) } } } // show rule to make the references for glossarium #let make-glossary(body) = { show ref: r => { if r.element != none and r.element.func() == figure and r.element.kind == __glossarium_figure { // call to the general citing function gls(str(r.target), suffix: r.citation.supplement) } else { r } } body } #let __normalize-entry-list(entry_list) = { let new-list = () for entry in entry_list { new-list.push(( key: entry.key, short: entry.short, plural: entry.at("plural", default: ""), long: entry.at("long", default: ""), longplural: entry.at("longplural", default: ""), desc: entry.at("desc", default: ""), group: entry.at("group", default: ""), )) } return new-list } #let print-glossary( entry_list, show-all: false, disable-back-references: false, enable-group-pagebreak: false, ) = { let entries = __normalize-entry-list(entry_list) __glossary_entries.update(x => { for entry in entry_list { x.insert(entry.key, entry) } x }) let groups = entries.map(x => x.at("group", default: "")).dedup() // move no group to the front groups.insert(0, "") groups.pop() for group in groups.sorted() { if group != "" [#heading(group, level: 2) ] for entry in entries.sorted(key: x => x.key) { if entry.group == group { [ #show figure.where(kind: __glossarium_figure): it => it.caption #par( hanging-indent: 1em, first-line-indent: 0em, )[ #figure( supplement: "", kind: __glossarium_figure, numbering: none, caption: { context { let term_references = __query_labels_with_key(here(), entry.key) if term_references.len() != 0 or show-all { let desc = entry.at("desc", default: "") let long = entry.at("long", default: "") let hasLong = long != "" and long != [] let hasDesc = desc != "" and desc != [] { set text(weight: 600) if hasLong { emph(entry.short) + [ -- ] + entry.long } else { emph(entry.short) } } if hasDesc [: #desc ] else [. ] if disable-back-references != true { term_references.map(x => x.location()).sorted(key: x => x.page()).fold( (values: (), pages: ()), ((values, pages), x) => if pages.contains(x.page()) { (values: values, pages: pages) } else { values.push(x) pages.push(x.page()) (values: values, pages: pages) }, ).values.map(x => { let page-numbering = x.page-numbering(); if page-numbering == none { page-numbering = "1" } link(x)[#numbering(page-numbering, ..counter(page).at(x))] } ).join(", ") } } } }, )[] #label(entry.key) ] #parbreak() ] } } if enable-group-pagebreak { pagebreak(weak: true) } } };
https://github.com/darioglasl/Arbeiten-Vorlage-Typst
https://raw.githubusercontent.com/darioglasl/Arbeiten-Vorlage-Typst/main/01_Einleitung/00_index.typ
typst
TODO: text #include "01_industrial_partner.typ" #pagebreak() #include "05_problemstellung.typ" #pagebreak() #include "02_ausgangslage.typ" #pagebreak() #include "04_technologies.typ" #pagebreak() #include "06_nfr.typ" #pagebreak() #include "03_rahmenbedingungen.typ"
https://github.com/krestenlaust/AAU-Typst-Template
https://raw.githubusercontent.com/krestenlaust/AAU-Typst-Template/main/report-template-empty/main.typ
typst
MIT License
#import "template.typ": * // Take a look at the file `template.typ` in the file panel // to customize this template and discover how it works. #show: project.with( meta: ( title: "AAU Project Report Name", theme: "Insert theme name", project_period: "Fall Semester 2023", project_group: "group 1", participants: ( (name: "<NAME>", email: "<EMAIL>"), (name: "<NAME>", email: "<EMAIL>"), ), supervisor: ( (name: "<NAME>", email: "<EMAIL>"), ), date: datetime.today().display() ), // Insert your abstract after the colon, wrapped in brackets. // Example: `abstract: [This is my abstract...]` abstract: [This is the abstract, please write something here. #lorem(59)], department: "Computer Science", ) // This is the primary file in the project. // Commonly referred to as 'master' in LaTeX, and wokenly called 'main' in Typst. #include "chapters/chapter1.typ" #pagebreak(weak: true) #include "chapters/chapter2.typ" #pagebreak(weak: true) #bibliography("sources/sources1.bib")
https://github.com/typst/packages
https://raw.githubusercontent.com/typst/packages/main/packages/preview/unichar/0.1.0/ucd/block-31A0.typ
typst
Apache License 2.0
#let data = ( ("BOPOMOFO LETTER BU", "Lo", 0), ("BOPOMOFO LETTER ZI", "Lo", 0), ("BOPOMOFO LETTER JI", "Lo", 0), ("BOPOMOFO LETTER GU", "Lo", 0), ("BOPOMOFO LETTER EE", "Lo", 0), ("BOPOMOFO LETTER ENN", "Lo", 0), ("BOPOMOFO LETTER OO", "Lo", 0), ("BOPOMOFO LETTER ONN", "Lo", 0), ("BOPOMOFO LETTER IR", "Lo", 0), ("BOPOMOFO LETTER ANN", "Lo", 0), ("BOPOMOFO LETTER INN", "Lo", 0), ("BOPOMOFO LETTER UNN", "Lo", 0), ("BOPOMOFO LETTER IM", "Lo", 0), ("BOPOMOFO LETTER NGG", "Lo", 0), ("BOPOMOFO LETTER AINN", "Lo", 0), ("BOPOMOFO LETTER AUNN", "Lo", 0), ("BOPOMOFO LETTER AM", "Lo", 0), ("BOPOMOFO LETTER OM", "Lo", 0), ("BOPOMOFO LETTER ONG", "Lo", 0), ("BOPOMOFO LETTER INNN", "Lo", 0), ("BOPOMOFO FINAL LETTER P", "Lo", 0), ("BOPOMOFO FINAL LETTER T", "Lo", 0), ("BOPOMOFO FINAL LETTER K", "Lo", 0), ("BOPOMOFO FINAL LETTER H", "Lo", 0), ("BOPOMOFO LETTER GH", "Lo", 0), ("BOPOMOFO LETTER LH", "Lo", 0), ("BOPOMOFO LETTER ZY", "Lo", 0), ("BOPOMOFO FINAL LETTER G", "Lo", 0), ("BOPOMOFO LETTER GW", "Lo", 0), ("BOPOMOFO LETTER KW", "Lo", 0), ("BOPOMOFO LETTER OE", "Lo", 0), ("BOPOMOFO LETTER AH", "Lo", 0), )
https://github.com/mem-courses/linear-algebra
https://raw.githubusercontent.com/mem-courses/linear-algebra/main/homework/linear-algebra-homework6.typ
typst
#import "../template.typ": * #show: project.with( title: "Linear Algebra Homework #6", authors: ( (name: "<NAME> (#95)", email: "<EMAIL>", phone: "3230104585"), ), date: "October 30, 2023", ) #let AA = math.bold("A") #let BB = math.bold("B") #let CC = math.bold("C") #let EE = math.bold("E") #let OO = math.bold("O") #let II = math.bold("I") = P69 习题三 29 #prob[设 $f(x) = a_m x^m + a_(m-1) x^(m-1) + dots.c + a_1 x + a_0$ 与 $AA$ 分别为数域 $PP$ 上的一元多项式与 $n$ 阶方阵,令 $f(AA) = a_m AA^m + a_(m-1) AA^(m-1) + dots.c + a_1 AA + a_0 EE$.通常,称之为 *矩阵 $A$ 的多项式*.若 $a_0!=0$ 且 $f(AA) = OO$,证明 $AA$ 可逆,并求其逆.] 设 $g(x) = a_m x^(m-1) + a_(m-1) x^(m-2) + dots.c + a_2 x + a_1$,那么 $f(AA) = g(AA) AA + a_0 EE$.已知: $ f(AA) = OO => g(AA) AA + a_0 EE = OO => g(AA) AA = (- a_0) EE => (-g(AA) / a_0) AA = EE $ 故 $AA$ 可逆,且 $display(AA^(-1) = -(a_m AA^(m-1) + a_(m-1) AA^(m-2) + dots.c + a_2 AA + a_1)/a_0)$. = P70 习题三 30 #prob[设 $bold(J_n)$ 为所有元素全为 $1$ 的 $n sp (n>1)$ 阶方阵,证明 $EE-bold(J_n)$ 可逆,且其逆为 $EE - display(1/(n-1))bold(J_n)$.] 已知 $bold(J_n)^2 = n bold(J_n)$.考虑 $ &(EE - bold(J_n))(EE - 1/(n-1) bold(J_n)) = EE^2 - bold(J_n) EE - 1/(n-1) EE bold(J_n) + 1/(n-1) bold(J_n)^2\ =& EE - (n/(n-1) - 1 - 1/(n-1))bold(J_n) = EE $ 故 $EE - bold(J_n)$ 可逆,且其逆为 $EE - display(1/(n-1))bold(J_n)$. = P70 习题三 32 #prob[ 设 $AA$ 为 $n$ 阶非零矩阵,若 $AA^3 = OO$,则($quad$): (A) $EE - AA$ 不可逆,$EE + AA$ 不可逆\ (B) $EE - AA$ 不可逆,$EE + AA$ 可逆\ (C) $EE - AA$ 可逆,$EE + AA$ 可逆\ (D) $EE - AA$ 可逆,$EE + AA$ 不可逆\ ] 已知: $ EE = EE^3 - AA^3 = (EE - AA)(EE^2 + EE AA + AA)\ EE = EE^3 + AA^3 = (EE + AA)(EE^2 - EE AA + AA)\ $ 故 $EE-AA$ 和 $EE+AA$ 均可逆,选 (C) 项. = P70 习题三 33 #prob[ 设 $n$ 阶方阵 $AA$ 满足 $AA^2 + AA - 4 EE = OO$,证明 $AA$ 及 $AA - EE$ 都是可逆矩阵,并写出 $AA^(-1)$ 及 $(AA - EE)^(-1)$. ] 不妨先假设 $AA^(-1)$ 存在,那么 $ AA^2 + AA - 4 EE = OO => AA + EE - 4 AA^(-1) = OO => AA^(-1) = (AA+EE)/4 $ 下面代入验证: $ AA ((AA+EE)/4) = (AA^2 + AA)/4 = (4 EE)/4 = EE $ 类似的,设 $BB = AA-EE$,先假设 $BB$ 存在,那么 $ (BB + EE)^2 + (BB + EE) - 4 EE = OO => BB^2 + 3 BB - 2 EE = OO\ => BB + 3 EE - 2 BB^(-1) = OO => BB^(-1) = (BB + 3 EE)/2 $ 下面代入验证: $ (AA - EE)((AA + 2EE) / 2) = (AA^2 + 2 AA - AA - 2 EE)/2 = (4 EE - 2 EE) / 2 = EE $ 故 $AA$ 和 $AA - EE$ 均可逆,且 $AA^(-1) = display((AA+EE)/4), sp (AA-EE)^(-1) = display(frac(AA+2EE,2))$. = P70 习题三 34 #prob[ 设 $AA = (a_(i j))$ 是三阶非零矩阵,$|AA|$ 为 $AA$ 的行列式,$A_(i j)$ 为 $a_(i j)$ 的代数余子式,若 $a_(i j) + A_(i j) = 0 sp (i,j = 1,2,3)$,计算 $|AA|$. ] 依题意 $AA + AA^* = OO => AA^* = OO - AA$.所以, $ AA AA^* = |AA|^(n-1)EE => AA(OO - AA) = |AA|^2 EE => -AA^2 = |AA|^2 EE => - |AA|^2 = |AA|^2 $ 故只可能有 $|AA|=0$. = P70 习题三 36 #prob[ 设 $AA$ 是一个 $n sp (n>2)$ 阶方阵,证明:$(AA^*)^* = |AA|^(n-2) AA$. ] - 当 $bold(A)$ 可逆时,$bold(A^*)$ 也可逆.故只需证: $ (AA^*)^* AA^* = |AA|^(n-2) AA AA^* <=> |AA^*| EE = |AA|^(n-2) |AA| EE <=> |AA^*| = |AA|^(n-1) $ 显然成立. - 当 $bold(A)$ 不可逆时,有 $|AA|=0$,故 $"左式" = "右式" = 0$ 也成立. 综上,原命题得证. = P70 习题三 37 #prob[ 已知三阶方阵 $AA$ 的行列式 $|AA| = 3$,求行列式 $|AA^(-1)|$,$|AA^*|$,$|-2bold(A)|$,$|(-3 AA)^(-1)|$,$display(|1/3 AA^* - 4 AA^(-1)|)$ 及矩阵 $(AA^*)^(-1)$. ] $ |AA^(-1)| &= |AA AA^(-1)| / |AA| = 1/3\ |AA^*| &= |AA|^(n-1) = 3^2 = 9\ |-2 AA| &= (-2)^n |AA| = -24\ |(-3 AA)^(-1)| &= | (-3)^(n-1) AA^(-1)| = 9^n |AA^(-1)| = 243\ |1/3 AA^* - 4 AA^(-1)| &= 3 - 4/3 = 8/3\ $ = P70 习题三 38 #prob[ 设 $AA,BB,AA + BB$ 均为 $n$ 阶可逆矩阵,证明 $AA^(-1) + BB^(-1)$ 可逆,并求 $(AA^(-1) + BB^(-1))^(-1)$. ] 已知 TBD 故 $AA^(-1) + BB^(-1)$ 的逆存在,且 $(AA^(-1) + BB^(-1))^(-1) = (AA + BB)^(-1) AA BB$. = P71 习题三 40 #prob[ 用矩阵分块的方法计算 $bold(A B)$,其中 $ AA = mat( 1,-2,7,0,0; -1,3,6,0,0; -3,2,-5,0,0; 0,0,0,1,2; 0,0,0,0,5; ) , quad BB = mat( 3,0,0,1,2; 0,3,0,3,4; 0,0,3,5,6; 0,0,0,3,4; 0,0,0,5,1; ) $ ] $ AA &= mat(bold(A_11), OO; OO, bold(A_22)) quad quad BB = mat(3 EE,bold(B_12); OO, bold(B_22))\ bold(A B) &= mat( bold(A_11)(3 EE), bold(A_11) bold(B_12); OO, bold(A_22) bold(B_22) ) = mat( 3,-6,21,30,36; -3,9,18,38,46; -9,6,-15,-22,-28; 0,0,0,13,6; 0,0,0,25,5; ) $ = P71 习题三 43 #prob[ 设 $AA,BB$ 均为二阶方阵,若 $|AA| = 2, |BB| = 3$,则分块矩阵 $display(mat(OO,AA;BB,OO))$ 的伴随矩阵为($quad$). $ "(A)" display(mat(OO,3 BB^*;2 AA^*,OO)) quad quad "(B)" display(mat(OO,2 BB^*;3 AA^*,OO)) quad quad "(C)" display(mat(OO,3 AA^*;2 BB^*,OO)) quad quad "(D)" display(mat(OO,2 AA^*;3 BB^*,OO)) $ ] 设 $bold(P) = display(mat(OO,AA;BB,OO))$,那么 $|bold(P)| = (-1)^(2 times 2) |AA| |BB| = 6$.可验证 (B) 项合法: $ mat(OO,AA;BB,OO) mat(OO,2 BB^*;3 AA^*,OO) = mat(6 EE_2, OO; OO, 6 EE_2) = |bold(P)| EE $ 故选 (B). = P71 习题三 44 #prob[ 判断下列命题是否成立: (1) 若矩阵 $AA,BB$ 均为二阶矩阵,设他们的列分块矩阵分别为 $AA = display(mat(bold(alpha_1),bold(alpha_2)))$,$BB = display(mat(bold(beta_1),bold(beta_2)))$,则 $bold(A B) = display(mat(bold(alpha_1 beta_1), bold(alpha_2 beta_2)))$. ] 不成立.$bold(alpha_1),bold(alpha_2),bold(beta_1),bold(beta_2) in PP^(2 times 1)$,故 $bold(alpha_1) bold(beta_1)$ 不合法. #prob[ (2) 设矩阵 $AA$ 的列分块矩阵为 $AA = display(mat(bold(alpha_1), bold(alpha_2), bold(alpha_3)))$,列矩阵 $bold(X) = display(mat(x_1; x_2; x_3))$,则 $bold(A X) = x_1 bold(alpha_1) + x_2 bold(alpha_2) + x_3 bold(alpha_3)$. ] 成立.满足 $bold(A)$ 上列的分块方法与 $bold(X)$ 上行的分块方法相同,且数乘满足交换律. #prob[ (3) 设 $AA$ 是可逆矩阵,则分块矩阵 $display(mat(OO, 2; AA, OO))$ 也可逆,且 $ mat(OO,2;AA,OO)^(-1) = mat(OO, 2; AA^(-1), OO) $ ] #prob[ (4) 分块矩阵 $display(mat(AA,OO;OO,BB))$ 是一个准(分块)对角矩阵. ] 不成立.不能保证 $bold(A)$ 和 $BB$ 为方阵. #prob[ (5) 若矩阵 $AA,BB$ 均为方阵,则分块矩阵 $display(mat(OO,AA; BB,OO))$ 是一个准对角矩阵. ] 不成立.非零矩阵 $bold(A),BB$ 不在主对角线上. = P74 补充题三 3 #prob[ 设 $n$ 阶方阵 $AA = (a_(i j))_(n times n)$ 且对于任意的 $1<=i<=n$,满足 $2 |a_(i i)| = display(sum_(j=1)^n |a_(i j)|)$,证明:$AA$ 可逆. ]
https://github.com/kdog3682/2024-typst
https://raw.githubusercontent.com/kdog3682/2024-typst/main/src/deleted.typ
typst
#let create-icon-factory(dir, ext: "png") = { // factory-util // possibly this is not the way to go. // u can straight curry arguments into create-icon let create-icon(key, ..sink) = { let kwargs = sink.named() let url = dir + str(key) + "." + ext let size = kwargs.at("size", default: 20) let el = image(url) if empty(el) { panic(url) } return box(width: size * 1pt, height: size * 1pt, el) } return create-icon }
https://github.com/tiankaima/typst-notes
https://raw.githubusercontent.com/tiankaima/typst-notes/master/ea2724-ai_hw/hw8.typ
typst
== HW8 Due 2024.05.31 #import "@preview/diagraph:0.2.1": * #let ans(it) = [ #pad(1em)[ #text(fill: blue)[ #it ] ] ] #show math.equation: it => [ #math.display(it) ] #show image: it => align(center, it) === Q1 试证明对不含冲突数据集 (即特征向量完全相同但标记不同) 的训练集, 必存在与训练集一致 (训练误差为 0) 的决策树 #ans[ 由于训练集中不含有冲突数据, 即特征向量完全相同但标记不同的数据, 那么对于每一个特征向量, 都有唯一的标记与之对应. 因此, 我们可以构造一个决策树, 使得每一个叶子节点对应一个特征向量, 并且该叶子节点的标记与该特征向量的标记一致. 这样, 我们就得到了一个与训练集一致的决策树. ] === Q2 最小二乘学习方法在求解 $min_w (X w-y)^2$ 问题后得到闭式解 $w^*=(X^T X)^(-1)X^T y$ (为简化问题, 我们忽略误差项 $b$). 如果我们知道数据中部分特征有较大的误差, 在不修改损失函数的情况下, 引入规范化项 $lambda w^T D w$, 其中 $D$ 为对角矩阵, 由我们取值. 相应的最小二乘分类学习问题转换为以下形式化的优化问题: $ min_w [(X w-y)^2 + lambda w^T D w] $ + 请说明选择规范化项 $w^T D w$ 而非 $L_2$ 规范化项 $w^T w$ 的理由是什么. $D$ 的对角线元素 $D_(i i)$ 有何意义, 它的取值意味着什么? #ans[ 选择规范化项 $w^T D w$ 而非 $L_2$ 规范化项 $w^T w$ 的理由是因为 $D$ 可以用来指定特征的重要性. 例如, 如果我们知道某些特征的误差较大, 那么我们可以将 $D$ 的对角线元素 $D_(i i)$ 设置为较大的值, 从而使得对应的特征在优化过程中受到更大的惩罚. 这样, 我们就可以在不修改损失函数的情况下, 通过引入规范化项 $w^T D w$ 来调整特征的重要性. $D$ 的对角线元素 $D_(i i)$ 的取值意味着对应特征的重要性. 如果 $D_(i i)$ 的取值较大, 那么对应的特征在优化过程中受到的惩罚也较大, 从而使得该特征在最终的模型中的权重较小. 反之, 如果 $D_(i i)$ 的取值较小, 那么对应的特征在优化过程中受到的惩罚也较小, 从而使得该特征在最终的模型中的权重较大. ] + 请对以上问题进行求解: #ans[ $ L(w) &= (X w-y)^2 + lambda w^T D w\ (diff L) / (diff w) &= 2 X^T (X w-y) + 2 lambda D w = 0\ w &= (X^T X + lambda D)^(-1) X^T y $ ] === Q3 假设有 $n$ 个数据点 $x_1, ... x_n$ 以及一个映射 $phi: x->phi(x)$, 以此定义核函数 $K(x,x')=phi(x) dot phi(x')$. 试证明由该核函数决定的核矩阵 $K: (k_(i j)) quad k_(i j) = K(x_i, x_j)$ 有以下性质: + $K$ 是一个对称矩阵 + $K$ 是一个半正定矩阵 #ans[ 考虑 $k_(i j) = phi(x_i) dot phi(x_j)$, $k_(i j)=k_(j i)$ #highlight[对称性是显然的], 并且有: $ K = phi dot phi^T = (phi(x_1), ... ,phi(x_n))^T dot (phi(x_1), ... ,phi(x_n)) $ 因此有: $ forall x in RR^n quad x^T K x = x^T phi dot phi^T x = (phi^T x)^T phi^T x = norm(phi^T x)^2 >= 0 $ 得到$K$ 是半正定矩阵. ] === Q4 已知正例点 $x_1=(1,2)^T,x_2=(2,3)^T, x_3=(3,3)^T$, 负例点 $x_4=(2,1)^T, x_5=(3,2)^T$, 试求 Hard Margin SVM 的最大分割超平面和分类决策树, 并在图上画出分离超平面、间距边界以及支持向量. #ans[ 考虑分类结果的 Margin 由以下两个超平面确定: $ w^T x + alpha = 0 w^T + beta = 0 $ 优化目标是: $max_(w,b) (abs(alpha-beta))/norm(w)$, 不失一般性的, 我们可以转变为讨论 $max_(w,b) 1/norm(w)$, 或者为方便计算梯度, 采用下面的形式: $ min_(w,b) 1 / 2 norm(w)^2 = min_(w,b) 1 / 2 w^T w $ 约束条件是正确分类, 即正例点满足 $w^T x+b>0$, 负例点满足 $w^T x+b<0$. 由此我们可以得到以下约束: $ y_i dot (w^T x_i+b) >= 1 $ 因此我们可以得到以下优化问题: $ &min_(w,b) 1 / 2 w^T w\ s.t. quad & y_i (w^T x_i+b) >= 1 $ 考虑对偶问题, 我们可以得到以下拉格朗日函数: $ L(w,b,alpha) = 1 / 2 w^T w - sum alpha_i (y_i dot (w^T x_i+b) - 1) $ 此时优化问题: $ min_(w,b) max_(alpha_i >=0) L(w,b,alpha) = max_(alpha_i >=0) min_(w,b) L(w,b,alpha) $ 计算梯度, 我们可以得到以下结果: $ (diff L) / (diff w) = w - sum alpha_i y_i x_i = 0\ (diff L) / (diff b) = -sum alpha_i y_i = 0\ $ 代入得到: $ &max_(alpha_i>=0) [-1 / 2 sum_(i,j) alpha_i alpha_j y_i y_j x_i^T x_j + sum_i alpha_i]\ &s.t. quad sum_i alpha_i y_i = 0 $ 计算得到: $w=(-1,2)^T, b = -2$, 超平面方程: $-x+2y-2=0$ #image("./imgs/Solution_HW8_Q4.png", width: 70%) ] === Q5 计算 $diff_(w_j) L_(C E)(w,b)$, 其中: $ L_(C E)(w,b)=-[y log sigma(w dot x+b)+(1-y)log(1-sigma(w dot x+b))] $ 已知: $ diff_z sigma(z) = diff_z (1 / (1+e^(-z))) = e^(-z) / (1+e^(-z))^2 = sigma(z) (1-sigma(z)) $ #ans[ $ &-diff_(w_j) L_(C E)\ &= y / (sigma(w dot x+b)) dot (diff_(w_j) sigma(w dot x+b)) + (1-y) / (1-sigma(w dot x+b)) dot ( diff_(w_j) (1-sigma(w dot x+b)) )\ &=x_j dot ( y / (cancel(sigma(w dot x+b))) dot cancel(sigma(w dot x + b)) ( 1-sigma(w dot x+b) ) - (1-y) / cancel(1-sigma(w dot x+b)) dot sigma(w dot x + b) (cancel(1-sigma(w dot x+b))) )\ &=(y-sigma(w dot x+b))dot x_j $ 因此 $ diff_(w_j) L_(C E) = (sigma(w dot x+ b) -y) dot x_j $ ] === Q6 K-means 算法是否一定会收敛? 如果是, 给出证明过程; 如果不是, 给出说明 #ans[ 只需考虑优化目标随优化次数的序列 ${L_i}$, 即经过 $i$ 次优化, 数据划分为: $(w_1, ..., w_k)$, 此时优化目标: $ L_i = sum_(j=1)^k sum_(x in w_j) norm(x - mu_j)^2 $ 容易发现 $L_(i+1) < L_i$, 且 $L_i >=0$, 根据单调有界定理, 我们可以得到 $L_i$ 收敛. 因此 K-means 算法一定会收敛. ]
https://github.com/TypstApp-team/typst
https://raw.githubusercontent.com/TypstApp-team/typst/master/tests/typ/math/unbalanced.typ
typst
Apache License 2.0
// Test unbalanced delimiters. --- $ 1/(2 (x) $ $ 1_(2 y (x) () $ $ 1/(2 y (x) (2(3)) $
https://github.com/swablab/documents
https://raw.githubusercontent.com/swablab/documents/main/beleg.typ
typst
Creative Commons Zero v1.0 Universal
#import "templates/tmpl_page.typ": tmpl_page #import "templates/common.typ": colors #import "templates/form.typ": form, form_field #show: doc => tmpl_page( title: "Belegblatt", version: "v1.0", change_date: "31.05.2024", subtext: "Formular zum Abrechnen von Ausgaben für den Verein.", doc, ) #grid(columns: (9cm, 1fr))[ #box(height: 58em, width: 100%, fill: colors.highlight, stroke: black, inset: 1em)[ = Ablauf + Kläre die Beschaffung mit dem Vorstand ab + Kaufe ein + Fülle rechts das Formular aus + Klebe den Beleg auf diesen Bereich + Gib das Belegblatt beim Vorstand ab ] ][ #box(inset: (x: 1em))[ #form_field[Vorname] #form_field[Nachname] #form_field[Datum des Belegs] #form_field[Lieferant/Bezugsquelle] Der Betrag wurde... #grid(columns: (1fr,1fr,1fr))[ #form_field(width: 2em)[gespendet] ][ #form_field(width: 2em)[ausgezahlt] ][ #form_field(width: 2em)[überwiesen] ] #form_field[IBAN (bei Überweisung)] #form_field[Unterschrift Einkäufer] #form_field[Unterschrift Vorstand] ] ]
https://github.com/Mc-Zen/quill
https://raw.githubusercontent.com/Mc-Zen/quill/main/src/utility.typ
typst
MIT License
#let if-none(a, b) = { if a != none { a } else { b } } #let if-auto(a, b) = { if a != auto { a } else { b } } #let is-gate(item) = { type(item) == dictionary and "gate-type" in item } #let is-circuit-drawable(item) = { is-gate(item) or type(item) in (str, content) } #let is-circuit-meta-instruction(item) = { type(item) == dictionary and "qc-instr" in item } // Get content from a gate or plain content item #let get-content(item, draw-params) = { if is-gate(item) { if item.draw-function != none { return (item.draw-function)(item, draw-params) } } else { return item } } // Get size hint for a gate or plain content item #let get-size-hint(item, draw-params) = { if is-gate(item) { return (item.size-hint)(item, draw-params) } measure(item) } // Creates a sized brace with given length. // `brace` can be auto, defaulting to "{" if alignment is right // and "}" if alignment is left. Other possible values are // "[", "]", "|", "{", and "}". #let create-brace(brace, alignment, length) = { if brace == auto { brace = if alignment == right {"{"} else {"}"} } return $ lr(#brace, size: length) $ } /// Updates the first stroke with the second, i.e., returns the second stroke but all /// fields that are auto are inherited from the first stroke. /// If the second stroke is none, returns none. #let update-stroke(stroke1, stroke2) = { let if-not-auto(a, b) = if b == auto {a} else {b} if stroke2 == none { return none } if stroke2 == auto { return stroke1 } if stroke1 == none { stroke1 = stroke() } let s1 = stroke(stroke1) let s2 = stroke(stroke2) let paint = if-not-auto(s1.paint, s2.paint) let thickness = if-not-auto(s1.thickness, s2.thickness) let cap = if-not-auto(s1.cap, s2.cap) let join = if-not-auto(s1.join, s2.join) let dash = if-not-auto(s1.dash, s2.dash) let miter-limit = if-not-auto(s1.miter-limit, s2.miter-limit) return stroke(paint: paint, thickness: thickness, cap: cap, join: join, dash: dash, miter-limit: miter-limit) }
https://github.com/ralphmb/typst-template-stats-dissertation
https://raw.githubusercontent.com/ralphmb/typst-template-stats-dissertation/main/writeup/sections/exploratory.typ
typst
Apache License 2.0
In this section we'll explore the data. #lorem(420)
https://github.com/saurabtharu/Internship-repo
https://raw.githubusercontent.com/saurabtharu/Internship-repo/main/README.md
markdown
# Internship-weekly-log This repository contains the internship weekly log as well as `typst` source code of the internship report on DevOps Engineer at F1Soft International
https://github.com/PraneethJain/Science-1
https://raw.githubusercontent.com/PraneethJain/Science-1/main/Assignment-3/2022101093_Assignment_3.typ
typst
#align(center, text(17pt)[*Science-1*]) #align(center, text(16pt)[Assignment-3]) #align(center, text(13pt)[<NAME>, 2022010193]) = Question 1 For plot (i), $y = x " for " 0 <= x <= 1, 0 <= y <= 1$ For plot (ii), $y = 0 " for " 0 <= x < 1$ and $x = 1 " for " 0<y<=1$ == (a) $ d f = d(x y) $ $ d f = (d x)y + x (d y) $ === (i) $ d f = x d x + y d y $ $ integral d f = integral_0^1 x d x + integral_0^1 y d y $ $ integral d f = [x^2/2]_0^1 + [y^2/2]_0^1 $ $ integral d f = 1/2 + 1/2 $ $ integral d f = 1 $ === (ii) $ integral d f = integral_0^1 x d x + integral_0^0 y d y + integral_1^1 x d x + integral_0^1 y d y $ $ integral d f = [x^2/2]_0^1 + 0 + 0 + [y^2/2]_0^1 $ $ integral d f = 1/2 + 1/2 $ $ integral d f = 1 $ == (b) $ d f = d(x y) $ Note that the integral is path independent. Since $d f$ is equal to the differential of a differentiable function $x y$, it is an exact differential. == (c) === (i) $ d g = y d x $ $ d g = x d x $ $ integral d g = integral_0^1 x d x $ $ integral d g = [x^2/2]_0^1 $ $ integral d g = 1/2 $ === (ii) $ d g = y d x $ $ integral d g = integral_0^1 0 d x + integral_1^1 1 d x $ $ integral d g = 0 $ == (d) $ d g = y d x $ Note that the integral is path dependent Since $d g$ is not equal to the differential of a differentiable function, it is an inexact differential. == (e) $g$ should be called a path function and $f$ should be called a state function. $integral d g$ is an inexact differential and depends on the path, hence it as a path function. $integral d f$ is an exact differential and is independent of the path taken, hence it is a state function. = Question 2 Assuming 1 mole of gas as $U = C_V T$ Let $rho$ be the mass density, $p$ be the pressure, $V$ be the volume, $M$ be the molar mass. We know that $C_v = R / (1 - gamma)$, where $R$ is the gas constant. == (i) $ U = C_V T $ $ U/M = (C_V T) / M $ Since $p V = R T$ $ U/M = (C_V p V )/ (M R) $ Since $rho = M / V$ $ U/M = (C_V p) / (rho R) $ $ U/M = (cancel(R) p) / (rho cancel(R) (gamma - 1)) $ $ U/M = p / (rho (gamma - 1)) $ This is the required internal energy per unit mass. == (ii) $ U = (R T) / (gamma - 1) $ $ U/V = (R T) / (V (gamma - 1)) $ Since $p V = R T$ $ U/V = (p cancel(V))/(cancel(V)(gamma - 1)) $ $ U/V = p / (gamma - 1) $ This is the required internal energy per unit volume. = Question 3 $ alpha = 1/V ((diff V) / (diff T))_p $ $ ((diff V)/(diff T))_p = 1/((diff T) / (diff V))_p $ For a van der Waals gas, $ R T = (p + a/V^2)(V-b) $ $ R ((diff T)/(diff V))_p = (p + a/V^2) - (2a)/V^3 (V-b) $ $ ((diff V)/(diff T))_p = (R V^3) / (V(p V^2 + a) - 2 a (V - b)) $ $ alpha = (R V^2) / (V(p V^2 + a) - 2 a (V - b)) $ This is the coefficient of thermal expansion $alpha$ for a van der Waals gas. Now, for isothermal compressibility: $ kappa_T = - 1 / V ((diff V) / (diff p ))_T $ At a constant temperature, on increasing the pressure, the volume of a gas decreases. This will result in $((diff V)/(diff p))_T$ being negative. Hence, for the constant $kappa_T$ to be positive, the RHS is multiplied by -1. Now, to prove the required relation: $ ((diff V) / (diff p))_T = 1/((diff p)/(diff V))_T $ $ p = (R T)/(V - b) - a/V^2 $ $ ((diff p)/(diff V))_T = - (R T)/(V-b)^2 + (2 a)/ V^3 $ On substituting $R T$ from the van der Waals gas equation, $ ((diff p)/(diff V))_T = -(p+a/V^2)cancel(V-b)/(V-b)^cancel(2) + (2a)/V^3 $ $ ((diff V)/(diff p))_T = (V^3 (V-b))/(2a(V-b) - V(p V^2 + a)) $ $ kappa_T = (V^2 (V-b))/(V(p V^2 + a) - 2a(V-b)) $ $ kappa_T R = (R V^2) / (V(p V^2 + a) - 2a(V-b)) (V-b) $ $ kappa_T R = alpha (V - b) $ For one mole of gas, $V=V_m$ $ kappa_T R = alpha (V_m - b) $ Hence, proven. = Question 4 Assuming $n$ moles of liquid water initially at $-10^o C$. Let the latent heat of fusion of water be $L$, specific heat of water be $s$. Since result is a mixture of ice and water, this is only possible at tempetarure $T_2 = 0^o C$. ($T_1 = -10^o C$) Therefore, $Delta T = 10K$. Since the compartment is thermally insulated, $q = 0J$. The latent heat of ice will be compensted by the heating of water. $ n * 18 * s * Delta T = m_"ice" * L $ $ m_"ice" = (18 n s Delta T)/L $ Let $H_1$ be enthalpy change in heating of water and $H_2$ be enthalpy change of fusion. $ Delta H = Delta H_1 + Delta H_2 $ $ Delta H_1 = 18 n s Delta T $ $ Delta H_2 = Delta H_"fusion" = - m_"ice" L $ $ Delta H = 18 n s Delta T - m_"ice" L $ $ Delta H = 0 $ Note that for liquids and solids, $Delta U approx Delta H$ $ Delta U = 0 $ From first law of thermodynamics $ Delta U = q + w $ $ w = 0 $ Let $Delta S_1$ be entropy change in heating of water and $Delta S_2$ be entropy change of fusion. $ Delta S_1 = m s ln(T_2/T_1) $ $ Delta S_1 = 18 n s ln(273/263) $ $ Delta S_2 = (Delta H_"fusion")/ T $ $ Delta S_2 = -(m_"ice" L)/273 $ $ Delta S_2 = - (18 n s Delta T)/273 $ $ Delta S_2 = - (60 n s)/91 $ $ Delta S = n s (18 ln(273/263) - 60/91) $
https://github.com/HKFoggyU/hkust-thesis-typst
https://raw.githubusercontent.com/HKFoggyU/hkust-thesis-typst/main/hkust-thesis/templates/reference-body.typ
typst
LaTeX Project Public License v1.3c
#import "../imports.typ": * #import "../utils/invisible-heading.typ": invisible-heading // 目录生成 #let reference-body( // documentclass 传入参数 config: (:), info: (:), bib-filename: "mypublications.bib", style: "institute-of-electrical-and-electronics-engineers", full: false, page-title: "References", // 其他参数 ..args, ) = { let bib-path = "../../" + bib-filename set text( font: constants.font-names.toc, size: constants.font-sizes.toc, ) // page setting // set page(numbering: "1") // page rendering // pagebreak(weak: true, to: if config.twoside { "odd" }) // set par(leading: linespacing) // 显示References // { // set align(center) // let ref-page-title = page-title // invisible-heading(ref-page-title) // heading(outlined: false)[#text(size: constants.font-sizes.title)[#upper(ref-page-title)]] // do-repeat([#linebreak()], 1) // } { bibliography( bib-path, title: none, style: style, full: full, ) } }
https://github.com/jgm/typst-hs
https://raw.githubusercontent.com/jgm/typst-hs/main/test/typ/compiler/import-25.typ
typst
Other
// Error: 14 expected comma #import "": a b
https://github.com/protohaven/printed_materials
https://raw.githubusercontent.com/protohaven/printed_materials/main/common-policy/personal_protective_equipment.typ
typst
= Personal Protective Equipment (PPE)
https://github.com/polarkac/MTG-Stories
https://raw.githubusercontent.com/polarkac/MTG-Stories/master/stories/008_Commander%20(2013%20Edition).typ
typst
#import "@local/mtgset:0.1.0": conf #show: doc => conf("Commander (2013 Edition)", doc) #include "./008 - Commander (2013 Edition)/001_The Perfect Gift.typ"
https://github.com/Otto-AA/definitely-not-tuw-thesis
https://raw.githubusercontent.com/Otto-AA/definitely-not-tuw-thesis/main/tests/diplomarbeit_de/test.typ
typst
MIT No Attribution
#import "/src/thesis.typ": * #show: general-styles #show: thesis.with( lang: "de", title: (en: "An ode for Lord Ipsum", de: "Eine Ode an Lord Ipsum"), subtitle: (:), thesis-type: (en: "Diploma Thesis", de: "Diplomarbeit"), academic-title: (en: "Diplom-Ingenieur", de: "Diplom-Ingenieur"), curriculum: (en: "Software Engineering & Internet Computing", de: "Software Engineering & Internet Computing "), author: (pre-title: "BSc.", name: "<NAME>", student-number: 11223344), advisor: (name: "<NAME>", pre-title: "Univ.Prof.Dr."), assistants: ((name: "Ipsinator", pre-title: "Sir"),), reviewers: (), keywords: ("Lorem Ipsum"), font: "DejaVu Sans", date: datetime(year: 2024, month: 12, day: 1), )
https://github.com/kazewong/lecture-notes
https://raw.githubusercontent.com/kazewong/lecture-notes/main/Engineering/SoftwareEngineeringForDataScience/lab/problemAnalysis.typ
typst
#set page( paper: "us-letter", header: align(center, text(17pt)[ *Problem analysis* ]), numbering: "1", ) #import "./style.typ": style_template #show: doc => style_template(doc,) = Foreword The first step I always take before actually sitting down and start coding is to think about the problem. Many people are conditioned just to solve the problem as it is given, without realizing a way more obvious and better solution. I can give you an example who is one of my friend's personal experiences: she was working at a company which manages warehouses. One of the data science jobs they offered some interns to do is the following: their conveyor belts sometimes get jammed and the management will need to send people to unjam it whenever it is discovered. Some people noticed from CCTV footage, that there will be some patterns of the parcel forming before the conveyor belts get jammed. Her task was to develop a vision algorithm to identify those patterns, and then send a message to the management so they could go unjam the conveyor belts. This is a very well-defined data science task, and one just has to tag some images, train a convolutional neural network, and then write a bot to send the management the message whenever those patterns are detected. They hired some interns to do it, took some money, and took some months, then it worked. Is this not a great victory for data science again? A data science intern these days is not exactly cheap, so developing such a solution did cost the company a non-trivial amount of money. If you were running the company, how would you solve it? Instead of spending some months developing a vision algorithm, I would just either read out the conveyor belt motor information or buy a gauge to measure that, and whenever it is 0, I send a message to the management. Probably cost me less than 100 dollars instead of ~100k salary for the intern. The moral of the story is to just think before you commit to a big plan. *What are you trying to achieve in this project?* Right here is the most important question you have to ask yourself every time you come back to this project. Is it to sell it to millions? Is it to get a promotion? Is it just for fun? The answer to this question should be dedicated to the answer to the following questions we will go through in this lecture. And every time you have to make a decision or whenever you are lost, ask yourself this question again. The more clear your answer is, the more clear which choice you should go for is, and the rest is detail. The objective of this course is to train you to be an independent data scientist, I want you to be able to do a project on your own as well as work with others. So instead of going through just a list of technical skills, I will also put my focus on making decisions: what programming language should I use? What should my documentation look like? How do I want to manage the code base? Should I rewrite yet another javascript framework? These are examples of questions you will ask yourself throughout this course. = Plan for today's session By the end of today's session, 1. A github repository for your project. 2. A README.md made by following the guide below. The logistics of today's session is going to go as the following: 1. First, we are going to brainstorm some potential project ideas, just defining the problem and the objective. 2. The next step is work out the details of some of these project. 3. Then we are going to plan a timeline for these projects. 4. Finally, we have to choose one project to work on. #pagebreak() = Semester project brainstorming Since this is a one-semester project, it will be helpful to keep the scope of the project relatively small. There are a couple of milestones I would like you to hit during this course, which are 1. Implmenting the core logic of your project. 2. Design an interface to serve your project. 3. Release the code and the service to the world. == Step 1: Go wild The first step of finding your potential project is to come up with a list of dream projects. Here are some questions that will help you brainstorm what could be interesting: 1. What are your hobbies? Is there anything that you want related to your hobbies that can benefit from data science? 2. What chores do you dislike? Can it benefit from automation? 3. Ask you friends to rant about something, what could possibly make their life better? 4. Is there a dataset that you think it is cool and always wants to try your hands on it but never find the time? Come up with at least 5 projects that might interest you, discuss with your peers, and come up with more ideas! == Step 2: Come back to reality After you have finished brainstorming a list of potential projects, here is a list of questions to help you filter for the most suitable projects: 1. *Define one major objective for your project.* Be as concise as possible. 2. *Is this goal acheivable in 13 weeks timescale, with 1 day a week commitment mainly from you?* 3. *Where are you sourcing the data?* Downloading public dataset? Generating the data yourself? Make sure there is not privacy issue or license issue when you are using public dataset. 4. *What is main computation?* It is not required in this course you build a complicated model, I am not even going to require you to use any machine learning in your model. Make sure you have access to enough compute at every stage of the project, from collecting data to deployment. 5. *What are the features you want your product to have?* Is it to serve a dataset with some interactibility? Does it have to be very accurate? 6. *Are you excited about the project?* Choosing something you are excited about is almost always beneficial. == Examples Here is a list of sample projects to give you some ideas what is in the scope of this course. Disclaimer: These projects are closely related to my personal interests, which may put them out of the possible projects list because of conflict of interest. As mentioned, the only assignment that is relevant to your grade is the labs, so even if you pick any of the projects listed below, it will not affect your grade at all. But to stay on the safe side, I will not approve any project that is *exactly the same as described below*. Outside of this course, I am truly passionate about these projects. If people are interested in these projects, we can discuss what we can do together, but notice this is straightly outside the scope of this class. Example 1: Use computer vision model to extract joint positions from video Example 2: Using LLM to parse relevant grants information Example 3: Build a drone that can track athlete well while keeping them in frame Other than these examples, I have a list of projects related to a couple of people I chatted with in JHU. These will be real research projects, so they may not necessarily be suitable for this course due to the complexity of the project. Nevertheless, if you are really interested in looking into these projects, we can discuss in more detail. = Filling in more specific details Once we have the brief scope of some projects, let's narrow it down to three potential candidates and work out more specific details, here are a list of bullet points to help you with that: *Data* + *Data type*: What kind of data are you going to use? Text? Image? Video? Tables? + *Storage*: How much data are you going to store? Where are you planning to store them? + *Data collection*: How are you planning to collect the data? + *Privacy issues*: Will your data collection process violate any privacy issues? *Compute* + *Compute*: Do you need a lot of computing power? Do you have access to it? + *Platform*: Are you going to host the project on Web? Mobile? Desktop? + *Latency*: Does you project need low latency response? + *Network*: Do you need to communicate with other services? Do you plan to host a server? *Developement cycle* + *Development tools*: What environment you are going to develop in? + *CI/CD*: What kind of continous integration you will want to set up? + *Rewrite*: Do you anticipate major rewrite of the code? *User Exerpience* + *User group*: Who are your target users? + *User interface*: What is the user interface going to look like? + *User interaction*: Do you want to interact with your users? Now you should have a pretty good grasp of the specification of each project. While there is some chance you might want to change your project during the semester for whatever reason, let's pick one to start with. If it does not work out as well as you thought, the other two should be in a ready state to be picked up. = Making a timeline Now we have figured out the scope of the project and what features we want the ideal product to have, let's make a timeline for the project so we can stick to the plan. == Setting milestones Jumping on top of mount Everest is straightly impossible to any human being, but with the right training and dedication, considerable amount of people have hiked it. The same goes for your project, any interesting project should sound like impossible if you are only thinking about the end result. The importance of milestones is to breakdown this impossible task and make a pathway which you can eventually hike up to the top of the mountain. As a starter, let's imagine you are walking up a multistory building, the goal is to reach the top floor, and your task now is to figure out what are the floors in between, and how should you get to the next floor. Here are some questions to guide you through this process: 1. Look through your feature lists, which ones are easier to implement, and which ones are more difficult? What are the relationship between features? For example, if I am trying to build a drone that will track me moving around, first I need to assemble the drone before I can flash its software. 2. After you figure out where are the floors, now what are the steps to go from one floor to another? Going back to the drone example, say I now know I need to assemble the drone first, the steps I will need to take are first list all the parts I need, find ways to buy them, them assemble them. == How much time are you willing to commit to this? Everyone has different capacity and constraints, so it is important to make sure you are honest to yourself how much time you are willing to put into building this project. Is it 2 hrs per day for 7 days a week? Or 2 days a week? Is that going to interfere with your other commitments? Is this time commitment realistic given the scope of the project? The most important part of this question is to be honest and realistic, you don't have to tell me you are going to dedicate 8 days a week and 25 hours a day to work on this project. == Consistency is key The main reason I am asking you to construct a detail timeline and break it down into acheivable steps is so that you can keep making differential progress, and after a while, just like climbing a mountain or a tall building, you will find yourself in places where you couldn't have possible been if you are trying to make one big jump. And in this process, consistency and habit are you best friends. Decide which day(s) in the week you are going to work on this, and what time in the day you are going to work on the project. Try to stick with the plan as much as possible. If you find yourself not able to stick with the plan, then that needs to be addressed. == What about set backs? As much as we all want to stick with the plan, life happens. It is inevitable that something will go wrong and you have to move back the schedule. That's fine and that's why we need a clear timeline. If you cannot achieve what are supposed to do this week, no big deal, just move it to next week. However, it is important to recognize setbacks should not happen every week, or more often than the rate you are making progress.
https://github.com/engboris/cv-template
https://raw.githubusercontent.com/engboris/cv-template/main/main.typ
typst
MIT License
#import "cv.typ": * #show: project.with( title: lorem(10), firstname: "First", familyname: "Second", website: "www.website.net", email: "<EMAIL>", github: "https://github.com/username", phone: "+00 0 00 00 00 00", /* layout_type is either "compact" (default) or "extended" for longer names */ layout_type: "compact", main_color: eastern, ) = Formation #cv_list( [*PhD in Computer Science*], [Université Paris 13], [2019--2023], [*Master Parisien de Recherche en Informatique (MPRI)*], [Université Paris 7], [2018–2019], [*Bachelor in Computer Science*], [Université Paris 7], [2016--2017] ) = Experience #cv_block( title: [Put a title here], year: [Date--Date], subtitle:[Put a subtitle here], place: [Some place], description: [#lorem(40)] ) #cv_block( title: [Put a title here], year: [Date--Date], subtitle:[Put a subtitle here], place: [Some place], description: [#lorem(40)] ) #cv_block( title: [Put a title here], year: [Date--Date], subtitle:[Put a subtitle here], place: [Some place], description: [#lorem(40)] ) #cv_block( title: [Put a title here], year: [Date--Date], subtitle:[Put a subtitle here], place: [Some place], description: [#lorem(40)] ) = Skills #cv_item([Programming], [OCaml, Coq, C/C++, Java, Python]) #cv_item([Project management], [Git, SVN]) #cv_item([Web development], [HTML, CSS, Jekyll, Hugo]) #cv_item([Typesetting], [LaTeX, Typst]) = Languages #cv_item([French], [Native language]) #cv_item([English], [Professional proficiency]) #cv_item([Japanese], [Professional proficiency]) #cv_item([Italian], [Professional proficiency]) #cv_item([Spanish], [Professional proficiency]) = Hobbies #lorem(15)
https://github.com/StandingPadAnimations/papers
https://raw.githubusercontent.com/StandingPadAnimations/papers/main/meshswap/meshswap.typ
typst
#set text(size: 12pt, font: "IBM Plex Serif") #set par(justify: true) #align(center, text(25pt)[ A Better Block Detection Algorithm For MCprep's Meshswap ]) #align(center)[ By StandingPad ] = Problem We want to meshswap certain blocks with a fancier version of them. However, we've been given a full OBJ of faces and we need to identify each block with a given material. While we could select all faces and split them by loose parts, that leads to a mess. Instead, we want to be able to find blocks without having to go through that whole process While MCprep currently does this, the algorithm is slow, unreadable, and not really fit for geometry nodes (which are the future of meshswap). This algorithm aims to be faster, easier to read, and easier for one to wrap their head around. In addition, this algorithm was designed with geometry nodes in mind, and in could be used for a geometry nodes based mesh swap. Ideally we would want to spend the least amount of time calculating what are the bounds of full blocks. The algorithm described here can get all of a block's faces with only a single face known and return a point that acts as the block's origin. Thankfully Minecraft OBJs have some things we can assume, which helps us a lot in this case. = Some Basic Principles A face is a plane whose area is defined as follows: $ F_A = l * w $ Where $l$ is the length and $w$ is the width. In addition, all cubic Minecraft blocks have a 3rd variable $h$ for height, are made up of 6 faces, and whose volume is defined as follows: $ B_V = l * w * h $ Given a block $B$ with the dimensions $1m * 2m * 3m$ (where $m$ is meters) and a face $F$ with the dimensions $1m * 3m$, the following is true: $ F_A = 1 * 3 $ $ B_V = F_A * 2 $ $ B_V = (1 * 3) * 2 $ $ d = B_V / F_A = 2 $ Where $d$ is the depth. Every face has a normal as well, which defines the orientation. For our use cases, the normal is a line perpenidcular to the face in question. In addtion, $-n$ (where $n$ is a normal) should be interpreted as the opposite orientation of the face. In addition, every face also has a material $M$, which is the material they have. Let's move on to the algorithm. = Algorithm in Detail Now that we've covered some basics, we can now move on to the algorithm. == Cubic Blocks Given the dimensions $l$, $w$, and $h$, a target material $M$, a face $F_alpha$ with material $M$, and the normal of $F_alpha$ (called $n_alpha$), we can do the following: 1. Let $d = B_V / A_alpha$, where $B_V = l * w * h$ and $A_alpha$ is the area of $F_alpha$. 2. Find a face $F_beta$ that is $d$ away, opposite of $n_alpha$. If $F_beta$ exists, then its normal shall be $n_beta$ and the material it has shall be $M_beta$. If $F_beta$ does not exist, move on to Step 4. 3. Provided $F_beta$ exists, it is part of the same block as $F_alpha$ if the following are true: $ n_beta = -n_alpha $ $ M_beta = M $ 4. For every edge $E$ from $F_alpha$, find a face $F_gamma$ that shares $E$ with $F_alpha$ If $F_gamma$ exists, then its normal shall be $n_gamma$ and the material it has shall be $M_gamma$. If $F_gamma$ does not exist, move on to Step 6. 5. Provided $F_gamma$ exists, it is part of the same block as $F_alpha$ and $F_beta$ if the following is true: $ n_gamma perp n_alpha $ $ n_gamma perp n_beta $ $ M_gamma = M $ 6. With all faces found, the origin of the block lies on the point where all normals (when extended from the face inward) intersect. If only 2 faces exist, then let the distance between the centers of both faces be $D$, where the midpoint of $D$ is the origin. If one face exists, then put the origin $1/2 d$ away from $-n_alpha$. The rotation of the block can be found by getting the face that defines the orientation of the block. == Non-Cubic Blocks Some blocks are not cubic in shape and instead are made with 2 intersecting planes. We can easily modify the algorithm to handle this: 1. Given a target material $M$ and a face $F_alpha$, find a face $F_beta$ that intersects $F_alpha$. If $F_beta$ exists, then let $M_beta$ be the material of $F_beta$. If $F_beta$ does not exist, then the algorithm terminates. 2. Provided $F_beta$ exists, it is part of the same block as $F_alpha$ if the following is true: $ M_beta = M $ 3. Let $I$ be the line formed by the intersection of $F_alpha$ and $F_beta$, as per the _Plane Intersection Postulate_, and let $G$ be a stright line parallel to the top of the OBJ. If the following is true, then the blocked formed by $F_alpha$ and $F_beta$ is stright: $ I perp G $ Otherwise, the block formed by $F_alpha$ and $F_beta$ is not stright. 4. With both faces and $I$, let the origin be at the vertex formed by the intersection of the bottom edges of $F_alpha$ and $F_beta$, and let the rotation of the vertex be the rotation of $I$.
https://github.com/sitandr/conchord
https://raw.githubusercontent.com/sitandr/conchord/main/examples/zombie.typ
typst
MIT License
// "../lib.typ" should be replaced with "@preview/conchord:0.1.0" if used outside of package #import "../lib.typ": new-chordgen, overchord // For better png in README #set page(height: auto) #let standard-chord = new-chordgen() #let chord(tabs, name) = box(standard-chord(tabs, name: name), inset: 0.3em) #set page(margin: (right: 40%)) #place(right, dx: 70%, block(width: 70%, block(stroke: gray + 0.2pt, inset: 1em, below: 3em)[ #set align(left) // Make all text in chord graph bold #show text: strong // List used chords there #chord("022000", "Em") #chord("x32010", "C") #chord("320003", "G") #chord("xx0232", "D") ] ) ) #align(center)[ // Song name = Zombie // Band == The Cranberries ] #let och(it) = overchord(strong(it)) === #raw("[Verse 1]") #och[Em] Another head #och[C] hangs lowly \ #och[G] Child is slowly #och[D] taken \ #och[Em] And the violence #och[C] caused such silence \ #och[G] Who are we #och[D] mistaken? === #raw("[Pre-Chorus]") #och[Em] But you see, it's not me, #och[C] it's not my family \ #och[G] In your head, in your head they are #och[D] fightin' \ #och[Em] With their tanks and their bombs #och[C] and their bombs and their guns \ #och[G] In your head, in your head they are #och[D] cryin' === #raw("[Chorus]") #och[Em] In your head, #och[C] in your head \ #och[G] Zombie, zombie, #och[D] zombie-ie-ie \ #och[Em] What's in your head, #och[C] in your head \ #och[G] Zombie, zombie, #och[D] zombie-ie-ie, oh <…>
https://github.com/lucifer1004/leetcode.typ
https://raw.githubusercontent.com/lucifer1004/leetcode.typ/main/problems/p0002.typ
typst
#import "../helpers.typ": * #import "../solutions/s0002.typ": * = Add Two Numbers You are given two *non-empty* linked lists representing two non-negative integers. The digits are stored in *reverse order*, and each of their nodes contains a single digit. Add the two numbers and return the sum as a linked list. You may assume the two numbers do not contain any leading zero, except the number 0 itself. #let add-two-numbers(l1, l2) = { // Solve the problem here // // The linked list is defined as a special dictionary // with keys `val` and `next`. // You can see the definition in `helpers.typ`. } #testcases(add-two-numbers, add-two-numbers-ref, ( (l1: linkedlist((2, 4, 3)), l2: linkedlist((5, 6, 4))), (l1: linkedlist((0,)), l2: linkedlist((0,))), (l1: linkedlist((9, 9, 9, 9, 9, 9, 9)), l2: linkedlist((9, 9, 9, 9))), (l1: linkedlist((2, 4, 3)), l2: linkedlist((5, 6, 4, 9))), ))
https://github.com/paugarcia32/CV
https://raw.githubusercontent.com/paugarcia32/CV/main/modules_es/projects.typ
typst
Apache License 2.0
#import "../brilliant-CV/template.typ": * #cvSection("Proyectos") #cvProject( title: [It Odyssey], society: [Aplicación Web], date: [2023 - Actualidad], description: list( [Web Blog donde publico artículos relacionados con mi experiencia en el sector IT], ), url: "https://www.itodyssey.dev", tags: ("Web", "FrontEnd", "NextJS", "TS", "S.O.L.I.D"), logo: "../src/logos/itodyssey.png", ) #cvProject( title: [EETAC GO], society: [WebApp Full Stack], date: [2022 - 2023], description: list( [Aplicación Móvil para nuevos estudiantes del campus], [Desarrollado por un equipo de 5 miembros], ), url: "https://github.com/mariaubiergo2/EA-FRONTEND", tags: ("Mobile", "BackEnd", "Flutter", "TypeScript", "MongoDB", "Agile & SCRUM", "NodeJS"), logo: "../src/logos/eetacgo.png", )
https://github.com/muqiuhan/internal-medicine-note
https://raw.githubusercontent.com/muqiuhan/internal-medicine-note/main/main.typ
typst
#import "@preview/ilm:0.1.1": * #show: ilm.with( title: [ 协和听课笔记:内科学\ 读书笔记 ], author: "PUMC LECTURE NOTES: INTERNAL MEDICINE\nREADING NOTES", date: datetime(year: 2024, month: 03, day: 26), abstract: [ 作者:韩暮秋 \ 项目主页:#link("https://github.com/muqiuhan/internal-medicine-note") ], preface: [ #align(center + horizon)[ 《协和听课笔记:内科学》@main 一书是由多名中国协和医科大学八年制在校学生根据课堂笔记精心编写而成。全书共分为10篇,分别是绪论、呼吸系统疾病、循环系统疾病、消化系统、疾病、泌尿系统疾病、血液系统疾病、内分泌系统疾病、代谢疾病和营养疾病、组织病和风湿性疾病、理化因素所致疾病等,并以核心内容、内容精要、学习提示、主治语录等形式对各章重点、难点进行详细讲解,同时配以复习题、模拟题方便读者学习。 本书内容具体,实用性极强,适合广大医学院校在校学生使用。 ] ], bibliography: bibliography("refs.bib"), chapter-pagebreak: false, figure-index: true, table-index: true, listing-index: true, ) #set text(font: ("./MiSans-Semibold")) ) = 绪论 == 内科疾病诊断的临床思维 略 == 内科学的学习方法 1. “生物-心理-社会医学模式” 主要是在防治内科疾病的时候,不仅仅要注意影响人群健康的生物学因素,同时也要注意心理和社会因素,不仅仅局限于防疫措施和药物的使用,更重要的是平日身心的保健和治疗中的心理治疗问题。 2. 严格遵守工作规范和诊疗常规,严格按照制度做好病例记录,在医疗工作中自我保护。时刻关爱患者,一切为患者着想,尊重患者的知情权和选择权,对治疗方案以及预后要与患者交代沟通。 3. 循证医学(evidence-based medicine, EBM)@循证医学 的内涵是:慎重,准确和明智的使用当前所能获得的最好研究依据,结合医生本人的临床经验,同时考虑患者的愿望,综合三点制定出每个患者具体的诊疗措施。 #rect(fill: luma(240), stroke: (left: 0.25em))[ *韩暮秋:* 循证医学是一种医学诊疗方法,它将证据依知识论上的强度分类,并要求只有强度最高的证据(如元分析、系统性评论和随机对照试验)才能归纳为有力的建议证据;相对较无力的证据(如专家意见、动物实验、细胞实验、基本原理推论)只能归入有力程度不高的建议。这个词本意是阐述一种方法,用于医学诊疗教学及改善不同医师面对不同患者时的决策方式。此名称的应用范围快速扩大到包罗更广的循证实践,以设计适用于患者群和整个群体的指引及政策(循证诊疗政策),包含教育、管理、法律、公共政策和建筑安全等其他研究领域。 ] = 呼吸系统疾病 == 总论 === 呼吸系统结构、功能与疾病 1. 成人呼吸总面积约为 $100m^2$ (3亿~7.5亿个肺泡) 人体可能会吸入无(有)机粉尘, 蛋白变应原, 有害气体和病原微生物,但可以通过鼻部加温过滤,咳嗽-喷嚏,黏液-纤毛运载等理化或巨噬细胞,免疫球蛋白(IgA)等生化防御。 2. 肺循环 低压、低阻、高容 二尖瓣狭窄,左心功能不全(高血压性心脏病)-> 肺毛细血管血压增高 -> 间质性肺水肿 -> 肺(泡)水肿 低蛋白血症(肝硬化、肾病综合征)-> 血浆渗透压下降 -> 间质性肺水肿 -> 肺(泡)水肿 #rect(fill: luma(240), stroke: (left: 0.25em))[ *主治语录:* 阻力高可导致压力高,如血管炎的病人因动脉内膜增厚导致高阻,常发肺动脉高压 ] === 影响呼吸疾病的相关重要因素 降尘、$"SO"_2$、烟雾、棉尘、二氧化矽和工业废气都可能导致慢性支气管炎、慢性阻塞性肺病、肺尘埃沉着病、肺硅沉着病和肺癌。 #rect(fill: luma(240), stroke: (left: 0.25em))[ *韩暮秋:*吸烟可导致慢性支气管炎和肺癌发病率升高 @中国吸烟危害健康报告2020 ] === 呼吸系统感染病原学 + 社会获得性肺部感染:肺炎球菌、流感嗜血杆菌、卡拉莫拉汉菌、军团菌、支原体、衣原体、病毒 + 医院获得性肺部感染:铜绿假单胞菌、肺炎克雷伯杆菌、大肠杆菌 + 其他:葡萄球菌、真菌、结核分枝杆菌 #rect(fill: luma(240), stroke: (left: 0.25em))[ *主治语录:* 院内感染菌一般都是耐药菌 ] === 呼吸系统疾病诊断 1. 病史 1. 吸入屋尘、花粉、干草,剧烈运动。 2. 重度吸烟史——慢性阻塞性肺病、肺炎。 3. 生吃蝲蛄 @蝲蛄 、草乌龟血——肺吸虫、管型线虫病 4. 口服血管紧张转换酶抑制药——顽固咳嗽。 2. 症状 1. 咳嗽 1. 伴急性发热、声音嘶哑——急性支气管炎。 2. 伴急性发热、血痰——肺炎 3. 发作性(夜间、凌晨)——支气管哮喘 4. 持续性加重伴气促——肺癌、支气管内膜结核、特发性肺纤维化、慢性阻塞性肺病。 2. 咳痰 1. 白痰->黄痰——细菌感染 2. 长期大量浓痰——支气管扩张 3. 铁锈痰——肺炎 4. 果酱样痰——肺吸虫病 5. 支气管管型——肺变态反映疾病 3. 咯血 1. 鲜血——支气管扩张、肺结核。 #rect(fill: luma(240), stroke: (left: 0.25em))[ *主治语录:* 支气管扩张、肺结核时咯鲜血一般都是突发、大量。 ] 2. 长期少量血丝痰——肺癌。 3. 伴剧烈胸痛——肺栓塞。 4. 呼吸困难(频率、深度、节律) 1. 急性——肺炎、气胸、肺水肿(左心衰竭)、肺栓塞。 2. 慢性——慢性阻塞性肺病、特发性肺纤维化。 3. 吸气性——上气道阻塞。 #rect(fill: luma(240), stroke: (left: 0.25em))[ *主治语录:* 上气道阻塞的常见原因有喉炎、喉头水肿、气道异物、气道肿瘤。 ] 4. 呼气性——支气管哮喘。 5. 胸痛 1. 壁层胸膜侵犯(胸膜炎、肺梗死、肺炎、肺癌、气胸)。 2. *注意*非呼吸系统引起(心绞痛、胆囊炎、纵隔、食管等)。 3. 体征 1. 呼吸频率、节律、深度。 2. 气道位置、胸廓对称程度。 3. 叩诊(实变、积液)。 4. 听诊 @全网最全肺部听诊音 1. 干啰音——慢性阻塞性肺病、支气管内膜结核 2. 湿啰音 1. 吸气全相——支气管扩张 2. 小水泡音——肺炎 3. 捻发音——特发性肺纤维化 3. 支气管呼吸音——肺实变 4. 呼吸音消失——胸腔积液 #rect(fill: luma(240), stroke: (left: 0.25em))[ *主治语录:* 支气管内膜结核一般都是固定部位的。 ] 4. 实验室和其他检查:最基本的影像学,胸透、胸片;肺功能(肺容量通气功能);纤维支气管镜。 == 急性上呼吸道感染及急性气管,支气管炎 === 核心问题 1. 急性上呼吸道感染的临床表现 2. 急性器官,支气管炎的临床表现 === 急性上呼吸道感染 急性上呼吸道感染是鼻腔、咽、喉急性炎症的概称,常见病因为病毒(70%~80%),细菌常见溶血性链球菌 @溶血性链球菌。 #rect(fill: luma(240), stroke: (left: 0.25em))[ *韩暮秋:*溶血性链球菌(Streptococcus hemolyticus)在自然界中分布较广,是一种常见的病原微生物,呈球形或椭圆形,直径0.6-1.0μm,呈链状排列,长短不一,从4-8个至20-30个菌细胞组成不等,链的长短与细菌的种类及生长环境有关。 其广泛存在于水、空气、尘埃、粪便及健康人和动物的口腔、鼻腔、咽喉中,可通过直接接触、空气飞沫或皮肤、黏膜伤口感染传播,而被污染的食品如奶、肉、蛋及其制品也会使人类感染,上呼吸道感染患者、人畜化脓性感染部位常成为食品污染的污染源。 ] ==== 临床表现 1. 普通感冒:轻度和自限性的上呼吸道感染,病原体以鼻病毒和冠状病毒为主,鼻咽部卡他症状 @卡他症状 为主,一般无发热或全身症状。 #rect(fill: luma(240), stroke: (left: 0.25em))[ *韩暮秋:*卡他症状是临床上最常见的一种症状,一般多见于急性上呼吸道感染。具体来讲,卡他症状就是指鼻塞、流鼻涕、打喷嚏等鼻部症状,因为卡他症状是一个外来的词汇,来自于拉丁语。 卡他的意思就是向下滴流,一般被用来形容黏膜渗出液体增多,后来被引用到呼吸道的疾病症状,称做上呼吸道卡他症状,也就指鼻腔里有浆液性的鼻涕往外面流出,出现鼻塞、流鼻涕、打喷嚏等症状,气道渗出液、分泌物增加,出现咳嗽、咳痰的症状。 因此,卡他症状既可见于普通感冒,也可以见于过敏性鼻炎,同时还可以见于一些传染性疾病前驱期,比如流行性出血热、流行性脑膜炎以及麻疹等。 ] 2. 病毒性咽炎和喉炎 1. 急性病毒性咽炎:咽部发痒和灼热感。 #rect(fill: luma(240), stroke: (left: 0.25em))[ *主治语录:* 咽部如疼痛明显提示继发性链球菌感染。 ] 2. 急性喉炎:发热、咳嗽时疼痛、声音嘶哑。 3. 疱疹性咽峡炎 @咽峡:柯萨奇病毒 A @柯萨奇病毒 导致,多见于儿童,发热、咽痛、咽部有疱疹、浅表溃疡,周围有红晕。 #rect(fill: luma(240), stroke: (left: 0.25em))[ *韩暮秋:*咽峡由腭帆后缘、左右腭舌弓及舌根(由腭垂、腭帆游离缘、两侧的腭舌弓、腭咽弓及舌根)共同围成的狭窄处称咽峡,为口腔通咽的孔口,也是口腔和咽的分界处。 英文名为oropharyngeal isthmus ] #rect(fill: luma(240), stroke: (left: 0.25em))[ *韩暮秋:*柯萨奇病毒又称克沙奇病毒(Coxsackievirus)是一种肠病毒(enterovirus),分为A和B两类,是一类常见的经呼吸道和消化道感染人体的病毒,感染后人会出现发热、打喷嚏、咳嗽等感冒症状。 ] 4. 咽结膜热 @咽结膜热:腺病毒导致,发热、咽痛、畏光、流泪、结膜充血,多见于儿童夏季游泳后。 #rect(fill: luma(240), stroke: (left: 0.25em))[ *韩暮秋:*咽结膜热症状与急性发热性咽喉炎相似,但常同时发生结膜炎。咽结膜热有暴发流行倾向,如游泳池结膜炎,多由B组腺病毒3和7型所致,愈后尚好,一般无后遗症。 ] 5. 化脓性扁桃体炎:多由于溶血性链球菌导致,起病急,高热,畏寒,咽痛,咽部充血、扁桃体肿大、充血、黄色点状渗出物。 ==== 治疗 无特异抗病毒治疗,继发细菌感染可用青霉素、I 代头孢、大环内酯类、喹诺酮类等药物。 *附:流行性感冒* 流感病毒导致,可同时累及上下呼吸道,常有全身症状,发热、头痛、肌痛。 无并发症者不需抗生素治疗,合并细菌性肺炎可用抗生素,COPD患者 @copd 出现呼吸困难加重、痰量增多、浓痰需要加抗生素。 #rect(fill: luma(240), stroke: (left: 0.25em))[ *韩暮秋:*CPOD 就是慢性阻塞性肺病,是一种常见的肺部疾病,会导致气流受限和呼吸问题。该病有时也被称为肺气肿或慢性支气管炎。慢性阻塞性肺病是无法治愈的,但如果避免吸烟、少接触空气污染并接种疫苗来预防感染,症状会得到改善。也可以用药物、氧气和肺部康复进行治疗。 ] === 急性气管-支气管炎 1. 感染——病毒、细菌直接感染,或继发于上呼吸道感染。 2. 理化刺激——冷空气、粉尘、刺激性气体。 3. 过敏——花粉、有机粉尘等。 ==== 临床表现 1. 先表现为鼻塞、流清鼻涕等上感表现,全身症状轻微,咳嗽咳痰明显,开始为干咳或少量黏液痰,随后咳嗽渐重,痰量增加并变为脓性,病程 2~3 周。 #rect(fill: luma(240), stroke: (left: 0.25em))[ *主治语录:* 急性气管-支气管炎很可能迁延成为慢性支气管炎。 ] 2. 啰音部位不定,随体位变化,咳嗽后可缓解。 3. CXR @CXR 最多出现肺纹理粗乱。 #rect(fill: luma(240), stroke: (left: 0.25em))[ *韩暮秋:*CXR 即 Chest X-rays ,胸部 X 射线。 ] ==== 治疗 可用青霉素、I 代头孢、大环内酯类、喹诺酮类药物。 == 肺部感染性疾病 === 核心问题 1. 社区获得性肺炎、医院获得性肺炎、重症肺炎的诊断标准和抗菌药物的选择。 2. 肺炎球菌肺炎的病理、临床表现和治疗。 3. 支原体肺炎的临床特点、诊断和治疗用药。 4. 肺脓肿的诊断、治疗原则和方法。 === 肺炎概述 终末气道、肺泡腔、肺间质的炎症;感染是最常见的原因,细菌性肺炎是最常见的肺炎。 病原体抵达下呼吸道,引起肺泡充血、水肿、肺泡内纤维蛋白渗出和细胞浸润;除某些坏死性病变外,一般不遗留瘢痕。 ==== 病因分类 1. 细菌性 1. G#super[+]球菌(肺炎链球菌、金黄色葡萄球菌)。 2. G#super[-]杆菌(流感嗜血杆菌、肺炎克雷伯杆菌、铜绿假单胞菌)。 3. 厌氧菌 2. 真菌性:白色念珠菌、放线菌。 3. 支原体肺炎。 ==== 解剖分类 1. 肺泡性肺炎:病原体感染引起肺泡炎症并通过肺泡间孔扩展。胸部 X 线往往显示片状阴影,甚至肺叶或肺段的实变,因此也称为大叶性肺炎,多见于肺炎球菌感染。 2. 支气管肺炎:病原体感染发生于支气管腔内,并通过支气管扩展,因此胸部 X 线平片显示炎症浸润阴影在支气管周围。 #rect(fill: luma(240), stroke: (left: 0.25em))[ *主治语录:* 支气管肺炎 X 线平片特征显示炎症浸润阴影沿支气管分布。 ] 3. 间质性肺炎:炎症主要分布于肺间质,多并发于小儿麻疹,成人慢性支气管炎。主要累及支气管壁和支气管周围,导致间质水肿,肺泡壁增厚。X 线表现为单侧或双侧下肺野沿支气管分布的索条状阴影,从肺门向外伸展,可呈网状,期间可由许多小片状肺不张阴影。 #rect(fill: luma(240), stroke: (left: 0.25em))[ *主治语录:* 要知道解剖分类的界定标准,这对临床诊断很重要。 ]
https://github.com/tiankaima/typst-notes
https://raw.githubusercontent.com/tiankaima/typst-notes/master/feebf7-2023_fall_TA/extensions/qq.countable.typ
typst
#import "../utils.typ": * === $QQ$可数 <QQ.countable> 在分析中我们会经常无穷集合,透过一些性质,我们认为他们的"大小"不完全相同. 但不同于有限集合,无穷集合无法直接通过比较元素"个数"来比较大小,无穷集合的大小需要通过映射进行比较,来定义「基数」. #definintion(name: "无穷集合的基数")[ 无穷集合的基数并不是元素的个数,但确实是有限集合中"个数"概念的推广. 我们通过两个集合$A,B$之间的关系来定义基数: 1. 如果$exists f: A->B$是一一映射(双射),则称$A$和$B$的基数相同,记作$abs(A)=abs(B)$. 2. 如果$forall f: A->B$总不存在一一映射,但$exists f: A -> C subset.neq B$(存在一个到$B$真子集$C$的一一映射,与这个子集$C$有相同的基数),则称$A$的基数小于$B$的基数,记作$abs(A)<abs(B)$. 因为这是门分析的课,我们补充说明「基数相同」是"良定义"的,意味着这样定义有着良好的性质: - 自反性: $abs(A)=abs(A)$ - 对称性: $abs(A)=abs(B) <=> abs(B)=abs(A)$ - 传递性: $abs(A)=abs(B), abs(B)=abs(C) => abs(A)=abs(C)$ 在后续的课程中,满足这样性质的关系称为「等价关系」,这里不做过多解释. ] #definintion(name: "可数")[ 特别的,如果一个集合$A$与自然数集$NN$存在相同的基数,即存在$f: A -> NN, a|-> n$是双射,我们称这个集合是可数的. ] 我们通过下面几个例子来说明可数的概念. #statement[ $ZZ$是可数的. ] #proof[ 证明可数的方式,一般是考虑构造定义中的双射,在这里需要构造: $ f: & ZZ -> NN\ & z |-> n $ 首先考虑 $ f = abs(z) $ 但这里$f$不是双射,例如$-1$和$1$都被映射到了$1$. 只需做一点缩放,对负数的部分做一些调整,就可以得到这样的双射: $ f = cases( abs(z) * 2 &z >= 0\ abs(z) * 2 - 1 quad &z < 0 ) $ 容易说明$f$是双射,因此$ZZ$是可数的. ] #statement[ $QQ$是可数的. ] #proof[ 回忆课上的对角线的图示,那个方法足够直观,我们来完善这个证明: 考虑$QQ$的定义: $ QQ := {p / q | p,q in NN, q !=0} $ 我们可以按照$n = abs(p) + abs(q)$对$QQ$进行一次分类: - $n=0, Q_0 = emptyset$ - $n=1, Q_1 = {0}$ - $n=2, Q_2 = {1 / 1, -1 / 1}$ - $n=3, Q_3 = {1 / 2, -1 / 2, 2 / 1, -2 / 1}$ - $n=4, Q_4 = {1 / 3, -1 / 3, 2 / 2, -2 / 2, 3 / 1, -3 / 1}$ - $dots.c$ 把这些数组"展平"成一维数组,我们可以得到: $ QQ &= Q_0 union Q_1 union Q_2 union Q_3 union Q_4 union dots.c \ &= {0, 1 / 1, -1 / 1, 1 / 2, -1 / 2, 2 / 1, -2 / 1, 1 / 3, -1 / 3, 2 / 2, -2 / 2, 3 / 1, -3 / 1, dots.c} $ 依照这样的办法$QQ = {q_n}$,自然形成了一个双射:$n |-> q_n$,因此$QQ$是可数的. 这里用数列表示的方式说明可数,也对应着可数的另一个翻译:可列 #text(fill: red)[ 在部分教材中会区分这两个概念:认为可数是指「有限或可列」,而可列是指一定是无穷多的. 事实上这两个名字都是从 countable 翻译而来的,一般来说都不会指有限集合,需要包含有限集合时会使用「至多可数」的概念. ] ] #homework[ 通过十进制小数证明$RR$是不可数的 ] #pagebreak()
https://github.com/DrakeAxelrod/cvss.typ
https://raw.githubusercontent.com/DrakeAxelrod/cvss.typ/main/bak/src/lib.typ
typst
MIT License
#let severity = ( NONE: "None", LOW: "Low", MEDIUM: "Medium", HIGH: "High", CRITICAL: "Critical" ) #let test-string = "CVSS:4.0/AV:A/AC:H/AT:P/PR:L/UI:P/VC:L/VI:L/VA:L/SC:L/SI:L/SA:L/E:A/CR:L/IR:L/AR:L/MAV:N/MAC:L/MAT:N/MPR:N/MUI:N/MVC:H/MVI:H/MVA:H/MSC:L/MSI:L/MSA:L/S:N/AU:N/R:A/V:D/RE:L/U:Clear" #let re = regex("([A-Za-z]{1,3}):([A-Za-z]{1,11})") #let metrics(s) = { s.matches(re).fold((:), (acc, it) => { let (k, v) = it.captures acc + ((k): v) }) } // None 0.0 // Low 0.1 - 3.9 // Medium 4.0 - 6.9 // High 7.0 - 8.9 // Critical 9.0 - 10.0 #let severity(s) = { } #metrics(test-string)
https://github.com/ustctug/ustc-thesis-typst
https://raw.githubusercontent.com/ustctug/ustc-thesis-typst/main/chapters/citations.typ
typst
MIT License
= 引用文献的标注 <引用文献的标注> 模板使用 宏包来设置参考文献引用的格式, 更多引用方法可以参考该宏包的使用说明。 == 顺序编码制 <顺序编码制> === 角标数字标注法 <角标数字标注法> #align(center)[#table( columns: 2, align: (col, row) => (left,left,).at(col), inset: 6pt, [`\cite{knuth86a}`], [#cite(<knuth86a>)], [`\citet{knuth86a}`], [#cite(<knuth86a>)], [`\cite[42]{knuth86a}`], [#cite(<knuth86a>)], [`\cite{knuth86a,tlc2}`], [#cite(<knuth86a>)#cite(<tlc2>)], [`\cite{knuth86a,knuth84}`], [#cite(<knuth86a>)#cite(<knuth84>)], ) ] === 数字标注法 <数字标注法> #align(center)[#table( columns: 2, align: (col, row) => (left,left,).at(col), inset: 6pt, [`\cite{knuth86a}`], [#cite(<knuth86a>)], [`\citet{knuth86a}`], [#cite(<knuth86a>)], [`\cite[42]{knuth86a}`], [#cite(<knuth86a>)], [`\cite{knuth86a,tlc2}`], [#cite(<knuth86a>)#cite(<tlc2>)], [`\cite{knuth86a,knuth84}`], [#cite(<knuth86a>)#cite(<knuth84>)], ) ] == 著者-出版年制标注法 <著者-出版年制标注法> #align(center)[#table( columns: 2, align: (col, row) => (left,left,).at(col), inset: 6pt, [`\cite{knuth86a}`], [#cite(<knuth86a>)], [`\citep{knuth86a}`], [#cite(<knuth86a>)], [`\citet[42]{knuth86a}`], [#cite(<knuth86a>)], [`\citep[42]{knuth86a}`], [#cite(<knuth86a>)], [`\cite{knuth86a,tlc2}`], [#cite(<knuth86a>)#cite(<tlc2>)], [`\cite{knuth86a,knuth84}`], [#cite(<knuth86a>)#cite(<knuth84>)], ) ]
https://github.com/ckunte/m-one
https://raw.githubusercontent.com/ckunte/m-one/master/inc/impact.typ
typst
= Dropped pipe Last week I had an interesting problem to review at work: For a falling body through the water column, I needed to find the impact energy if it hit infrastructure on seabed. I haven't ever done this before, which itself is a question, isn't it? I brought this up during a FaceTime call with my daughter at university. She said she had written a paper in her pre-university IB diploma years entitled, _"Investigating the relationship between the radius of a body and terminal velocity"_, and emailed a copy. She used _honey_ as the medium, and determined the submerged mass of the falling body, honey's viscosity, et al. How cool is that? Back to the problem, one can find a wide variety of examples online using a spherical object, and you'd wonder why. It's because much of the theory is from Stoke's Law@stokes_1851. For his experiments, <NAME> used a sphere as the falling body. Whereas my falling body was a pipe with open ends, and I had to calculate its drag force. While Stoke's Law itself is not directly applicable, since it uses properties of a sphere, the basic approach by Stokes for calculating the terminal velocity is still valid. == Impact energy Impact energy (W) of a falling body through fluid can be expressed as follows: $ W = 1 / 2 m v^2 $ where, _m_ is the submerged mass of the object, and _v_ is the velocity of the falling object. == Terminal velocity From first principles, as the pipe falls through seawater, its gravitational force ($F_g$) is resisted by its drag force ($F_d$). The maximum velocity achievable by a falling object is known as the _terminal velocity_ ($v_t$), at which $F_g$ = $F_d$ and buoyancy. $ F_g = F_d \ m g = F_("dn") + F_("dt") $ $F_("dn")$ is drag force for a cross section normal to the direction of motion, which uses the normal coefficient of drag, $C_("dn")$. Whereas $F_("dt")$ is the drag (frictional) force generated due to the surface area that is parallel to the direction of motion, and which uses the tangential coefficient of drag, $C_("dt")$. $ F_("dn") = 1 / 2 rho C_("dn") A v^2 $ where, $rho$ is the seawater density, and _A_ is the cross sectional area of the pipe. $ F_("dt") = 1 / 2 rho C_("dt") pi D L v^2 $ where, _D_ and _L_ are pipe diameter and length respectively. Notice that in $F_("dt")$, I have used only the outer surface. If the diameter is sufficiently large, then one could also potentially consider drag from pipe's inner surface. To keep the problem simple, I have chosen to ignore it because flow through pipe may modify its $C_("dt")$ value, since Reynolds number (an indicator of fluid flow) may change (potentially making it a turbulent flow) when considered within the pipe. Also, the $C_("dt")$ value is already so low at 0.008 for the outer surface, that ignoring surface friction inside the pipe is not too inaccurate. In the above, $F_d$ formulation is for a pipe falling vertically (i.e., with its longitudinal axis parallel to the direction of motion). This is the worst case since any change in the angle of incidence relative to the direction of motion increases drag substantially due to projected surface area times the drag coefficient. This then becomes: $ m g = 1 / 2 rho (C_("dn") A + C_("dt") pi D L) v_t^2 $ Finding terminal velocity ($v_t$) from above is straight forward, as below: $ v_t = sqrt( (m g) / ( 1 / 2 rho (C_("dn") A + C_("dt") pi D L) ) ) $ Once the terminal velocity is known, we can find the time it takes the dropped pipe from surface to reach seabed using the following expression: $ y(t) = y_0 - (v_t^2 / g) ln cosh( (g t) / v_t) $ where, y$(t)$ is the altitude w.r.t. time, _g_ is the acceleration due to gravity, $y_0$ is the initial altitude, _t_ is time elapsed, and $v_t$ is of course the terminal velocity. To determine intermediate velocity of a falling object, the following can be used: $ v(t) = v_t tanh( (g t) / v_t ) $ For a problem I was reviewing, the plots look somewhat like these with code furnished below for generating them. #figure( image("/img/impact.png", width: 100%), caption: [ Time taken by the falling pipe through seawater versus the depth ] ) <im> #let impact = read("/src/impact.py") #{linebreak();raw(impact, lang: "python")} $ - * - $
https://github.com/edandresvan/quarto-extensions
https://raw.githubusercontent.com/edandresvan/quarto-extensions/main/uptctareaapa/_extensions/uptctareaapa/typst-template.typ
typst
MIT License
// This is an example typst template (based on the default template that ships // with Quarto). It defines a typst function named 'article' which provides // various customization options. This function is called from the // 'typst-show.typ' file (which maps Pandoc metadata function arguments) // // If you are creating or packaging a custom typst template you will likely // want to replace this file and 'typst-show.typ' entirely. You can find // documentation on creating typst templates and some examples here: // - https://typst.app/docs/tutorial/making-a-template/ // - https://github.com/typst/templates #let config = ( page: ( paper: "us-letter", margin: ( top: 2.5cm, left: 2.5cm, bottom: 2.5cm, right: 2.5cm, ), header-ascent: 40%, ), fonts: ( sans_serif: "IBM Plex Sans", serif: "Schibsted Grotesk", mono: "Hack", math: "", headings: "IBM Plex Sans", body: "IBM Plex Sans", page_number: "Schibsted Grotesk", base_size: 11pt, ), text: ( lang: "es", region: "ES", ), paragraph: ( line_spacing: 1.4em, first_line_indent: 1.27cm, ), asignatura: none, universidad: none, facultad: none, escuela: none, fecha: none, ) // IBM Plex Sans, Schibsted Grotesk #let encabezado(config: none, doc) = { set align(right) set text(size: config.fonts.base_size * 0.8, weight: 300, font: config.fonts.page_number) counter(page).display() doc } #let obtener_suplemento(it) = { if it.kind == image { [Figura] } else if it.kind == table { [Tabla] } else if it.kind == raw { [Listado] } else { it.kind } } #let configurar_figuras(config: none, figura) = { show figure: set block(breakable: true, width: 100%, spacing: config.paragraph.line_spacing) show figure.where( kind: image ): set block(breakable: false) show figure.caption: it => { set align(left) set par(first-line-indent: 0em) v(config.paragraph.line_spacing) text(weight: 600, it.supplement + " " + it.counter.display(it.numbering) + ": ") text(style: "italic", it.body) } show figure: set figure.caption(position: top) set image(fit: "contain") if figura.kind == "quarto-float-fig" { align(center + top, block(breakable: false, width: 100%, spacing: config.paragraph.line_spacing, [#figura.caption #figura.body ])) } else { align(center + top, figura.caption + figura.body) } } #let configurar_tablas_base(config: none, tabla) = { //set table(align:left) show table.cell: it => { if it.y == 0 { align(center, strong(it)) } else { align(left, it) } } { // Configurar párrafos set align(left) set par( leading: 0.8em, first-line-indent: 0em, justify: false) show par: set block(spacing: 0.8em) set list(spacing: 0.8em) tabla } } #let configurar_texto_base(config: none, doc) = { // Configurar Idioma set text(lang: config.text.lang, region: config.text.region) // Configurar Títulos show heading: set text(size: config.fonts.base_size * 1.5, font: config.fonts.headings, weight: 700) show heading: set block(above: 3em, below: 2em) show heading: set align(left) show heading.where(level: 1): it => { set align(center) it } // Configurar Cuerpo de Texto set text(font: config.fonts.body, size: config.fonts.base_size) // Configurar párrafos set align(left) set par( leading: config.paragraph.line_spacing, first-line-indent: config.paragraph.first_line_indent, justify: false) show par: set block(spacing: config.paragraph.line_spacing) // Configurar texto de código en línea con el texto show raw: set text(font: config.fonts.mono, size: config.fonts.base_size * 0.9) // Configurar listas show list: set block(spacing: config.paragraph.line_spacing) show enum: set block(spacing: config.paragraph.line_spacing) //show ref: it => obtener_suplemento(it) doc } #let configurar_texto_preliminares(config: none, doc) = { // Configurar textos show: doc => configurar_texto_base(config: config, doc) doc } #let configurar_texto_cuerpo(config: none, doc) = { // Configurar textos show: doc => configurar_texto_base(config: config, doc) // Configurar Títulos // ? counter(heading).display() // #show heading: underline.with(stroke: 2pt) // show heading: set text(size: config.fonts.base_size * 1.5, font: config.fonts.headings, weight: 700, fill: green) set heading(numbering: "1.1.") doc } #let portada(title: none, authors: none, date: none, organization: none, config: none) = { // Configurar página set page( paper: config.page.paper, margin: config.page.margin, numbering: none, header-ascent: config.page.header-ascent, header: [#show: encabezado(config: config)[]] ) // Idioma set text(lang: config.text.lang, region: config.text.region) set text(font: config.fonts.sans_serif, size: config.fonts.base_size, weight: 400) // ***** Contenido ***** set align(center) // Ocultar el título de portada pero mostrarlo como marcador { set text(size: 0pt) heading(level: 1, numbering: none, outlined: false, bookmarked: true, "Portada") } // Mostrar el título de la tarea text(size: 1.5em, weight: 700, upper(title)) v(3cm) // Mostrar los autores text(size: 0.8em, "Presentado por:") v(2mm) for author in authors { if author.type == [student] { text(author.name) } v(0.1cm) } v(4cm - (authors.len() * 0.1cm)) text(size: 0.8em, "Docente:") v(0.1cm) for author in authors { if author.type == [professor] { text(author.name) } v(0.1cm) } v(0.5cm) text(size: 0.8em, "Asignatura:") v(0.1cm) text(organization.subject) v(3cm) image("logo-uptc.png", width: 26%) v(0.5cm) text(organization.university) v(0cm) text(organization.faculty) v(0cm) text(organization.school) v(0cm) text(organization.program) v(0cm) text(date) v(0.1cm) } #let preliminares(toc: true, doc) = { // Configurar Página set page( paper: config.page.paper, margin: config.page.margin, numbering: none, header-ascent: config.page.header-ascent, header: [#show: encabezado(config: config)[]], ) // Configurar textos show: doc => configurar_texto_preliminares(config: config, doc) // Configurar figuras show figure: it => [#configurar_figuras(config: config, it)] // Configurar tablas show table: it => [#configurar_tablas_base(config: config, it)] // Mostrar las tablas de contenidos if toc == true { // Mostrar Tabla de Contenido heading(level: 1, numbering: none, outlined: false, bookmarked: true, "Contenido") outline( title: "", indent: 2em ) pagebreak() // Mostrar Lista de Figuras locate(loc => { if query(figure.where(kind: "quarto-float-fig"), loc).len() > 0 { heading(level: 1, numbering: none, outlined: false, bookmarked: true, "Lista de Figuras") outline(title:"", target: figure.where(kind: "quarto-float-fig"),) pagebreak() } }) // Mostrar Lista de Tablas locate(loc => { if query(figure.where(kind: "quarto-float-tbl"), loc).len() > 0 { heading(level: 1, numbering: none, outlined: false, bookmarked: true, "Lista de Tablas") outline(title:"", target: figure.where(kind: "quarto-float-tbl"),) pagebreak() } }) } doc } #let cuerpo(doc) = { { set page( paper: config.page.paper, margin: config.page.margin, numbering: none, header-ascent: config.page.header-ascent, header: [#show: encabezado(config: config)[]] ) // Configurar texto show: doc => configurar_texto_cuerpo(config: config, doc) // Configurar figuras show figure: it => [#configurar_figuras(config: config, it)] // Configurar tablas show table: it => [#configurar_tablas_base(config: config, it)] doc } } #let posteriores(bibliography-file: none, doc) = { { set page( paper: config.page.paper, margin: config.page.margin, numbering: none, header-ascent: config.page.header-ascent, header: [#show: encabezado(config: config)[]] ) // Configurar texto show: doc => configurar_texto_cuerpo(config: config, doc) // Configurar figuras show figure: it => [#configurar_figuras(config: config, it)] // Configurar tablas show table: it => [#configurar_tablas_base(config: config, it)] pagebreak() doc // Bibliografía if bibliography-file != none { pagebreak() set par(justify: false, first-line-indent: 0cm) bibliography(bibliography-file, full: true, style: "american-psychological-association") } } } #let article( title: none, authors: none, organization: none, date: none, lang: none, region: none, abstract: none, abstract-title: none, cols: 1, sectionnumbering: none, toc: false, toc_title: none, toc_depth: none, toc_indent: 1.5em, subject: none, doc, ) = { portada(title: title, authors: authors, date: date, organization: organization, config: config) //show: doc => preliminares(config: config, doc) //pagebreak() // set page( // paper: paper, // margin: margin, // numbering: "1", // ) // set par(justify: true) // set text(lang: lang, // region: region, // font: font, // size: fontsize) // set heading(numbering: sectionnumbering) // if title != none { // align(center)[#block(inset: 2em)[ // #text(weight: "bold", size: 1.5em)[#title] // ]] // } // if authors != none { // let count = authors.len() // let ncols = calc.min(count, 3) // grid( // columns: (1fr,) * ncols, // row-gutter: 1.5em, // ..authors.map(author => // align(center)[ // #author.name \ // #author.affiliation \ // #author.email // ] // ) // ) // } // if date != none { // align(center)[#block(inset: 1em)[ // #date // ]] // } // if abstract != none { // block(inset: 2em)[ // #text(weight: "semibold")[#abstract-title] #h(1em) #abstract // ] // } // if toc { // let title = if toc_title == none { // auto // } else { // toc_title // } // block(above: 0em, below: 2em)[ // #outline( // title: toc_title, // depth: toc_depth, // indent: toc_indent // ); // ] // } // if cols == 1 { // doc // } else { // columns(cols, doc) // } doc } // #set table( // inset: 6pt, // stroke: none // )
https://github.com/ysthakur/PHYS121-Notes
https://raw.githubusercontent.com/ysthakur/PHYS121-Notes/main/Notes/Ch11.typ
typst
MIT License
#import "@preview/gentle-clues:0.3.0": note, important = Chapter 11: Using Energy == Efficiency / Efficiency: [What you get] divided by [what you had to pay] Two reasons for reductions in energy: - *Process limitations*, which cause energy loss due to practical reasons. You can design better, more efficient process - *Fundamental limitations*, which cause energy loss due to physical laws that can't be circumvented == Energy in the Body Hopefully this won't be on the exam because it's pretty boring stuff == Temperature, Thermal Energy, and Heat / Temperature: Average energy of atoms in an object / Thermal energy: Total energy of atoms in an object Kelvin scale (K): - 0 degrees is where kinetic energy of the atoms is 0 - Since kinetic energy always positive, 0 K is an absolute zero - Often called the *absolute temperature scale* - Spacing between degrees is same as Celsius - Absolute zero is about -273°C / Heat: Energy transferred between two objects because of a temperature difference between them Heat ($Q$) always flows from the hotter object to the cooler one ==== An Atomic Model of Heat #align(center)[ #image("/Images/11-Atomic-Model-Heat.png", width: 50%) ] - Thermal energy is transferred from the faster moving atoms on the warmer side to the slower moving atoms on the cooler side - Transfer is due to collisions in the middle - Transfer will continue until *thermal equilibrium* reached (final temperatures same) == The First Law of Thermodynamics Heat is positive when heat is transferred into a system *Thermodynamics* is about systems that are not moving and are not changing chemically, but whose temperatures can change #important(title: "First Law of Thermodynamics")[ For systems in which only thermal energy changes, the change in thermal energy is equal to the energy transferred into or out of the system as work $W$, heat $Q$, or both: $ Delta E_"th" = W + Q $ ] === Energy-Transfer Diagrams / Energy reservoir: An object or a part of the environment so large that that its temperature doesn't noticeably change when heat is transferred between the system and the reservoir, e.g., a block of ice. / Hot reservoir: A reservoir at higher temperatures ($T_upright(H)$) / Cold reservoir: A reservoir at higher temperatures ($T_upright(C)$) $Q_upright(H)$ and $Q_upright(C)$ are the amount of heat transferred from or to a hot and cold reservoir, respectively By definition, they are *positive quantities* #align(center)[ #image("/Images/11-Energy-Transfer-Diagram.png", width: 50%) ] In energy-transfer diagrams, the hot reservoir is drawn at the top and the cold reservoir at the bottom. The "pipes" connect the reservoir and system and show the energy transfers. Spontaneous transfers only ever go from hot to cold, never from cold to hot == Heat Engines / Heat engine: As thermal energy is naturally transferred from a hot reservoir to a cold reservoir, a heat engine takes some of that energy and converts it to other forms. The heat engine does some useful work $W_"out"$ and the rest is waste heat that goes to the cold reservoir. $ W_"out" = Q_upright(H) - Q_upright(C) $ *Heat engine's efficiency:* $ e = "what you get"/"what you had to pay" = W_"out"/Q_upright(H) = (Q_upright(H) - Q_upright(C))/Q_upright(H) $ *No heat engine can operate without exhausting some fraction of the heat into a cold reservoir.* This is a fundamental law of nature. The max efficiency is given by the second law of thermodynamics: #important(title: "Second Law of Thermodynamics")[ $ e_"max" = 1 - T_upright(C)/T_upright(H) $ where $T_upright(C)$ and $T_upright(H)$ are the temperatures of the cold and hot reservoirs, respectively, in Kelvin ] == Heat Pumps / Heat pump: Heat pumps transfer energy from cold reservoir to hot reservoir (usually used for cooling by transferring heat elsewhere) For heat pumps, use *coefficient of performance (COP)* instead of efficiency: $ "COP" = "what you get"/"what you had to pay" $ A larger COP means a more efficient heat pump. === Heat Pumps for Cooling If we use the heat pump for cooling, COP defined as $ "COP" = "energy removed from cold reservoir"/"work required to perform transfer" = Q_upright(C)/W_"in" $ Theoretical maximum COP of a heat pump used for cooling: $ "COP"_"max" = T_upright(C)/(T_upright(H) - T_upright(C)) $ === Heat Pumps for Heating If we use the heat pump for heating, COP defined as $ "COP" = "energy added to hot reservoir"/"work required to perform transfer" = Q_upright(H)/W_"in" $ Theoretical maximum COP of a heat pump used for heating: $ "COP"_"max" = T_upright(H)/(T_upright(H) - T_upright(C)) $
https://github.com/typst/packages
https://raw.githubusercontent.com/typst/packages/main/packages/preview/unichar/0.1.0/ucd/block-0D00.typ
typst
Apache License 2.0
#let data = ( ("MALAYALAM SIGN COMBINING ANUSVARA ABOVE", "Mn", 0), ("MALAYALAM SIGN CANDRABINDU", "Mn", 0), ("MALAYALAM SIGN ANUSVARA", "Mc", 0), ("MALAYALAM SIGN VISARGA", "Mc", 0), ("MALAYALAM LETTER VEDIC ANUSVARA", "Lo", 0), ("MALAYALAM LETTER A", "Lo", 0), ("MALAYALAM LETTER AA", "Lo", 0), ("MALAYALAM LETTER I", "Lo", 0), ("MALAYALAM LETTER II", "Lo", 0), ("MALAYALAM LETTER U", "Lo", 0), ("MALAYALAM LETTER UU", "Lo", 0), ("MALAYALAM LETTER VOCALIC R", "Lo", 0), ("MALAYALAM LETTER VOCALIC L", "Lo", 0), (), ("MALAYALAM LETTER E", "Lo", 0), ("MALAYALAM LETTER EE", "Lo", 0), ("MALAYALAM LETTER AI", "Lo", 0), (), ("MALAYALAM LETTER O", "Lo", 0), ("MALAYALAM LETTER OO", "Lo", 0), ("MALAYALAM LETTER AU", "Lo", 0), ("MALAYALAM LETTER KA", "Lo", 0), ("MALAYALAM LETTER KHA", "Lo", 0), ("MALAYALAM LETTER GA", "Lo", 0), ("MALAYALAM LETTER GHA", "Lo", 0), ("MALAYALAM LETTER NGA", "Lo", 0), ("MALAYALAM LETTER CA", "Lo", 0), ("MALAYALAM LETTER CHA", "Lo", 0), ("MALAYALAM LETTER JA", "Lo", 0), ("MALAYALAM LETTER JHA", "Lo", 0), ("MALAYALAM LETTER NYA", "Lo", 0), ("MALAYALAM LETTER TTA", "Lo", 0), ("MALAYALAM LETTER TTHA", "Lo", 0), ("MALAYALAM LETTER DDA", "Lo", 0), ("MALAYALAM LETTER DDHA", "Lo", 0), ("MALAYALAM LETTER NNA", "Lo", 0), ("MALAYALAM LETTER TA", "Lo", 0), ("MALAYALAM LETTER THA", "Lo", 0), ("MALAYALAM LETTER DA", "Lo", 0), ("MALAYALAM LETTER DHA", "Lo", 0), ("MALAYALAM LETTER NA", "Lo", 0), ("MALAYALAM LETTER NNNA", "Lo", 0), ("MALAYALAM LETTER PA", "Lo", 0), ("MALAYALAM LETTER PHA", "Lo", 0), ("MALAYALAM LETTER BA", "Lo", 0), ("MALAYALAM LETTER BHA", "Lo", 0), ("MALAYALAM LETTER MA", "Lo", 0), ("MALAYALAM LETTER YA", "Lo", 0), ("MALAYALAM LETTER RA", "Lo", 0), ("MALAYALAM LETTER RRA", "Lo", 0), ("MALAYALAM LETTER LA", "Lo", 0), ("MALAYALAM LETTER LLA", "Lo", 0), ("MALAYALAM LETTER LLLA", "Lo", 0), ("MALAYALAM LETTER VA", "Lo", 0), ("MALAYALAM LETTER SHA", "Lo", 0), ("MALAYALAM LETTER SSA", "Lo", 0), ("MALAYALAM LETTER SA", "Lo", 0), ("MALAYALAM LETTER HA", "Lo", 0), ("MALAYALAM LETTER TTTA", "Lo", 0), ("MALAYALAM SIGN VERTICAL BAR VIRAMA", "Mn", 9), ("MALAYALAM SIGN CIRCULAR VIRAMA", "Mn", 9), ("MALAYALAM SIGN AVAGRAHA", "Lo", 0), ("MALAYALAM VOWEL SIGN AA", "Mc", 0), ("MALAYALAM VOWEL SIGN I", "Mc", 0), ("MALAYALAM VOWEL SIGN II", "Mc", 0), ("MALAYALAM VOWEL SIGN U", "Mn", 0), ("MALAYALAM VOWEL SIGN UU", "Mn", 0), ("MALAYALAM VOWEL SIGN VOCALIC R", "Mn", 0), ("MALAYALAM VOWEL SIGN VOCALIC RR", "Mn", 0), (), ("MALAYALAM VOWEL SIGN E", "Mc", 0), ("MALAYALAM VOWEL SIGN EE", "Mc", 0), ("MALAYALAM VOWEL SIGN AI", "Mc", 0), (), ("MALAYALAM VOWEL SIGN O", "Mc", 0), ("MALAYALAM VOWEL SIGN OO", "Mc", 0), ("MALAYALAM VOWEL SIGN AU", "Mc", 0), ("MALAYALAM SIGN VIRAMA", "Mn", 9), ("MALAYALAM LETTER DOT REPH", "Lo", 0), ("MALAYALAM SIGN PARA", "So", 0), (), (), (), (), ("MALAYALAM LETTER CHILLU M", "Lo", 0), ("MALAYALAM LETTER CHILLU Y", "Lo", 0), ("MALAYALAM LETTER CHILLU LLL", "Lo", 0), ("MALAYALAM AU LENGTH MARK", "Mc", 0), ("MALAYALAM FRACTION ONE ONE-HUNDRED-AND-SIXTIETH", "No", 0), ("MALAYALAM FRACTION ONE FORTIETH", "No", 0), ("MALAYALAM FRACTION THREE EIGHTIETHS", "No", 0), ("MALAYALAM FRACTION ONE TWENTIETH", "No", 0), ("MALAYALAM FRACTION ONE TENTH", "No", 0), ("MALAYALAM FRACTION THREE TWENTIETHS", "No", 0), ("MALAYALAM FRACTION ONE FIFTH", "No", 0), ("MALAYALAM LETTER ARCHAIC II", "Lo", 0), ("MALAYALAM LETTER VOCALIC RR", "Lo", 0), ("MALAYALAM LETTER VOCALIC LL", "Lo", 0), ("MALAYALAM VOWEL SIGN VOCALIC L", "Mn", 0), ("MALAYALAM VOWEL SIGN VOCALIC LL", "Mn", 0), (), (), ("MALAYALAM DIGIT ZERO", "Nd", 0), ("MALAYALAM DIGIT ONE", "Nd", 0), ("MALAYALAM DIGIT TWO", "Nd", 0), ("MALAYALAM DIGIT THREE", "Nd", 0), ("MALAYALAM DIGIT FOUR", "Nd", 0), ("MALAYALAM DIGIT FIVE", "Nd", 0), ("MALAYALAM DIGIT SIX", "Nd", 0), ("MALAYALAM DIGIT SEVEN", "Nd", 0), ("MALAYALAM DIGIT EIGHT", "Nd", 0), ("MALAYALAM DIGIT NINE", "Nd", 0), ("MALAYALAM NUMBER TEN", "No", 0), ("MALAYALAM NUMBER ONE HUNDRED", "No", 0), ("MALAYALAM NUMBER ONE THOUSAND", "No", 0), ("MALAYALAM FRACTION ONE QUARTER", "No", 0), ("MALAYALAM FRACTION ONE HALF", "No", 0), ("MALAYALAM FRACTION THREE QUARTERS", "No", 0), ("MALAYALAM FRACTION ONE SIXTEENTH", "No", 0), ("MALAYALAM FRACTION ONE EIGHTH", "No", 0), ("MALAYALAM FRACTION THREE SIXTEENTHS", "No", 0), ("MALAYALAM DATE MARK", "So", 0), ("MALAYALAM LETTER CHILLU NN", "Lo", 0), ("MALAYALAM LETTER CHILLU N", "Lo", 0), ("MALAYALAM LETTER CHILLU RR", "Lo", 0), ("MALAYALAM LETTER CHILLU L", "Lo", 0), ("MALAYALAM LETTER CHILLU LL", "Lo", 0), ("MALAYALAM LETTER CHILLU K", "Lo", 0), )
https://github.com/jgm/typst-hs
https://raw.githubusercontent.com/jgm/typst-hs/main/test/typ/math/style-02.typ
typst
Other
// Test a few style exceptions. $h, bb(N), cal(R), Theta, italic(Theta), sans(Theta), sans(italic(Theta))$
https://github.com/mismorgano/UG-DifferentialGeometry23
https://raw.githubusercontent.com/mismorgano/UG-DifferentialGeometry23/main/Tareas/Tarea-03/Tarea-03.typ
typst
#let title = [ Geometria Diferencial\ Tarea 3 ] #let author = [ <NAME> ] #let book = [ Differential Geometry of Curves and Surfaces ] #set text(12pt, font: "New Computer Modern") #set enum(numbering: "a)") #set math.equation(numbering: "(1)", supplement: [Eq.]) #align(center, text(17pt)[ *#title*\ #author ]) Del libro *#book*. _A menos que se diga lo contrario, $alpha: I -> RR^3$ es una curva parametrizada por longitud de arco $s$, con curvatura $k(s) != 0,$ para todo $s in I.$_ = Problemas == Problema 1 Dada la curva parametrizada (helix) $ alpha(s) = (a cos(s/c), a sin(s/c), b(s/c)), quad s in RR, $ donde $c^2 = a^2 + b^2,$ #enum[Muestra que el parametro $s$ es la longitud de arco. ][ Determina la curvatura y la torsión de $alpha$. ][ Determina el plano oscilatorio de $alpha$. ][ Muestra que las lineas que contienen $n(s)$ y pasan por $alpha(s)$ intersectan el eje $z$ bajo un angulo constante igual a $pi/2$. ][ Muestra que las lineas tangentes a $alpha$ hacen un angulo constante con el eje $z$. ] *Solución:* #enum[Para ello basta ver que $|alpha'(s)| = 1$. Notemos que $ alpha'(s) = (-a/c sin(s/c), a/c cos(s/c), b/c), $ luego, dado que $c^2 = a^2+b^2$, se cumple que $ norm(alpha'(s))^2 &= (-a/c)^2sin^2(s/c) + (a/c)^2 cos^2(s/c) + (b/c)^2 \ &= a^2/c^2(sin^2(s/c) + cos^2(s/c)) + b^2/c^2 \ &= (a^2 + b^2)/c^2 \ &= 1, $ lo anterior implica que $alpha$ esta parametrizada por longitud de arco. ][ Como $alpha$ esta parametrizada por longitud de arco tenemos que $k_alpha (s) = |alpha''(s)|$, notemos que $ alpha''(s) = (-a/c^2 cos(s/c), -a/c^2 sin(s/c), 0), $ por lo cual $ k_alpha (s) = |alpha''(s)| = sqrt(a^2/c^4 cos^2(s/c) + a^2/c^4 sin^2(s/c)) = abs(a)/c^2 $ ] == Problema 2 Una curva parametrizada regular $alpha$ tiene la propiedad que todas sus lineas tangentes pasan por un punto fijo: #enum[ Prueba que la traza de $alpha$ es un (segmento de una) linea recta. ][ ¿La conclusión de la parte *a* se sigue si $alpha$ no es regular? ] *Solución:* == Problema 3 Dada una función diferenciable $k(s), s in I$, muestra que la curva plana parametrizada teniendo $k(s) = k$ como curvatura esta dada por $ alpha(s) = (integral cos(theta(s)) d s + a, integral sin(theta(s)) d s +b), $ donde $ theta(s) = integral k(s) d s + phi, $ y que la curva es es determinada hasta una traslación del vector $(a, b)$ y una rotación del angulo $phi$. *Demostración:* Para ver que la curvatura de $alpha$ es $k$ primero calculemos su primera derivada. Por el Teorema Fundamental del Calculo tenemos que $ alpha'(s) = (cos(theta(s)), sin(theta(s))), $ de donde se puede ver que $alpha$ esta parametrizada por longitud de arco, luego, aplicando la regla de la cadena obtenemos $ alpha''(s) = ((cos(theta(s)))', (sin(theta(s)))') = (-sin(theta(s)) dot theta'(s), cos(theta(s))dot theta'(s)). $ El Teorema Fundamental del Calculo nos dice que $theta'(s) = k(s)$, por lo cual $ alpha''(s) = (-k(s)sin(theta(s)), k(s)cos(theta(s))), $ lo cual implica que $ k_alpha = norm(alpha''(s)) = sqrt(k(s)^2sin^2(theta(s)) + k(s)^2cos^2(theta(s))) = sqrt(k(s)^2) = abs(k(s)) = k(s), $ como queremos #footnote[En este caso supones que $k$ es no negativa.].
https://github.com/DannySeidel/typst-dhbw-template
https://raw.githubusercontent.com/DannySeidel/typst-dhbw-template/main/declaration-of-authorship.typ
typst
MIT License
#import "locale.typ": * #let declaration-of-authorship( authors, title, declaration-of-authorship-content, date, language, many-authors, at-university, city, date-format, ) = { v(2em) text(size: 20pt, weight: "bold", DECLARATION_OF_AUTHORSHIP_TITLE.at(language)) v(1em) if (declaration-of-authorship-content != none) { declaration-of-authorship-content } else { if (authors.len() == 1) { par(justify: true, DECLARATION_OF_AUTHORSHIP_SECTION_A_SINGLE) v(1em) align(center, text(weight: "bold", title)) v(1em) par(justify: true, DECLARATION_OF_AUTHORSHIP_SECTION_B_SINGLE) } else { par(justify: true, DECLARATION_OF_AUTHORSHIP_SECTION_A_PLURAL) v(1em) align(center, text(weight: "bold", title)) v(1em) par(justify: true, DECLARATION_OF_AUTHORSHIP_SECTION_B_PLURAL) } } let end-date = if (type(date) == datetime) { date } else { date.at(1) } v(2em) if (at-university) { text(city + [, ] + end-date.display(date-format)) } else { let authors-by-city = authors.map(author => author.company.city).dedup() text(authors-by-city.join(", ", last: AND.at(language)) + [ ] + end-date.display(date-format)) } v(1em) if (many-authors) { grid( columns: (1fr, 1fr), gutter: 20pt, ..authors.map(author => { v(3.5em) line(length: 80%) author.name }) ) } else { for author in authors { v(4em) line(length: 40%) author.name } } }
https://github.com/Vortezz/fiches-mp2i-physique
https://raw.githubusercontent.com/Vortezz/fiches-mp2i-physique/main/chapitre_3.typ
typst
#import "@preview/cetz:0.0.1" #set page(header: box(width: 100%, grid( columns: (100%), rows: (20pt, 8pt), align(right, text("CHAPITRE 3. BASES DE L'ÉLECTRICITÉ")), line(length: 100%), )), footer: box(width: 100%, grid( columns: (50%, 50%), rows: (8pt, 20pt), line(length: 100%), line(length: 100%), align(left, text("<NAME> - MP2I")), align(right, text("<NAME> - 2023/2024")), ))) #set heading(numbering: "I.1.a") #let titleBox(title) = align(center, block(below: 20pt, box(height: auto, fill: rgb("#eeeeee"), width: auto, inset: 40pt, text(title, size: 20pt, weight: "bold")))) #let proof(content) = text("Preuve", weight: "semibold", fill: rgb("#666666")) + h(1em) + text(content, size: 10pt, fill: rgb("#888888")) #titleBox("Bases de l'électricité") = Généralités == La charge électrique La *charge* est une qualité intrinsique d'une particule (comme la masse). Elle s'exprime en Coulomb (C) et est de dimension $I.T^(-1)$. La charge est une grandeur scalaire *algébrique* ($+$ ou $-$), une grandeur *algébrique* et est *conservatrice* (un système fermé est de charge fixe). La charge est portée par les électrons ($-e$) et les protons ($e$), avec $e = 1.6 * 10^(-19) C$ la *charge élémentaire*. == Le courant électrique Le *courant électrique* est un déplacement d'ensemble de charges. == Dipôle électrique, branche, maille, circuit Un *dipôle* possède 2 pôles, lui permettant d'être traversé par un courant électrique. Une association de dipôles forme un *circuit*. Une association de dipôles à la "_queue-leu-leu_" appelée *association série* forme une *branche*. Une association de dipôles qui boucle sur elle même est appelée une *maille*. == Intensité électrique L'*intensité électrique* est un débit de charge noté $I$. On a $I = frac(delta Q, d t)$ avec $delta Q$ la charge qui traverse la section pendant $Delta t$. Pour mesurer l'intensité on utilise un ampèremètre branché en _série_ avec le $+$ sur le _mA_ et le $-$ sur le _COM_. #figure( cetz.canvas(length: 1cm, debug: false, { import cetz.draw: line import "@local/circuitypst:0.0.1": node, to to("amperemeter", (-2,0), (2,0), label: "") }), caption: [Ampèremètre en série] ) On a la *loi des noeuds* car il n'y a pas d'accumulation dans les noeuds : $ sum_("entrant") I = sum_("sortant") I $ = La tension électrique == Retour sur l'analogie On a $U$ la *tension électrique* une _différence de potentiel_ en Volts (V) : $U_("AB") = V_A - V_B$ Pour mesurer une tension on utilise un voltmètre branché en _dérivation_ avec le $+$ sur le $ohm$ et le $-$ sur le _COM_. #figure( cetz.canvas(length: 1cm, debug: false, { import cetz.draw: line import "@local/circuitypst:0.0.1": node, to line((-2,0), (2,0)) line((-1,0), (-1,1)) line((1,0), (1,1)) to("voltmeter", (-1,1), (1,1), label: "") }), caption: [Voltmètre en dérivation] ) == Addivité des tensions et loi des mailles La tension est une grandeur additive, et on a la *loi des mailles* : $ sum_("tension \nmailles") epsilon_i U_i = 0 "avec" epsilon_i = cases( 1 "si" U_i "dans le sens de parcours", -1 "sinon" ) $ La _loi des mailles_ et la _loi des noeuds_ sont les lois de *Kirchhoff*. Elles sont valables en régime continu et en régime lentement variable (_ARQS_). = Approximation des régimes quasi stationnaires (_ARQS_) Pour dire qu'un système est *lentement variable* il faut que $tau >> frac(d,c)$, avec $tau$ le temps caractéristique d'évolution de la source, $d$ la taille du circuit et $c$ la vitesse de la lumière dans le vide. Si ce critère est vérifié, alors tous les points du circuit _voient_ en même temps tout changement du signal source. Puisque les générateurs de TP on un $tau >> 3 "ns"$, alors on est dans l'_ARQS_ en TP. = Résistors == Généralités Un *résistor* est un dipôle qui conduit plus ou moins bien l'électricité. On schématise un résistor de la manière suivante : #figure( cetz.canvas(length: 1cm, debug: false, { import cetz.draw: line import "@local/circuitypst:0.0.1": node, to to("R", (-2,0), (2,0), label: "R", i: $i$, v: $U_R$) }), caption: [Schéma d'un résistor] ) On a *loi d'Ohm* : $U = R I$ avec $R$ la résistance en Ohm ($Omega$), attention, en convention générateur on a $U = bold(-) R I$. Un résistor est un dipôle _passif_, en l'absence de _U_ pas de _I_ et un dipôle _linéaire_ car _U_ et _I_ sont linéairement liés. En pratique, un résistor est un morceau de matérieau doté d'une *conductivité électrique* notée $sigma$ en $S.m^(-1)$. On a la relation suivante : $R = frac(l, sigma S)$ ($l$ la longueur et $S$ la surface) On considère les résistances suivantes : - $R_("fil") = 0.1 Omega$ - $R_("voltmètre") = 10 M Omega$ (modélisé par un interrupteur ouvert) - $R_("ampèremètre") = 0.1 Omega$ (modélisé par un fil) On a aussi une tension nulle dans un fil. == Associations de résistors et pont diviseurs === Association série Dans le schéma suivant, on a $R = R_1 + R_2$ : #figure( cetz.canvas(length: 1cm, debug: false, { import cetz.draw: line, content import "@local/circuitypst:0.0.1": node, to to("R", (-2,0), (0,0), label: $R_1$, i: $i$, v: $U_1$) to("R", (0,0), (2,0), label: $R_2$, i: $i$, v: $U_2$, name: "R2") line((-1.5, -1.1), (1.5, -1.1), mark: (start: ">"), name: "tension") content((rel: (-1.5, -0.3)), $U$) content("R2", h(4em)+[équivalent à], anchor: "left") to("R", (5,0), (9,0), label: $R$, i: $i$, v: $U_R$) }), caption: [Association série de résistors] ) #proof("D'après la loi d'Ohm on a : " + $U_1 = R_1 i$ + " et " + $U_2 = R_2 i$ + " soit " + $U = U_1 + U_2 = R_1 i + R_2 i = (R_1 + R_2) i$ + " ainsi " + $R = R_1 + R_2$) === Pont diviseur On considère le schéma en figure 4, on a $U_1 = frac(R_1, R_1 + R_2) U$. #proof("On a " + $U_1 = R_1 i$ + " et " + $U = (R_1 + R_2) i$ + " soit " + $U_1 / U = (R_1 i)/((R_1 + R_2) i) = (R_1)/(R_1 + R_2)$) === Association en dérivation Dans le schéma suivant, on a $1/R_(\eq) = 1/R_1 + 1/R_2$ : #figure( cetz.canvas(length: 1cm, debug: false, { import cetz.draw: line, content import "@local/circuitypst:0.0.1": node, to to("R", (-2,1), (0,1), label: $R_1$, i: $i_1$, v: $U_1$) to("R", (-2,-1), (0,-1), label: $R_2$, i: $i_2$, v: $U_2$, name: "R2") line((-2,1), (-2,-1)) line((0,1), (0,-1)) line((0,0), (0.5,0), name: "equiv") line((-2,0), (-2.5,0)) node("currarrow", (-2.2, 0)) content((rel: (0, 0.3)), $i$) line((-2, -2.2), (0, -2.2), mark: (start: ">"), name: "tension") content((rel: (-1, -0.3)), $U$) content("equiv", h(4em)+[équivalent à], anchor: "left") to("R", (5,0), (9,0), label: $R_(\eq)$, i: $i$, v: $U$) }), caption: [Association en dérivation de résistors] ) #proof("D'après la loi des mailles on a " + $U_1 = U_2 = U$ + " et d'après la loi d'Ohm, " + $U = R_1 i = R_2 i$ + " soit d'après la loi des noeuds " + $i = i_1 + i_2 = (U)/(R_1) + (U)/(R_2) = U(1/R_1 + 1/R_2)$ + " ainsi " + $U = (1/(1/R_1 + 1/R_2)) I$) === Pont diviseur de courant On considère le schéma en figure 5, on a $i_1 = (R_2)/(R_1 + R_2) i$. === Puissance dissipée par un résistor On a $P = R I^2$ la puissance dissipée par effet Joule. #proof($P_("reçue") = U i = U_R i_R = R i_R i_R = R i_R^2$ + " (en convention récepteur)") = Masse La *masse* est le point d'un circuit de potentiel nul, $V = 0V$, c'est l'origine des potentiels. En théorie elle est choisie arbitrairement, en pratique elle est imposée par certains appareils électriques reliés à la Terre. On la schématise de la manière suivante : #figure( cetz.canvas(length: 1cm, debug: false, { import cetz.draw: line, content import "@local/circuitypst:0.0.1": node, to line((-2,0), (2,-0)) to("ground", (0, 0), ()) }), caption: [Schématisation d'une masse] ) = Générateur de tension == Générateur (source) de tension idéal Le *générateur de tension idéal* est un générateur qui impose une tension entre ses bornes, il est schématisé de la manière suivante avec $E$ sa *force électromotrice* ou f.e.m. #figure( cetz.canvas(length: 1cm, debug: false, { import cetz.draw: line, content import "@local/circuitypst:0.0.1": node, to to("idealTension", (-2, 0), (2,0), name: "idealTension", i: $i$) }), caption: [Schématisation d'un générateur de tension idéal] ) $U$ est ainsi indépendante de $I$, c'est un dipôle _actif_ car $U != 0V$ même si $I = 0A$. == Générateur de tension réel On a le *générateur de Thévenin* schématisé de la manière suivante avec un générateur idéal et une résistance interne : #figure( cetz.canvas(length: 1cm, debug: false, { import cetz.draw: line, content import "@local/circuitypst:0.0.1": node, to to("idealTension", (-2, 0), (0,0), name: "idealTension", i: $i$) to("R", (0, 0), (2,0), name: "idealTension", v: $U_R$, convention: 1, label: $R_i$) line((-1, -1.5), (1, -1.5), mark: (end: ">"), name: "tension") content((rel: (-1, -0.3)), $U$) }), caption: [Schématisation d'un générateur de Thévenin] ) On a $U = U_R + E = E - R i$ (convention générateur). - À $I = 0A$, le générateur ne _débite_ pas, sa *tension à vide* est sa f.e.m. - Sinon il _débite_ $U < E$, et il apparaît une chute de tension à ses bornes On a $P_("fournie") = U I = (E - R_i i) i = E i - R_i i^2$ = Générateur de courant (HP) On a le *générateur de courant idéal* schématisé ci dessous : #figure( cetz.canvas(length: 1cm, debug: false, { import cetz.draw: line, content import "@local/circuitypst:0.0.1": node, to to("idealCurrent", (-2, 0), (2,0), name: "idealTension", i: $i$) }), caption: [Schématisation d'un générateur de courant idéal] ) Le *générateur de Norton* est un modèle de générateur de courant réel schématisé ci dessous : #figure( cetz.canvas(length: 1cm, debug: false, { import cetz.draw: line, content import "@local/circuitypst:0.0.1": node, to to("R", (-2, 0.75), (2,0.75), name: "idealTension", i: $i_0$, label: $R_n$) to("idealCurrent", (-2, -0.75), (2,-0.75), name: "idealTension", i: $i_1$) line((-2,0.75), (-2,-0.75)) line((2,0.75), (2,-0.75)) line((-2,0), (-2.5,0), name: "equiv") line((2,0), (2.5,0)) node("currarrow", (-2.2, 0)) content((rel: (0, 0.3)), $i$) }), caption: [Schématisation d'un générateur de Norton] ) On a $U = - R_n (i - i_0) = R_n i_0 - R_n i$ soit $U = C_("te") - R_n i$ On a le résultat HP de l'équivalence Thévenin/Norton si $cases( R_n = R_i, R_n I = E)$
https://github.com/teamdailypractice/pdf-tools
https://raw.githubusercontent.com/teamdailypractice/pdf-tools/main/typst-pdf/examples/example-06.typ
typst
#image("images/Glacier-640px.jpg")
https://github.com/Myriad-Dreamin/tinymist
https://raw.githubusercontent.com/Myriad-Dreamin/tinymist/main/editors/vscode/e2e-workspaces/print-state/main.typ
typst
Apache License 2.0
#import "effect.typ": * #show: main #println("Hello World!") #println("Hello World! Again...")
https://github.com/Error0229/-
https://raw.githubusercontent.com/Error0229/-/main/-.-.%20.-/🕛.typ
typst
The Unlicense
#set text(font: "New Computer Modern") #align(center, text(16pt)[ *Design and Analysis of Computer Algorithms Sample midterm* ]) #set enum(numbering: "1. 1") + \ + $T(n) &= T(n-1) + 1/n\ &= T(n-2) + 1/(n-1) + 1/n\ &= sum_(i = 3)^n 1/i + d\ &= O(log n) "by harmonic series"\ $ + $T(n) &= 2 T(n/2) + n / (log n)\ &= 2^k + n/(lg n) + 2 (n/2)/(lg (n/2)) + 4 (n/4)/(lg (n/4)) + ... + 2^(k-1) (n / 2^(k-1))/(lg n/2^(k-1))\ &= n + n sum^(k-1)_(i=0) 1/(lg n - i)\ &<= n + n sum^(k-1)_(i=0) 1/(lg n - k + 1) = n + n lg n = O(n lg n) $ + $T(n) &= 4 T(n/2) + n^2 sqrt(n)\ &= n^2 sqrt(n) $ + $T(n) &= 4 T(n/2) + n^2\ &= n^2 lg n $ + $T(n) &= 2 T(n/4) + sqrt(n)\ &= sqrt(n) lg n $ + \ + True + False + True + False + True + False + True + False + \ + False, we can't obtain the solution from B back to A + True + False, the the new lower bound is $O(n)$ + False, the lower bound is unknown + \ $T(n) = cases(T(n/2) + T(n/4) + T(n/8) + 2n & "if" n > 1, 1 & "if" n = 1)$ +
https://github.com/Myriad-Dreamin/typst.ts
https://raw.githubusercontent.com/Myriad-Dreamin/typst.ts/main/fuzzers/corpora/math/delimited_09.typ
typst
Apache License 2.0
#import "/contrib/templates/std-tests/preset.typ": * #show: test-page // Test middle functions $ { x mid(|) sum_(i=1)^oo phi_i (x) < 1 } \ { integral |x| dif x mid(bar.v.double) floor(hat(A) mid(|) { x mid(|) y } mid(|) A) } $
https://github.com/Otto-AA/definitely-not-tuw-thesis
https://raw.githubusercontent.com/Otto-AA/definitely-not-tuw-thesis/main/src/thesis.typ
typst
MIT No Attribution
#import "translations/translations.typ": init_translations #import "frontpage.typ": frontpage #import "statement.typ": statement #let thesis( lang: "en", title: (:), subtitle: (:), thesis-type: (en: "Diploma Thesis", de: "Diplomarbeit"), academic-title: (en: "Diplom-Ingenieur", de: "Diplom-Ingenieur"), curriculum: none, author: (:), advisor: (:), assistants: (), reviewers: (), keywords: (), date: datetime.today(), font: "DejaVu Sans", doc, ) = { assert(lang in ("en", "de")) set text(lang: lang) let show-curriculum = curriculum != none let main-language-title = title.at("de", default: "") if lang == "en" { main-language-title = title.at("en", default: "") } set document( title: main-language-title, author: author.at("name", default: none), keywords: keywords, date: date, ) let additional-translations = ( title: title, subtitle: subtitle, academic-title: academic-title, thesis-type: thesis-type, curriculum: curriculum, ) init_translations(additional-translations) let filled-frontpage = frontpage.with(font, author, advisor, assistants, reviewers, show-curriculum, date) text(lang: "de")[ #filled-frontpage() #pagebreak() #pagebreak() ] text(lang: "en")[ #filled-frontpage() #pagebreak() ] statement(author, date) doc } // export styles #import "styles/all.typ": *
https://github.com/typst-community/valkyrie
https://raw.githubusercontent.com/typst-community/valkyrie/main/src/types/array.typ
typst
Other
#import "../base-type.typ": base-type #import "../assertions-util.typ": assert-base-type, assert-positive-type #import "../ctx.typ": z-ctx #let array-type = type(()) #let array( name: "array", assertions: (), min: none, max: none, ..args, ) = { let descendents-schema = args.pos().at(0, default: base-type(name: "any")) assert-base-type(descendents-schema, scope: ("arguments",)) assert-positive-type(min, types: (int,), name: "Minimum length") assert-positive-type(max, types: (int,), name: "Maximum length") base-type( name: name, description: name + "[" + (descendents-schema.description) + "]", default: (), types: (array-type,), ..args.named(), ) + ( min: min, max: max, assertions: ( ( precondition: "min", condition: (self, it) => it.len() >= self.min, message: (self, it) => "Length must be at least " + str(self.min), ), ( precondition: "max", condition: (self, it) => it.len() <= self.max, message: (self, it) => "Length must be at most " + str(self.max), ), ..assertions, ), descendents-schema: descendents-schema, handle-descendents: (self, it, ctx: z-ctx(), scope: ()) => { for (key, value) in it.enumerate() { it.at(key) = (descendents-schema.validate)( descendents-schema, value, ctx: ctx, scope: (..scope, str(key)), ) } it }, ) }
https://github.com/typst-community/mantodea
https://raw.githubusercontent.com/typst-community/mantodea/main/template/main.typ
typst
MIT License
#import "@preview/mantodea:0.1.0": mantodea #show: mantodea( title: [Title], subtitle: [Subtitle], authors: "<NAME> <<EMAIL>>", date: datetime.today(), version: version(0, 1, 0), abstract: lorem(100), license: "MIT", )
https://github.com/MikoBie/typst_template
https://raw.githubusercontent.com/MikoBie/typst_template/main/main.typ
typst
// Import theme from the file. #import "themes/iss.typ": * // Define main colors of the theme. #let mainColor = rgb(42,60,102) #let enumColor = rgb(42,102,45) #let alertColor = rgb(102,42,66) #let otherColor = rgb(102,84,42) // Option of the theme. #show: iss-theme.with( left-footer: [Biesaga], short-title: lorem(5), color: mainColor, ) // Global settings. #set text(font: "New Computer Modern", weight: "semibold", size: 20pt, hyphenate: false) #set strong(delta: 100) #set par(justify: true) #set enum(numbering: n => block(fill: enumColor, radius: 2pt, inset: .1em)[#text(fill: white, [#n.])]) #show highlight: set highlight(fill: alertColor) #show highlight: it => [ #set text(fill: white) #it ] // Title slide. #title-slide( authors: ([<NAME>]), title: lorem(8), subtitle: lorem(10), date: datetime.today().display("[day] [month repr:long] [year]"), funding: [#lorem(20)], secondlogo: none ) // Regular slide. #slide(title: lorem(5))[ #lorem(20) + #lorem(10) + #lorem(10) + #highlight[#lorem(10)] ]
https://github.com/RanolP/resume
https://raw.githubusercontent.com/RanolP/resume/main/modules/components.typ
typst
#let base-icon(url, size: 1em, width: none, height: none, bottom: -1em / 8) = { box[ #pad(bottom: bottom)[ #image( url, format: "svg", width: if width == none { size } else { width }, height: if height == none { size } else { height }, ) ] ] } #let icon(query, size: 1em, width: none, height: none, bottom: -1em / 8) = { [#metadata(query) <icon>] let icon-db = json("../assets/.automatic/icon/manifest.json") if icon-db.at(query, default: none) != none { base-icon( "../assets/.automatic/icon/" + icon-db.at(query), size: size, width: width, height: height, bottom: bottom, ) } else { text(fill: color.rgb("#ff0000"))[\#NO\_ICON: "#query"\#] } } #let icon-solved-ac(size: 1em, bottom: -1em / 4) = { base-icon("../assets/brand/solved-ac.svg", size: size, bottom: bottom) } #let chip( body, background: color.rgb("#d2d2d2"), foreground: color.rgb("#121212"), ) = [ #box[ #pad(bottom: -3pt)[ #rect( radius: 50%, fill: background, inset: (left: 5pt, top: 3pt, bottom: 3pt, right: 5pt), )[ #set text(fill: foreground) #body ] ] ] ] #let tech-list = ( rust: ( icon: "devicon/rust", icon-dark: "devicon-plain/rust?color=#ffffff", label: "Rust", ), wasm: (icon: "devicon/wasm", label: "WebAssembly"), typescript: (icon: "devicon/typescript", label: "TypeScript"), typescript--short: (icon: "devicon/typescript", label: "TS"), javascript: (icon: "devicon/javascript", label: "JavaScript"), javascript--short: (icon: "devicon/javascript", label: "JS"), react-and-react-native: (icon: "devicon/react", label: [React $and$ React Native]), css: (icon: "devicon/css3", label: "CSS"), nextjs: (icon: "skill-icons/nextjs-light", label: "Next.js"), solidjs: (icon: "devicon/solidjs", label: "Solid.js"), tailwindcss: (icon: "devicon/tailwindcss", label: "Tailwind CSS"), unocss: (icon: "vscode-icons/file-type-unocss", label: "UnoCSS"), eslint: (icon: "devicon/eslint", label: "ESLint"), playwright: (icon: "devicon/playwright", label: "Playwright"), openapi: (icon: "devicon/openapi", label: "OpenAPI"), vite: (icon: "devicon/vitejs", label: "Vite"), webpack: (icon: "devicon/webpack", label: "Webpack"), mysql: (icon: "devicon/mysql", label: "MySQL"), kotlin: (icon: "devicon/kotlin", label: "Kotlin"), swift: (icon: "devicon/swift", label: "Swift"), bash: ( icon: "simple-icons/gnubash", icon-dark: "simple-icons/gnubash?color=#ffffff", label: "Bash", ), gradle: ( icon: "simple-icons/gradle", icon-dark: "simple-icons/gradle?color=#ffffff", label: "Gradle", ), git: (icon: "devicon/git", label: "Git"), github: ( icon: "skill-icons/github-light", icon-dark: "skill-icons/github-dark", label: "GitHub", ), github-actions: (icon: "devicon/githubactions", label: "GitHub Actions"), ) #let tech-chips = for (k, v) in tech-list { ( (k): chip[ #set text(size: 8pt, weight: 600) #icon(v.icon) #v.label ], ) }
https://github.com/typst-jp/typst-jp.github.io
https://raw.githubusercontent.com/typst-jp/typst-jp.github.io/main/docs/changelog/earlier.md
markdown
Apache License 2.0
--- title: Earlier description: Changes in early, unversioned Typst --- # Changes in early, unversioned Typst ## March 28, 2023 - **Breaking changes:** - Enumerations now require a space after their marker, that is, `[1.ok]` must now be written as `[1. ok]` - Changed default style for [term lists]($terms): Does not include a colon anymore and has a bit more indent - Command line interface - Added `--font-path` argument for CLI - Embedded default fonts in CLI binary - Fixed build of CLI if `git` is not installed - Miscellaneous improvements - Added support for disabling [matrix]($math.mat) and [vector]($math.vec) delimiters. Generally with `[#set math.mat(delim: none)]` or one-off with `[$mat(delim: #none, 1, 2; 3, 4)$]`. - Added [`separator`]($terms.separator) argument to term lists - Added [`round`]($math.round) function for equations - Numberings now allow zeros. To reset a counter, you can write `[#counter(..).update(0)]` - Added documentation for `{page()}` and `{position()}` methods on [`location`] type - Added symbols for double, triple, and quadruple dot accent - Added smart quotes for Norwegian Bokmål - Added Nix flake - Fixed bibliography ordering in IEEE style - Fixed parsing of decimals in math: `[$1.2/3.4$]` - Fixed parsing of unbalanced delimiters in fractions: `[$1/(2 (x)$]` - Fixed unexpected parsing of numbers as enumerations, e.g. in `[1.2]` - Fixed combination of page fill and header - Fixed compiler crash if [`repeat`] is used in page with automatic width - Fixed [matrices]($math.mat) with explicit delimiter - Fixed [`indent`]($terms.indent) property of term lists - Numerous documentation fixes - Links in bibliographies are now affected by link styling - Fixed hovering over comments in web app <contributors from="v23-03-21" to="v23-03-28" /> ## March 21, 2023 - Reference and bibliography management - [Bibliographies]($bibliography) and [citations]($cite) (currently supported styles are APA, Chicago Author Date, IEEE, and MLA) - You can now [reference]($ref) sections, figures, formulas, and works from the bibliography with `[@label]` - You can make an element referenceable with a label: - `[= Introduction <intro>]` - `[$ A = pi r^2 $ <area>]` - Introspection system for interactions between different parts of the document - [`counter`] function - Access and modify counters for pages, headings, figures, and equations - Define and use your own custom counters - Time travel: Find out what the counter value was or will be at some other point in the document (e.g. when you're building a list of figures, you can determine the value of the figure counter at any given figure). - Counters count in layout order and not in code order - [`state`] function - Manage arbitrary state across your document - Time travel: Find out the value of your state at any position in the document - State is modified in layout order and not in code order - [`query`] function - Find all occurrences of an element or a label, either in the whole document or before/after some location - Link to elements, find out their position on the pages and access their fields - Example use cases: Custom list of figures or page header with current chapter title - [`locate`] function - Determines the location of itself in the final layout - Can be accessed to get the `page` and `x`, `y` coordinates - Can be used with counters and state to find out their values at that location - Can be used with queries to find elements before or after its location - New [`measure`] function - Measure the layouted size of elements - To be used in combination with the new [`style`] function that lets you generate different content based on the style context something is inserted into (because that affects the measured size of content) - Exposed content representation - Content is not opaque anymore - Content can be compared for equality - The tree of content elements can be traversed with code - Can be observed in hover tooltips or with [`repr`] - New [methods]($content) on content: `func`, `has`, `at`, and `location` - All optional fields on elements are now settable - More uniform field names (`heading.title` becomes `heading.body`, `list.items` becomes `list.children`, and a few more changes) - Further improvements - Added [`figure`] function - Added [`numbering`]($math.equation.numbering) parameter on equation function - Added [`numbering`]($page.numbering) and [`number-align`]($page.number-align) parameters on page function - The page function's [`header`]($page.header) and [`footer`]($page.footer) parameters do not take functions anymore. If you want to customize them based on the page number, use the new [`numbering`]($page.numbering) parameter or [`counter`] function instead. - Added [`footer-descent`]($page.footer-descent) and [`header-ascent`]($page.header-ascent) parameters - Better default alignment in header and footer - Fixed Arabic vowel placement - Fixed PDF font embedding issues - Renamed `math.formula` to [`math.equation`]($math.equation) - Font family must be a named argument now: `[#set text(font: "..")]` - Added support for [hanging indent]($par.hanging-indent) - Renamed paragraph `indent` to [`first-line-indent`]($par.first-line-indent) - More accurate [logarithm]($calc.log) when base is `2` or `10` - Improved some error messages - Fixed layout of [`terms`] list - Web app improvements - Added template gallery - Added buttons to insert headings, equations, raw blocks, and references - Jump to the source of something by clicking on it in the preview panel (works for text, equations, images, and more) - You can now upload your own fonts and use them in your project - Hover debugging and autocompletion now takes multiple files into account and works in show rules - Hover tooltips now automatically collapse multiple consecutive equal values - The preview now automatically scrolls to the right place when you type - Links are now clickable in the preview area - Toolbar, preview, and editor can now all be hidden - Added autocompletion for raw block language tags - Added autocompletion in SVG files - New back button instead of four-dots button - Lots of bug fixes ## February 25, 2023 - Font changes - New default font: Linux Libertine - New default font for raw blocks: DejaVu Sans Mono - New default font for math: Book weight of New Computer Modern Math - Lots of new math fonts available - Removed Latin Modern fonts in favor of New Computer Modern family - Removed unnecessary smallcaps fonts which are already accessible through the corresponding main font and the [`smallcaps`] function - Improved default spacing for headings - Added [`panic`] function - Added [`clusters`]($str.clusters) and [`codepoints`]($str.codepoints) methods for strings - Support for multiple authors in [`set document`]($document.author) - Fixed crash when string is accessed at a position that is not a char boundary - Fixed semicolon parsing in `[#var ;]` - Fixed incremental parsing when inserting backslash at end of `[#"abc"]` - Fixed names of a few font families (including Noto Sans Symbols and New Computer Modern families) - Fixed autocompletion for font families - Improved incremental compilation for user-defined functions ## February 15, 2023 - [Box]($box) and [block] have gained `fill`, `stroke`, `radius`, and `inset` properties - Blocks may now be explicitly sized, fixed-height blocks can still break across pages - Blocks can now be configured to be [`breakable`]($block.breakable) or not - [Numbering style]($enum.numbering) can now be configured for nested enums - [Markers]($list.marker) can now be configured for nested lists - The [`eval`] function now expects code instead of markup and returns an arbitrary value. Markup can still be evaluated by surrounding the string with brackets. - PDFs generated by Typst now contain XMP metadata - Link boxes are now disabled in PDF output - Tables don't produce small empty cells before a pagebreak anymore - Fixed raw block highlighting bug ## February 12, 2023 - Shapes, images, and transformations (move/rotate/scale/repeat) are now block-level. To integrate them into a paragraph, use a [`box`] as with other elements. - A colon is now required in an "everything" show rule: Write `{show: it => ..}` instead of `{show it => ..}`. This prevents intermediate states that ruin your whole document. - Non-math content like a shape or table in a math formula is now centered vertically - Support for widow and orphan prevention within containers - Support for [RTL]($text.dir) in lists, grids, and tables - Support for explicit `{auto}` sizing for boxes and shapes - Support for fractional (i.e. `{1fr}`) widths for boxes - Fixed bug where columns jump to next page - Fixed bug where list items have no leading - Fixed relative sizing in lists, squares and grid auto columns - Fixed relative displacement in [`place`] function - Fixed that lines don't have a size - Fixed bug where `{set document(..)}` complains about being after content - Fixed parsing of `{not in}` operation - Fixed hover tooltips in math - Fixed bug where a heading show rule may not contain a pagebreak when an outline is present - Added [`baseline`]($box.baseline) property on [`box`] - Added [`tg`]($math.op) and [`ctg`]($math.op) operators in math - Added delimiter setting for [`cases`]($math.cases) function - Parentheses are now included when accepting a function autocompletion ## February 2, 2023 - Merged text and math symbols, renamed a few symbols (including `infty` to `infinity` with the alias `oo`) - Fixed missing italic mappings - Math italics correction is now applied properly - Parentheses now scale in `[$zeta(x/2)$]` - Fixed placement of large root index - Fixed spacing in `[$abs(-x)$]` - Fixed inconsistency between text and identifiers in math - Accents are now ignored when positioning superscripts - Fixed vertical alignment in matrices - Fixed `text` set rule in `raw` show rule - Heading and list markers now parse consistently - Allow arbitrary math directly in content ## January 30, 2023 [Go to the announcement blog post.](https://typst.app/blog/2023/january-update) - New expression syntax in markup/math - Blocks cannot be directly embedded in markup anymore - Like other expressions, they now require a leading hash - More expressions available with hash, including literals (`[#"string"]`) as well as field access and method call without space: `[#emoji.face]` - New import syntax - `[#import "module.typ"]` creates binding named `module` - `[#import "module.typ": a, b]` or `[#import "module.typ": *]` to import items - `[#import emoji: face, turtle]` to import from already bound module - New symbol handling - Removed symbol notation - Symbols are now in modules: `{sym}`, `{emoji}`, and `{math}` - Math module also reexports all of `{sym}` - Modified through field access, still order-independent - Unknown modifiers are not allowed anymore - Support for custom symbol definitions with `symbol` function - Symbols now listed in documentation - New `{math}` module - Contains all math-related functions - Variables and function calls directly in math (without hash) access this module instead of the global scope, but can also access local variables - Can be explicitly used in code, e.g. `[#set math.vec(delim: "[")]` - Delimiter matching in math - Any opening delimiters matches any closing one - When matched, they automatically scale - To prevent scaling, escape them - To forcibly match two delimiters, use `lr` function - Line breaks may occur between matched delimiters - Delimiters may also be unbalanced - You can also use the `lr` function to scale the brackets (or just one bracket) to a specific size manually - Multi-line math with alignment - The `\` character inserts a line break - The `&` character defines an alignment point - Alignment points also work for underbraces, vectors, cases, and matrices - Multiple alignment points are supported - More capable math function calls - Function calls directly in math can now take code expressions with hash - They can now also take named arguments - Within math function calls, semicolons turn preceding arguments to arrays to support matrices: `[$mat(1, 2; 3, 4)$]` - Arbitrary content in math - Text, images, and other arbitrary content can now be embedded in math - Math now also supports font fallback to support e.g. CJK and emoji - More math features - New text operators: `op` function, `lim`, `max`, etc. - New matrix function: `mat` - New n-ary roots with `root` function: `[$root(3, x)$]` - New under- and overbraces, -brackets, and -lines - New `abs` and `norm` functions - New shorthands: `[|`, `|]`, and `||` - New `attach` function, overridable attachments with `script` and `limit` - Manual spacing in math, with `h`, `thin`, `med`, `thick` and `quad` - Symbols and other content may now be used like a function, e.g. `[$zeta(x)$]` - Added Fira Math font, removed Noto Sans Math font - Support for alternative math fonts through `[#show math.formula: set text("Fira Math")]` - More library improvements - New `calc` module, `abs`, `min`, `max`, `even`, `odd` and `mod` moved there - New `message` argument on `{assert}` function - The `pairs` method on dictionaries now returns an array of length-2 arrays instead of taking a closure - The method call `{dict.at("key")}` now always fails if `"key"` doesn't exist Previously, it was allowed in assignments. Alternatives are `{dict.key = x}` and `{dict.insert("key", x)}`. - Smarter editor functionality - Autocompletion for local variables - Autocompletion for methods available on a value - Autocompletion for symbols and modules - Autocompletion for imports - Hover over an identifier to see its value(s) - Further editor improvements - New Font menu with previews - Single projects may now be shared with share links - New dashboard experience if projects are shared with you - Keyboard Shortcuts are now listed in the menus and there are more of them - New Offline indicator - Tooltips for all buttons - Improved account protection - Moved Status indicator into the error list button - Further fixes - Multiple bug fixes for incremental parser - Fixed closure parameter capturing - Fixed tons of math bugs - Bugfixes for performance, file management, editing reliability - Added redirection to the page originally navigated to after signin
https://github.com/Myriad-Dreamin/typst.ts
https://raw.githubusercontent.com/Myriad-Dreamin/typst.ts/main/fuzzers/corpora/math/multiline_02.typ
typst
Apache License 2.0
#import "/contrib/templates/std-tests/preset.typ": * #show: test-page // Test space between inner alignment points. $ a + b &= 2 + 3 &= 5 \ b &= c &= 3 $
https://github.com/qujihan/typst-book-template
https://raw.githubusercontent.com/qujihan/typst-book-template/main/template/parts/lib.typ
typst
#import "cover.typ": show-cover #import "outline.typ": show-outline #import "figure/lib.typ": code, pic, tbl, figure-root-path
https://github.com/i-am-wololo/cours
https://raw.githubusercontent.com/i-am-wololo/cours/master/main/main.typ
typst
#set page( header: "Fiches de revisions 2nd semestre", numbering: "1/1" ) #include "./cheatsheet.typ" #pagebreak() #include "./cheatsheeti22.typ" #pagebreak() #include "./cheatsheeti21.typ"
https://github.com/typst/packages
https://raw.githubusercontent.com/typst/packages/main/packages/preview/quill/0.1.0/README.md
markdown
Apache License 2.0
<h1 align="center"> <img alt="Quantum Circuit" src="https://github.com/Mc-Zen/packages/assets/52877387/5d34c646-79a8-492b-8e49-9136d5881258" style="max-width: 100%; width: 300pt; padding: 10px 20px; box-shadow: 1pt 1pt 10pt 0pt #AAAAAA; border-radius: 4pt; box-sizing: border-box; background: white"> </h1> **Quill** is a package for creating quantum circuit diagrams in [Typst](https://typst.app/). _Note, that this package is in beta and may still be undergoing breaking changes. As new features like data types and scoped functions will be added to Typst, this package will be adapted to profit from the new paradigms._ _Meanwhile, we suggest importing everything from the package in a local scope to avoid polluting the global namespace (see example below)._ ## Usage Create circuit diagrams by calling the function `quantum-circuit()` with any number of positional arguments — just like the built-in Typst functions `table()` or `grid()`. A variety of different gate and instruction commands are available and plain numbers can be used to produce any number of empty cells just filled with the current wire mode. A new wire is started by adding the content item `[\ ]`. ```java #{ import "@preview/quill:0.1.0": * quantum-circuit( lstick($|0〉$), gate($H$), ctrl(1), rstick($(|00〉+|11〉)/√2$, n: 2), [\ ], lstick($|0〉$), 1, targ(), 1 ) } ``` <h3 align="center"> <img alt="Bell circuit" src="https://github.com/Mc-Zen/packages/assets/52877387/0132e357-abeb-42b2-8b27-073e3d8b8063" style="max-width: 100%; padding: 10px 10px; box-shadow: 1pt 1pt 10pt 0pt #AAAAAA; border-radius: 4pt; background: white; box-sizing: border-box"> </h3> Refer to the [user guide](https://github.com/Mc-Zen/quill/releases/download/v0.1.0/quill-guide.pdf) for full documentation. ## Gallery <h3 align="center"> <img alt="Gallery" src="https://github.com/Mc-Zen/packages/assets/52877387/fb9d887d-fab2-48dd-b5cb-02e120b76f30" style="background: white; padding: 10pt; box-sizing: border-box" /> </h3> ## Examples Some show-off examples, loosely replicating figures from [Quantum Computation and Quantum Information by <NAME> and <NAME>](https://www.cambridge.org/highereducation/books/quantum-computation-and-quantum-information/01E10196D0A682A6AEFFEA52D53BE9AE#overview). <h3 align="center"> <img alt="Quantum teleportation circuit" src="https://github.com/Mc-Zen/packages/assets/52877387/c923c68a-63b2-4377-a362-dfa06ffe66f4" style="max-width: 100%; padding: 10px 10px; box-shadow: 1pt 1pt 10pt 0pt #AAAAAA; border-radius: 4pt; background: white; box-sizing: border-box"> </h3> <h3 align="center"> <img alt="Quantum circuit for phase estimation" src="https://github.com/Mc-Zen/packages/assets/52877387/a875ac6f-9735-4136-96c0-99447a50695a" style="max-width: 100%; padding: 10px 10px; box-shadow: 1pt 1pt 10pt 0pt #AAAAAA; border-radius: 4pt; background: white; box-sizing: border-box"> </h3> <h3 align="center"> <img alt="Quantum fourier transformation circuit" src="https://github.com/Mc-Zen/packages/assets/52877387/a30ef089-e120-42bd-a698-dd6727d67e3c" style="max-width: 100%; padding: 10px 10px; box-shadow: 1pt 1pt 10pt 0pt #AAAAAA; border-radius: 4pt; background: white; box-sizing: border-box"> </h3>
https://github.com/ngyngcphu/tick3d-docs
https://raw.githubusercontent.com/ngyngcphu/tick3d-docs/main/contents/03_luoc_do_use_case/index.typ
typst
Apache License 2.0
= Use-case diagram and use-case scenario #figure(caption: [Use-case tổng quát toàn bộ hệ thống], image("../images/usecase/DACNPM-WholeSystem.png") ) #pagebreak() == Module mua sắm mô hình 3D (Shopping) #figure(caption: [Module mua sắm mô hình 3D], image("../images/usecase/DACNPM-MakeOrder.png") ) #table( columns: (auto, auto), inset: 10pt, align: horizon, [*Use Case Name*], [*Tìm Kiếm Mô hình 3D*], [Actors], [Khách hàng.], [Brief Description], [Khách hàng sử dụng chức năng này để tìm kiếm mô hình 3D, hỗ trợ lọc và sắp xếp dựa trên các tiêu chí khác nhau.], [Preconditions], [Khách hàng truy cập trang web và điều hướng tới trang sản phẩm.], [Postconditions], [Kết quả tìm kiếm được hiển thị dựa trên các tiêu chí lọc và sắp xếp.], [Normal Flow], [ 1. Khách hàng truy cập trang web và điều hướng đến trang sản phẩm. 2. Hệ thống hiển thị danh sách các mô hình 3D và cung cấp một thanh tìm kiếm và các tùy chọn lọc và sắp xếp. 3. Khách hàng nhập từ khóa cần tìm kiếm vào thanh tìm kiếm. 4. Khách hàng chọn các tiêu chí lọc (ví dụ: phân loại, giá tiền) để giới hạn danh sách mô hình. 5. Khách hàng chọn tiêu chí sắp xếp (ví dụ: theo tên mô hình hoặc giá tiền) để sắp xếp danh sách. 6. Hệ thống thực hiện tìm kiếm dựa trên từ khóa và tiêu chí lọc và sắp xếp. 7. Hệ thống hiển thị danh sách mô hình dựa trên kết quả tìm kiếm, lọc và sắp xếp. ], [Alternative Flow], [ 3a. Khách hàng có thể chọn nhiều tiêu chí lọc để kết hợp nhiều điều kiện lọc.\ 5a. Nếu không có kết quả nào phù hợp với tiêu chí lọc, hệ thống thông báo cho khách hàng rằng không tìm thấy kết quả. ], [Exception Flow], [ 2a. Nếu không có mô hình nào trong hệ thống hoặc có lỗi trong việc lấy danh sách mô hình, hệ thống thông báo cho khách hàng và không hiển thị danh sách. ], ) #figure(caption: [Use-case tìm kiếm mô hình 3D], table())\ #table( columns: (auto, auto), inset: 10pt, align: horizon, [*Use Case Name*], [*Xem Thông Tin Mô hình*], [Actors], [Khách hàng.], [Brief Description], [Khách hàng sử dụng chức năng này để xem thông tin chi tiết của một mô hình 3D trong hệ thống.], [Preconditions], [Khách hàng đã truy cập trang web và có quyền truy cập đối với mô hình 3D cần xem.], [Postconditions], [Thông tin chi tiết của mô hình 3D được hiển thị cho khách hàng.], [Normal Flow], [ 1. Khách hàng truy cập trang web và điều hướng đến trang sản phẩm. 2. Hệ thống hiển thị danh sách các mô hình 3D. 3. Khách hàng chọn một mô hình từ danh sách để xem thông tin chi tiết. 4. Hệ thống hiển thị thông tin chi tiết của mô hình, bao gồm tên, mô tả, giá tiền, hình ảnh, và thông tin khác. ], [Alternative Flow], [ 4a1. Trong quá trình xem thông tin mô hình, khách hàng có thể chọn "Like" mô hình.\ 4a2. Hệ thống ghi nhận lượt "Like" cho sản phẩm và thêm mô hình vào danh sách mô hình đã "Like" của khách hàng.\ \ 4b1. Trong quá trình xem thông tin mô hình, khách hàng có thể chọn "Thêm vào Giỏ Hàng".\ 4b2. Hệ thống ghi nhận lựa chọn của khách hàng và thêm mô hình vào giỏ hàng của khách hàng. ], [Exception Flow], [ 3a. Nếu mô hình không tồn tại hoặc có lỗi trong việc lấy thông tin mô hình, hệ thống thông báo cho khách hàng rằng không thể xem thông tin mô hình. ], ) #figure(caption: [Use-case xem thông tin mô hình 3D], table())\ #table( columns: (auto, auto), inset: 10pt, align: horizon, [*Use Case Name*], [*Tải mô hình 3D*], [Actors], [Khách hàng.], [Brief Description], [Khách hàng sử dụng chức năng này để upload lên file .gcode của riêng mình.], [Preconditions], [Khách hàng đã truy cập thành công vào trang web và điều hướng tới giao diện Upload.], [Postconditions], [Khách hàng upload thành công file .gcode lên hệ thống và thêm các file này vào giỏ hàng.], [Normal Flow], [ 1. Bên cạnh biểu tượng người dùng trên thanh điều hướng, hệ thống sẽ cung cấp thêm một nút *Upload*.\ 2. Khách hàng nhấn nút *Upload* để upload file .gcode lên hệ thống.\ 3. Hệ thống hiển thị lên màn hình một khung giao diện dùng để upload file .gcode.\ 4. Khách hàng chọn file .gcode từ thiết bị của mình và nhấn nút *Upload* để upload file .gcode lên hệ thống.\ 5. Khách hàng ấn nút *Xác nhận* để upload file .gcode lên hệ thống.\ 6. Hệ thống sẽ lưu thông tin file .gcode của khách hàng và hiển thị ra màn hình như những mô hình có sẵn.\ 7. Mỗi mô hình 3D sẽ có nút *Thêm vào giỏ hàng* để khách hàng thêm mô hình 3D vào giỏ hàng.\ 8. Khi được thêm vào giỏ hàng, mô hình 3D sẽ được hiển thị trong giỏ hàng.\ ], [Alternative Flow], [ 2a. Khách hàng có thể nhấn nút *Hủy* để quay về trang chủ.\ 4a. Khách hàng có thể kéo thả file .gcode vào khung giao diện để upload file .gcode lên hệ thống. \ 5a. Khách hàng có thể tiếp tục ấn nút *Upload* để upload file .gcode khác lên hệ thống thay vì nút *Xác nhận*. ], [Exception Flow],[ 5a. Nếu file không có định dạng là .gcode, hệ thống sẽ hiển thị thông báo *File không hợp lệ*. ], ) #figure(caption: [Use-case tải mô hình 3D], table())\ #table( columns: (auto, auto), inset: 10pt, align: horizon, [*Use Case Name*], [*Xem Chi Tiết Giỏ Hàng*], [Actors], [Khách hàng.], [Brief Description], [Khách hàng sử dụng chức năng này để xem chi tiết giỏ hàng của họ, bao gồm danh sách các mô hình đã chọn và thông tin chi tiết của từng mô hình.], [Preconditions], [Khách hàng đã truy cập trang web.], [Postconditions], [Thông tin chi tiết của giỏ hàng, bao gồm danh sách các mô hình và thông tin tổng giá trị, được hiển thị cho khách hàng.], [Normal Flow], [ 1. Khách hàng truy cập trang web và điều hướng đến trang Chi Tiết Giỏ Hàng. 2. Hệ thống hiển thị danh sách các mô hình trong giỏ hàng của khách hàng, bao gồm tên mô hình, giá tiền, số lượng và tổng giá trị của mô hình. 3. Hệ thống hiển thị tổng giá trị của các mô hình được lựa chọn. ], [Alternative Flow], [ 2a1. Trong quá trình xem chi tiết giỏ hàng, khách hàng có thể thay đổi số lượng của mô hình trong giỏ hàng.\ 2a2. Hệ thống cập nhật số lượng và tổng giá trị cho mô hình đã thay đổi.\ 2a3. Hệ thống tính lại tổng giá trị của giỏ hàng sau khi thay đổi số lượng.\ \ 2b1. Trong quá trình xem chi tiết giỏ hàng, khách hàng có thể xóa mô hình khỏi giỏ hàng.\ 2b2. Hệ thống loại bỏ mô hình khỏi danh sách giỏ hàng và cập nhật tổng giá trị của giỏ hàng.\ 2b3. Hệ thống tính lại tổng giá trị của giỏ hàng sau khi xóa mô hình.\ \ 2c1. Trong quá trình xem chi tiết giỏ hàng, khách hàng có thể chọn mô hình từ giỏ hàng để đặt hàng.\ 2c2. Hệ thống đánh dấu mô hình được chọn.\ 2c3. Khách hàng nhấn nút *Đặt hàng*, chỉ các mô hình được đánh dấu mới được thêm vào đơn hàng.\ ], [Exception Flow], [ 2a. Nếu giỏ hàng của khách hàng không có mô hình nào, hệ thống thông báo cho khách hàng rằng giỏ hàng trống. ], ) #figure(caption: [Use-case xem chi tiết giỏ hàng], table())\ #pagebreak() == Module quản lý mô hình 3D (Managing 3D model) #figure(caption: [Module quản lý mô hình 3D], image("../images/usecase/DACNPM-ManageModel.png") ) #table( columns: (auto, auto), inset: 10pt, align: horizon, [*Use Case Name*], [*Quản lý mô hình 3D*], [Actors], [Người quản lý.], [Brief Description], [Người quản lý sử dụng chức năng này để quản lý các mô hình 3D trong hệ thống.], [Preconditions], [Người quản lý đã truy cập được trang web và đăng nhập vào tài khoản admin hệ thống.], [Postconditions], [Người quản lý truy cập thành công danh sách các mô hình 3D trong hệ thống.], [Normal Flow], [ 1. Người quản lý điều hướng đến trang Quản lý mô hình 3D. 2. Hệ thống hiển thị toàn bộ các mô hình 3D dưới dạng một bảng bao gồm các cột: ID, Tên mô hình, Hình ảnh, Thông tin, Giá tiền, Phân loại. Thông tin ở các hàng sẽ được chỉnh sửa dưới dạng text, trừ cột Hình ảnh (hiển thị bằng hình) và Phân loại (chọn từ danh sách). Dưới góc mỗi hàng của bảng, hệ thống sẽ hiển thị thêm các nút *Chỉnh sửa*, *Lưu*, *Hủy*. ], ) #figure(caption: [Use-case quản lý mô hình 3D], table()) #table( columns: (auto, auto), inset: 10pt, align: horizon, [*Use Case Name*], [*Thêm Mô hình*], [Actors], [Người quản lý.], [Brief Description], [Người quản lý sử dụng chức năng này để thêm một mô hình 3D mới vào hệ thống.], [Preconditions], [Người quản lý đã truy cập được trang web và đăng nhập vào tài khoản admin hệ thống, và đã điều hướng đến trang Quản lý mô hình 3D.], [Postconditions], [Một mô hình 3D mới được thêm thành công và hiển thị trong danh sách các mô hình 3D trong hệ thống.], [Normal Flow], [ 1. Người quản lý bấm vào nút *Thêm mô hình*. 2. Hệ thống hiển thị một biểu mẫu trống để người quản lý nhập thông tin mô hình mới. Biểu mẫu bao gồm các trường sau: Tên mô hình, Hình ảnh, Thông tin, Giá tiền, và Phân loại (lựa chọn từ danh sách). 3. Người quản lý điền thông tin mô hình mới vào biểu mẫu. 4. Người quản lý bấm nút *Lưu* để lưu thông tin mô hình mới. 5. Hệ thống kiểm tra và lưu mô hình mới vào cơ sở dữ liệu. 6. Hệ thống cập nhật danh sách các mô hình 3D và hiển thị mô hình mới trong danh sách. ], [Alternative Flow], [ 3a. Người quản lý tải lên hình ảnh cho mô hình bằng cách bấm nút *Tải lên hình ảnh* và chọn một hình ảnh từ máy tính hoặc thiết bị.\ ], [Exception Flow], [ 5a. Nếu hệ thống không thể lưu thông tin mô hình mới, hệ thống thông báo cho người quản lý và không thực hiện việc thêm mô hình mới.\ ], ) #figure(caption: [Use-case thêm mô hình 3D], table())\ #table( columns: (auto, auto), inset: 10pt, align: horizon, [*Use Case Name*], [*Chỉnh sửa mô hình 3D*], [Actors], [Người quản lý.], [Brief Description], [Người quản lý sử dụng chức năng này để cập nhật thông tin của một mô hình 3D trong hệ thống.], [Preconditions], [Người quản lý đã truy cập được trang web và đăng nhập vào tài khoản admin hệ thống, và đã điều hướng đến trang Quản lý mô hình 3D.], [Postconditions], [Thông tin của mô hình 3D đã được cập nhật thành công và hiển thị trong danh sách các mô hình 3D trong hệ thống.], [Normal Flow], [ 1. Người quản lý nhấn nút *Chỉnh sửa* của mô hình cần cập nhật từ danh sách các mô hình 3D. 2. Hệ thống hiển thị mô hình và cho phép người quản lý chỉnh sửa thông tin mô hình. 3. Người quản lý cập nhật thông tin mô hình theo nhu cầu, bao gồm các trường: Tên mô hình, Hình ảnh (có nút tải lên hình ảnh), Thông tin, Giá tiền, và Phân loại (lựa chọn từ danh sách). 4. Người quản lý bấm nút *Lưu* để lưu thông tin cập nhật của mô hình. 5. Hệ thống kiểm tra và cập nhật thông tin mô hình trong cơ sở dữ liệu. 6. Hệ thống cập nhật danh sách các mô hình 3D và hiển thị mô hình đã cập nhật trong danh sách. ], [Alternative Flow], [ 3a. Người quản lý tải lên hình ảnh mới cho mô hình bằng cách bấm nút "Tải lên hình ảnh" và chọn một hình ảnh từ máy tính hoặc thiết bị.\ 3b. Người quản lý chọn phân loại mới cho mô hình từ danh sách các phân loại có sẵn.\ 5a. Nếu hệ thống không thể cập nhật thông tin mô hình, hệ thống thông báo cho người quản lý và không thực hiện việc cập nhật mô hình. ], [Exception Flow], [ 4a. Người quản lý nhấn nút *Hủy*, hệ thống hủy bỏ mọi thay đổi.\ 4b. Nếu hệ thống báo lỗi trong khi cập nhật thông tin mô hình, hệ thống thông báo cho người quản lý và giữ nguyên thông tin cũ của mô hình. ], ) #figure(caption: [Use-case chỉnh sửa mô hình 3D], table())\ #table( columns: (auto, auto), inset: 10pt, align: horizon, [*Use Case Name*], [*Xóa Mô hình*], [Actors], [Người quản lý.], [Brief Description], [Người quản lý sử dụng chức năng này để xóa một mô hình 3D khỏi hệ thống.], [Preconditions], [Người quản lý đã truy cập được trang web và đăng nhập vào tài khoản admin hệ thống, và đã điều hướng đến trang Quản lý mô hình 3D.], [Postconditions], [Mô hình 3D đã được xóa thành công và không còn hiển thị trong danh sách các mô hình 3D trong hệ thống.], [Normal Flow], [ 1. Người quản lý nhấn nút *Xóa* của mô hình cần xóa từ danh sách các mô hình 3D. 2. Hệ thống hiển thị mô hình và xác nhận việc xóa mô hình. 3. Người quản lý xác nhận việc xóa mô hình. 4. Hệ thống kiểm tra và xóa mô hình khỏi cơ sở dữ liệu. 5. Hệ thống cập nhật danh sách các mô hình 3D và loại bỏ mô hình đã xóa khỏi danh sách. ], [Exception Flow], [ 3a. Người quản lý từ chối xác nhận việc xóa mô hình, quay trở lại trạng thái xem mô hình mà không xóa. 4a. Nếu hệ thống không thể xóa mô hình, hệ thống thông báo cho người quản lý và không thực hiện việc xóa mô hình. ], ) #figure(caption: [Use-case xóa mô hình 3D], table())\ #pagebreak() == Module tạo đơn hàng (Model Ordering) #figure(caption: [Module tạo đơn hàng], image("../images/usecase/DACNPM-ConfirmOrder.png") ) #table( columns: (auto, auto), inset: 10pt, align: horizon, [*Use Case Name*], [*Xác nhận và gửi đơn hàng*], [Actors], [Khách hàng.], [Brief Description], [Khách hàng sử dụng chức năng này để xác nhận đơn hàng và gửi đơn hàng đi để được xử lý.], [Preconditions], [Khách hàng đã lựa chọn các sản phẩm từ giỏ hàng và ấn nút *Đặt hàng*.], [Postconditions], [Đơn hàng đã được xác nhận và gửi đi để được xử lý.], [Trigger], [Khách hàng chọn các mô hình cần đặt và nhấn nút *Đặt hàng* trong giỏ hàng.], [Normal Flow], [ 1. Hệ thống hiển thị lại thông tin người đặt bao gồm: tên khách hàng, số điện thoại và địa chỉ giao hàng, thời gian giao hàng dự kiến. 2. Hệ thống tính toán chi phí giao hàng (bao gồm tổng giá trị đơn hàng và tổng chi phí vận chuyển) và hiển thị lên màn hình. 3. Khách hàng lựa chọn phương thức thanh toán. 4. Khách hàng nhấn nút *Xác nhận đơn hàng*. 5. Hệ thống gửi thông báo đến khách hàng và người quản lý về việc đơn hàng đã được xác nhận và gửi đi để được xử lý. 6. Khách hàng theo dõi trạng thái đơn hàng trên hệ thống. ], [Alternative Flow], [ 1a. Khách hàng chỉnh sửa thông tin người đặt hàng bằng cách nhấn nút *Chỉnh sửa* và nhập lại thông tin người đặt hàng.\ 2a. Trước khi chọn phương thức thanh toán, khách hàng quay về giỏ hàng để chỉnh sửa đơn hàng.\ ], [Exception Flow], [ 3a. Nếu khách hàng chưa liên kết tài khoản ngân hàng với tài khoản của mình, hệ thống sẽ yêu cầu khách hàng liên kết tài khoản ngân hàng với tài khoản của mình.\ ], ) #figure(caption: [Use-case xác nhận và gửi đơn hàng], table()) #pagebreak() == Module quản lý đơn hàng (Order Management) #figure(caption: [Module quản lý đơn hàng], image("../images/usecase/DACNPM-OrderProcess.png") ) #table( columns: (auto, auto), inset: 10pt, align: horizon, [*Use Case Name*], [*Xủ lý đơn hàng*], [Actors], [Người quản lý], [Brief Description], [Người quản lý sẽ xem danh sách đơn hàng thành các mục tương ứng với trạng thái của đơn hàng.], [Preconditions], [Người quản lý đăng nhập quyền admin hệ thống và truy cập vào trang quản lý đơn hàng.], [Postconditions], [Người quản lý xem được thông tin trạng thái các đơn hàng.], [Normal Flow], [ 1. Người quản lý điều hướng đến trang quản lý đơn hàng. 2. Hệ thống hiển thị danh sách đơn hàng theo trạng thái xử lý của chúng. Trạng thái đơn hàng bao gồm: Đang chờ xử lý, Đang in, Đang giao, Đã Thanh toán.\ ], [Alternative flow], [ 2a1. Người quản lý lọc danh sách đơn hàng theo trạng thái.\ 2a2. Hệ thống hiển thị các đơn hàng có trạng thái được lựa chọn.\ \ 2b1. Người quản lý nhấn chọn một đơn hàng.\ 2b2. Hệ thống hiển thị chi tiết thông tin đơn hàng được chọn.\ \ 2c1. Người quản lý chuyển một hoặc cùng lúc nhiều đơn hàng sang trạng thái tiếp theo.\ 2c2. Hệ thống cập nhật và hiển thị trạng thái mới của đơn hàng.\ \ 2d1. Người quản lý từ chối một hay nhiều đơn hàng cùng lúc.\ 2d2. Hệ thống cập nhật trạng thái đơn hàng và gửi thông báo từ chối đến khách hàng.\ ], ) #figure(caption: [Use-case xử lý đơn hàng], table())\ == Module thanh toán đơn hàng (Payment) #figure(caption: [Module thanh toán đơn hàng], image("../images/usecase/DACNPM-Payment.png") ) #table( columns: (auto, auto), inset: 10pt, align: horizon, [*Use Case Name*], [*<NAME>*], [Actors], [Khách hàng], [Brief Description], [Khách hàng sử dụng chức năng này để thanh toán đơn hàng.], [Preconditions], [Khách hàng đã đăng nhập vào tài khoản của mình và đặt hàng thành công.], [Postconditions], [Khách hàng đã thanh toán đơn hàng thành công.], [Normal Flow], [ 1. Khách hàng chọn phương thức thanh toán.\ 2. Khách hàng chọn thanh toán bằng MoMo, hệ thống sẽ gửi một mã vạch (đã kèm số tiền thanh toán) đến khách hàng.\ 3. Khách hàng quét mã vạch và thanh toán.\ 4. Hệ thống sẽ gửi thông báo đến khách hàng và người quản lý về việc khách hàng đã thanh toán thành công.\ ], [Alternative flow], [ 2a. Mã vạch có thời hạn trong 10 phút thanh toán, nếu quá thời hạn, hệ thống sẽ gửi lại mã vạch mới.\ 2b. Nếu khách hàng chọn thanh toán bằng tiền mặt, hệ thống sẽ gửi thông báo đến khách hàng và người quản lý về việc khách hàng đã chọn thanh toán bằng tiền mặt.\ ], [Exception Flow], [ 4a. Nếu giao dịch thất bại, hệ thống sẽ báo lỗi và điều hướng người dùng về trang thông tin đơn hàng.\ ], ) #figure(caption: [Use-case thanh toán đơn hàng], table()) #pagebreak()
https://github.com/soul667/typst
https://raw.githubusercontent.com/soul667/typst/main/复习/光电子材料与器件复习/temple/js.typ
typst
#import "@preview/jogs:0.2.3": * #set page(height: auto, width: auto, fill: black, margin: 1em) #set text(fill: white) #let code = ``` function sum() { const total = Array.prototype.slice.call(arguments).reduce(function(a, b) { return a + b; }, 0); return total; } function string_join(arr) { return arr.join(" | "); } function return_complex_obj() { return { a: 1, b: "2", c: [1, 2, 3], d: { e: 1, }, }; } ``` #let bytecode = compile-js(code) #list-global-property(bytecode) #call-js-function(bytecode, "sum", 6, 7, 8, 9, 10) #call-js-function(bytecode, "string_join", ("a", "b", "c", "d", "e"),) #call-js-function(bytecode, "return_complex_obj",)
https://github.com/coco33920/agh-public
https://raw.githubusercontent.com/coco33920/agh-public/gh-pages/pdfs/awb.typ
typst
#set page(footer: [This book is published under the MIT Licence and available on the web here #link("https://agh.nwa2coco.fr")]) #v(1fr) #set text(size:24pt) #set align(center) *A Witchy Best Friend*\ by <NAME>,\ _Last updated: December 5th, 2023_\ #set text(size:12pt) #set align(left) #v(1fr) #pagebreak(weak: true) #let middle = block(width: 100%)[ #set align(center); #set text(weight: "bold"); $ast.basic$~$ast.basic$~$ast.basic$ ] #show heading.where(level: 1): it => { v(1em) set align(center) set text(size: 16pt, weight: "bold") it v(2em) } = A Witchy Best Friend <a-witchy-best-friend> Ophelie was nervously walking toward the Girl's Dorm to meet Clara - her best friend - for their weekly "Dumb film festival" they started that 2 months into the first term to relax and relieve the pressure of the university. As she walked towards her destination she wondered if Clara will accept her coming out, memories of growing up with her brings a weak smile on her face, she remembered fondly her childhood with Clara, and she’s lesbian, So she think it should work. Finally, reaching the third floor where Clara’s room is she’s welcomed by a tight hug from her friend. - \"Hey !!\", Said Clara, practically shooting - \"Hey…\", anxiously replied Ophelie They argued a little about what film to watch and finally agreed on a silly movie about a swamp monster being chased by the protagonists, they have already seen it about a dozen times, but each other’s presence is enough for the friends. When Clara was about to start the movie Ophelie stopped her and grabbed her hand. - \"What?\" Clara said softly, clearly intrigued by her friend’s antics - \"Hey... I want to tell you something important\"... Clara just nodded, but her face betrayed her anxiety - \"I... I... I’m a girl… trans that is\" her voice barely a whisper by the end of the sentence. - \"Oh. Okay. It makes a lot of sense! What’s your name love?\" - \"Ophelie and she/her for pronouns please\" - \"Okay nice to meet you Ophelie! My best friend\" a huge grin on Clara’s face. Clara did not wait more to embrace her new friend into a really tight hug. Ophelie felt relieved, and it felt so right to hear her true name from her best friend her heart melt but little did she know she’ll be even happier in a few hours. #middle - \"Sooo I have something to tell too... You see I am a witch… not like Harry Potter’s world kind of witch that is, we communicate with the universe and try to rebalance it with our art… and I knew something was off with you because your link with the universe is... Off… like gray clouds in a beautiful summer blue sky.\" Ophelie immediately went non-verbal she did not understood what her best friend just threw at her. Magic was a thing? And her best friend whom she knew for years can wield it? That’s too good to be true? But, she trusted her, she knew she wouldn’t mess with her just after her coming out, it would be just plain mean, so Ophelie decided to keep listening to her - \"I’m telling you that because, like, I inferred that the something off was about your body you’re not very masculine but not outright feminine, so I thought maybe you would want to have a better suited body? So I already studied body magic and with that I mastered a true form spell, for you, and I can use it on you right now if that’s what you want.\" Ophelie was shocked. The look on her face deserved to be framed (so naturally Clara took a picture of her) her best friend could fast track the transition, and she could have her dream body just now just like that? She realized she was stunned for a couple of minutes now, so she wordlessly nodded to her best friend. As quietly as Ophelie, Clara took her best friend hand into hers and summoned the universe she exactly carefully repeated the steps she learned and asked the universe to fix Ophelie’s body. She felt the little tug and the little shock that signal the approval of the universe. - \"It’s done, the change will slowly happen over the next few hours so why don’t we start our dumb film night?\" Ophelie could only nod. First she felt a little sleepy and fell a little into Clara’s embrace now snugly cuddled with her. Approximately half into the movie she could feel her skin softening all over her body and she marveled at the sensation, she really loved that and couldn’t stop herself to touch herself, not that Clara could too. A few minutes after that she felt her face slightly moving just a little lump of far here, bones slightly higher, her face now rounder and far softer without the facial hair. Her hair already mid back grew a few inches more and turned from a pale blonde to a gorgeous ginger, and went from straight to averagely wavy, and curly she couldn’t stop admiring her hair while Clara couldn’t stop admiring her face. Soon enough the spell worked with her neck now thinner and lacking her once <NAME>, her vocal cords shifted, and she gasped in her new soft high soprano voice. While her whole upper body was shrinking her already narrow shoulders narrowed further until they were tiny, and she felt at home, her arms followed, and soon they were as thin as her shoulders Moderate breast grew on her now thinner rib cage and while Clara was glaring at them Ophelie was far more interested in her narrowing waist, her muscle melt, her stomach now without a trace of hard muscle and just a layer of soft fat topped by hairless soft skin. Her pelvic area shifted to the feminine form while organs were rearangering in her inner abdominal area, her hips slightly widened just enough to contrast with her now much narrower waist. Her legs followed, excess muscle melted and the fat redistributed in her body her figure now a beautiful hourglass and softness all around her body as her far bigger and stronger friend was poking her all over her body, as she already shaved her legs they were now just as she liked them long and smooth and ended with beautiful tiny feet. She felt like she lost a foot in height, but she was squeaking beyond human understanding she felt so at home within her body, now looking as her 5’11 butch best friend she felt absolutely minuscule but couldn’t stop herself to grin as Clara tightened her grip on her best friend. After what felt like a lifetime hugging Clara, Ophelie asked her best friend to help her walk to the full body mirror, as she basked into the vision of her true self and the beautiful woman behind her, she guessed her size around 5’1 - her dream size - and rushed hugging Clara once more. She dressed into what she found being the skirt version of the school uniform now her size but stopped at just the undergarments, she turned around looked up to Clara and said without a hint of anxiety - \"Can I kiss you Clara?\". = Epilogue : A Witchy lover <epilogue-a-witchy-lover> #emph[#strong[Ophelie’s POV]] - "Ophelie! Faster you incompetent lesbian! We must be at Violet’s in half an hour!" Clara yelled through the door It’s been almost year since that day, and every one of them was a blessing, I love my body sure, and dysphoria mostly disappeared, it was a blessing in itself I was finally able to do well in class and in life. I had more friends now – Violet was one of them – and I was valedictorian of the engineering class of Nimoy’s University. Well I have to get moving or Clara will magically open this door… I opened the door to see Clara mostly patiently waiting beside it, we moved into an apartment at the end of our semester, so we moved together. She, and I, living together in an apartment and some non-school days were like heaven. This apartment has a distinct property that Clara specially searched when she found the apartment on the online website, #emph[There was only one bedroom.] - "How do I look" I weakly said, trying to calm my anxiety and the torrent of feeling I was experiencing - "Oh my god Ophelie this dress is so cute on you" said Clara, her face lit up like a Christmas tree when she saw me She moved toward me, leveled up my chin before gently kissing me and hugging me as the same time, I hugged her back tightening the embrace as an effort to close the small but terrible gap between our bodies, I completely melted in her hug and marveled as the feeling of this hug and kiss, I could never get enough hugs hers were so good. - "We have to go baby" she said grinning at my inability to talk or even move as I felt the last remnant of her warmth on my body, she took my hand, and we began walking towards the campus. #middle - "Ophelie! Clara! Always so beautiful you two" Violet grinned as we entered into her dorm room for our weekly film meetup. Jim and his partner were on a date, so there were only the three of us. - "Hello Violet" we both said, hugging her, Violet was another trans girl in my class, she also benefited for the help of my girlfriend, well to be honest, I begged Clara to help her, and she finally agreed, not without kissing me and doubling her cuddling requests as reward, not that I was complaining I loved cuddling with her. - "Hey, I see you two "only housemate" are closer now huh-uh" she said with a knowing grin, we were not officially dating, that is we were not out in the university, and were more of a private item, but my friendship with Violet started when she connected the dot between who I was and who I am, she also figured out my relationship with Clara a few weeks into our friendship. The housemate thing was an inside lesbian joke apparently, I was not really into internet but Clara and Violet were. Jim and his partner were originally Clara’s friend from high school, but they attend another close university and live not so far away, she also "helped" Jim’s partner Alex. In and all we were a knit-close group of friends bonded by mundane university and less-mundane magic. We chose a film and settled down on the couch, I, the smallest individual of this group, was in the middle while Clara was cuddled at my right and Violet was cuddled at my left, cuddling is nice, so I said nothing as I basked into the feeling of friends, of my girlfriend, cuddles, snacks and watching a silly comedy film from a few years ago. I think its name was "The Super-revenge of the jedi-mummies versus the mighty gender-bent avengers in the new matrix" apparently it was intended to be a big film consisting of a crossover between four huge licenses of the time. But it had failed and was now considered a useless comical film for nights like these. #middle A few days later I was at University thinking what I could buy for Clara for Valentine day, when I also remembered that Valentine day would be the first anniversary of this body, and the first anniversary of our relationship, I decided to buy a nice necklace, I could wait next year for the proposal. #middle But apparently Clara thought otherwise, - "Ophelie, I love you and the past year have been a blessing" I nodded, but she motioned that she hadn’t finished yet "and I want to spend the remainder of my life on this planet with you, I can’t imagine a world where we’re not together, what I’m trying to say is Ophelie, will you marry me?" My heart stopped, and I began crying, Clara wanted to marry me?? - "Of course Clara I love and ever will love you’re my life my sun my…" but Clara stopped me by kissing me. I was in heaven, I am officially Clara’s fiancée ? And she is my fiancée ? I never thought it would be possible ! #middle The wedding was small, but it was on purpose, our families were there, looking proud of us, our friends, Violet and her boyfriend, Jim and his now married partner, Valentina and her polycule (a boyfriend, two girlfriends and one enby-friend as they called themselves) and of course my sister were all there too looking proud of us. My sister was my witness while Clara’s brother was her man of honor, it’s funny considering our usual roles, but what’s a better time than our lesbian wedding to annoy normativity? The day has been exhausting but here we were, as newly married wives, cuddled in our bed waiting for sleep to take us. Just before I fell asleep though, one thought came to me, do Clara love me ?
https://github.com/lucannez64/Notes
https://raw.githubusercontent.com/lucannez64/Notes/master/Maths_Prepa_MPSI_Chap2_Ex.typ
typst
#import "template.typ": * // Take a look at the file `template.typ` in the file panel // to customize this template and discover how it works. #show: project.with( title: "Maths Prepa MPSI Chap2 Ex", authors: ( "<NAME>", ), date: "3 Novembre, 2023", ) #set heading(numbering: "1.1.") == Ex 1 <ex-1> #block[ #set enum(numbering: "1)", start: 1) + $ 3^(n plus 2) minus 3^(n plus 1) minus 7 times 3^n plus 5 times 3^(n minus 1) $ $ 3^(n plus 2) minus 3^(n plus 1) eq 3^(n plus 1) lr((3 minus 1)) eq 2 times 3^(n plus 1) $ $ minus 7 times 3^n eq minus 7 times lr((3^(n plus 1 minus 1))) eq frac(minus 7, 3) times 3^(n plus 1) $ $ 5 times 3^(n minus 1) eq 5 times 3^(n plus 1 minus 2) eq 5 / 3^2 times 3^(n plus 1) $ $ 3^(n plus 2) minus 3^(n plus 1) minus 7 times 3^n plus 5 times 3^(n minus 1) eq 3^(n plus 1) lr((2 minus 7 / 3 plus 5 / 3^2)) eq 3^(n plus 1) lr((frac(21 plus 5 plus 18, 3^2))) eq 3^(n plus 1) 44 / 9 $ ] == Ex 8 <ex-8> $ sqrt(x) plus sqrt(x plus 1) eq a $ $ x plus x plus 1 eq a^2 $ $ 2 x plus 1 eq a^2 $ $ x eq frac(a^2 minus 1, 2) $ $ x eq a^2 / 2 minus 1 / 2 $
https://github.com/Bit-Part-Young/report-template-MMMS-typst
https://raw.githubusercontent.com/Bit-Part-Young/report-template-MMMS-typst/main/README.md
markdown
# 《多尺度材料模拟与计算》课程实验报告、作业 typst 模板 - 作者:小小角色 - 创建时间: - 以下内容如有错误或疑问,或友好交流互动,请在该 repo 中提 [Issues](https://gitee.com/yangsl306/report-template-MMMS-typst/issues/new) - 本模板内容较为简略,十分欢迎感兴趣、有能力的同学对其进行丰富扩展 --- ## To Do - [x] 标题后首段无法正确缩进
https://github.com/Dherse/typst-brrr
https://raw.githubusercontent.com/Dherse/typst-brrr/master/samples/syntree/main.typ
typst
#import "@preview/syntree:0.1.0": tree #set page(width: auto, height: auto) #let bx(col) = box(fill: col, width: 1em, height: 1em) #figure( caption: "Monster syntaxtree for sampling purposes.", gap: 2em, tree("colors", tree("warm", tree("colors", tree("warm", tree("colors", tree("warm", tree("colors", tree("warm", bx(red), bx(orange)), tree("cool", bx(blue), bx(teal))), bx(orange)), tree("cool", tree("colors", tree("warm", bx(red), bx(orange)), tree("cool", tree("colors", tree("warm", tree("colors", tree("warm", bx(red), bx(orange)), tree("cool", bx(blue), bx(teal))), bx(orange)), tree("cool", tree("colors", tree("warm", tree("colors", tree("warm", tree("colors", tree("warm", tree("colors", tree("warm", tree("colors", tree("warm", bx(red), bx(orange)), tree("cool", bx(blue), bx(teal))), bx(orange)), tree("cool", tree("colors", tree("warm", bx(red), bx(orange)), tree("cool", tree("colors", tree("warm", tree("colors", tree("warm", bx(red), bx(orange)), tree("cool", bx(blue), bx(teal))), bx(green)), tree("cool", tree("colors", tree("warm", bx(red), bx(orange)), tree("cool", bx(blue), tree("colors", tree("warm", bx(red), bx(orange)), tree("cool", bx(blue), bx(teal))))), bx(teal))), tree("colors", tree("warm", bx(red), bx(orange)), tree("cool", bx(blue), bx(teal))))), bx(teal))), bx(orange)), tree("cool", bx(blue), bx(teal))), bx(orange)), tree("cool", tree("colors", tree("warm", bx(red), bx(orange)), tree("cool", tree("colors", tree("warm", tree("colors", tree("warm", bx(red), tree("colors", tree("warm", tree("colors", tree("warm", tree("colors", tree("warm", tree("colors", tree("warm", bx(red), bx(orange)), tree("cool", bx(blue), bx(teal))), bx(orange)), tree("cool", tree("colors", tree("warm", bx(red), bx(orange)), tree("cool", tree("colors", tree("warm", tree("colors", tree("warm", bx(red), bx(orange)), tree("cool", bx(blue), bx(teal))), bx(orange)), tree("cool", tree("colors", tree("warm", bx(red), bx(orange)), tree("cool", bx(blue), tree("colors", tree("warm", bx(red), bx(orange)), tree("cool", bx(blue), bx(teal))))), bx(teal))), tree("colors", tree("warm", bx(red), bx(orange)), tree("cool", bx(blue), bx(teal))))), bx(teal))), bx(orange)), tree("cool", bx(blue), bx(teal))), bx(orange)), tree("cool", tree("colors", tree("warm", bx(red), bx(orange)), tree("cool", tree("colors", tree("warm", tree("colors", tree("warm", bx(red), bx(orange)), tree("cool", bx(blue), bx(teal))), bx(orange)), tree("cool", tree("colors", tree("warm", bx(red), bx(orange)), tree("cool", bx(blue), tree("colors", tree("warm", bx(red), bx(orange)), tree("cool", bx(blue), tree("colors", tree("warm", tree("colors", tree("warm", tree("colors", tree("warm", tree("colors", tree("warm", bx(red), bx(orange)), tree("cool", bx(blue), bx(teal))), bx(orange)), tree("cool", tree("colors", tree("warm", bx(red), bx(orange)), tree("cool", tree("colors", tree("warm", tree("colors", tree("warm", bx(red), bx(orange)), tree("cool", bx(blue), bx(teal))), bx(orange)), tree("cool", tree("colors", tree("warm", bx(red), bx(orange)), tree("cool", bx(blue), tree("colors", tree("warm", bx(red), bx(orange)), tree("cool", bx(blue), bx(teal))))), bx(teal))), tree("colors", tree("warm", bx(red), bx(orange)), tree("cool", bx(blue), bx(teal))))), bx(teal))), bx(orange)), tree("cool", bx(blue), bx(teal))), bx(orange)), tree("cool", tree("colors", tree("warm", bx(red), bx(green)), tree("cool", tree("colors", tree("warm", tree("colors", tree("warm", bx(red), tree("colors", tree("warm", tree("colors", tree("warm", tree("colors", tree("warm", tree("colors", tree("warm", bx(red), bx(orange)), tree("cool", bx(blue), bx(teal))), bx(orange)), tree("cool", tree("colors", tree("warm", bx(red), bx(orange)), tree("cool", tree("colors", tree("warm", tree("colors", tree("warm", bx(red), bx(orange)), tree("cool", bx(blue), bx(teal))), bx(orange)), tree("cool", tree("colors", tree("warm", bx(red), bx(orange)), tree("cool", bx(blue), tree("colors", tree("warm", bx(red), bx(orange)), tree("cool", bx(blue), bx(teal))))), bx(teal))), tree("colors", tree("warm", bx(red), bx(orange)), tree("cool", bx(blue), bx(teal))))), bx(teal))), bx(orange)), tree("cool", bx(blue), bx(teal))), bx(orange)), tree("cool", tree("colors", tree("warm", bx(red), bx(orange)), tree("cool", tree("colors", tree("warm", tree("colors", tree("warm", bx(red), bx(orange)), tree("cool", bx(blue), bx(teal))), bx(orange)), tree("cool", tree("colors", tree("warm", bx(red), bx(green)), tree("cool", bx(blue), tree("colors", tree("warm", bx(red), bx(orange)), tree("cool", bx(blue), bx(teal))))), bx(teal))), tree("colors", tree("warm", bx(red), bx(orange)), tree("cool", bx(blue), bx(teal))))), bx(teal)))), tree("cool", bx(blue), bx(teal))), bx(orange)), tree("cool", tree("colors", tree("warm", bx(red), bx(orange)), tree("cool", bx(blue), tree("colors", tree("warm", bx(red), bx(orange)), tree("cool", bx(blue), bx(teal))))), bx(teal))), tree("colors", tree("warm", bx(red), bx(orange)), tree("cool", bx(blue), bx(teal))))), bx(teal))))))), bx(teal))), tree("colors", tree("warm", bx(red), bx(orange)), tree("cool", bx(blue), bx(teal))))), bx(teal)))), tree("cool", bx(blue), bx(teal))), bx(orange)), tree("cool", tree("colors", tree("warm", bx(red), bx(orange)), tree("cool", bx(blue), tree("colors", tree("warm", bx(red), bx(orange)), tree("cool", bx(blue), bx(teal))))), bx(teal))), tree("colors", tree("warm", bx(red), bx(orange)), tree("cool", bx(blue), bx(teal))))), bx(teal))), bx(orange)), tree("cool", bx(blue), tree("colors", tree("warm", bx(red), bx(orange)), tree("cool", bx(blue), bx(teal))))), bx(teal))), tree("colors", tree("warm", bx(red), bx(orange)), tree("cool", bx(blue), bx(teal))))), bx(teal))), bx(orange)), tree("cool", bx(blue), bx(teal))), bx(orange)), tree("cool", tree("colors", tree("warm", bx(red), bx(orange)), tree("cool", tree("colors", tree("warm", tree("colors", tree("warm", bx(red), tree("colors", tree("warm", tree("colors", tree("warm", tree("colors", tree("warm", tree("colors", tree("warm", bx(red), bx(orange)), tree("cool", bx(blue), bx(teal))), bx(orange)), tree("cool", tree("colors", tree("warm", bx(red), bx(orange)), tree("cool", tree("colors", tree("warm", tree("colors", tree("warm", bx(red), bx(orange)), tree("cool", bx(blue), bx(teal))), bx(green)), tree("cool", tree("colors", tree("warm", bx(red), bx(orange)), tree("cool", bx(blue), tree("colors", tree("warm", bx(red), bx(orange)), tree("cool", bx(blue), bx(teal))))), bx(teal))), tree("colors", tree("warm", bx(red), bx(orange)), tree("cool", bx(blue), bx(teal))))), bx(teal))), bx(orange)), tree("cool", bx(blue), bx(teal))), bx(orange)), tree("cool", tree("colors", tree("warm", bx(red), bx(orange)), tree("cool", tree("colors", tree("warm", tree("colors", tree("warm", bx(red), bx(orange)), tree("cool", bx(blue), bx(teal))), bx(orange)), tree("cool", tree("colors", tree("warm", bx(red), bx(orange)), tree("cool", bx(blue), tree("colors", tree("warm", bx(red), bx(orange)), tree("cool", bx(blue), bx(teal))))), bx(teal))), tree("colors", tree("warm", bx(red), bx(orange)), tree("cool", bx(blue), bx(teal))))), bx(teal)))), tree("cool", bx(blue), bx(teal))), bx(orange)), tree("cool", tree("colors", tree("warm", bx(red), bx(orange)), tree("cool", bx(blue), tree("colors", tree("warm", bx(red), bx(orange)), tree("cool", bx(blue), bx(teal))))), bx(teal))), tree("colors", tree("warm", bx(red), bx(orange)), tree("cool", bx(blue), bx(teal))))), bx(teal))) )
https://github.com/TypstApp-team/typst
https://raw.githubusercontent.com/TypstApp-team/typst/master/tests/typ/math/matrix-gaps.typ
typst
Apache License 2.0
// Test matrices, cases and vec gaps --- #set math.mat(row-gap: 1em, column-gap: 2em) $ mat(1, 2; 3, 4) $ --- #set math.mat(gap: 1em) $ mat(1, 2; 3, 4) $ --- #set math.cases(gap: 1em) $ x = cases(1, 2) $ --- #set math.vec(gap: 1em) $ vec(1, 2) $
https://github.com/soul667/typst
https://raw.githubusercontent.com/soul667/typst/main/PPT/test/drafting.typ
typst
/// Default properties for margin notes. These can be overridden per function call, or /// globally by calling `set-margin-note-defaults`. Available options are: /// - `margin-right` (length): Size of the right margin /// - `margin-left` (length): Size of the left margin /// - `page-width` (length): Width of the page/container. This is automatically /// inferrable when using `set-page-properties` /// - `page-offset-x` (length): Horizontal offset of the page/container. This is /// generally only useful if margin notes are applied inside a box/rect; at the page /// level this can remain unspecified /// - `stroke` (paint): Stroke to use for the margin note's border and connecting line /// - `rect` (function): Function to use for drawing the margin note's border. This /// function must accept positional `content` and keyword `width` arguments. /// - `side` (side): Which side of the page to place the margin note on. Must be `left` /// or `right` /// - `hidden` (bool): Whether to hide the margin note. This is useful for temporarily /// disabling margin notes without removing them from the code #let margin-note-defaults = state( "margin-note-defaults", ( margin-right: 0in, margin-left: 0in, page-width: none, page-offset-x: 0in, stroke: red, rect: rect, side: auto, hidden: false, ) ) #let note-descent = state("note-descent", (:)) #let _run-func-on-first-loc(func, label-name: "loc-tracker") = { // Some placements are determined by locations relative to a fixed point. However, typst // will automatically re-evaluate that computation several times, since the usage // of that computation will change where an element is placed (and therefore update its // location, and so on). Get around this with a state that only checks for the first // update, then ignores all subsequent updates let lbl = label(label-name) [#metadata(label-name)#lbl] locate(loc => { let found-labels = query(selector(lbl).before(loc), loc) if found-labels.len() == 0 { // Happens when a "show" rule hides a page or there is otherwise no displayed // content return } let use-loc = found-labels.last().location() func(use-loc) }) } /// Place content at a specific location on the page relative to the top left corner /// of the page, regardless of margins, current container, etc. /// -> content #let absolute-place(dx: 0em, dy: 0em, content) = { _run-func-on-first-loc(loc => { let pos = loc.position() place(dx: -pos.x + dx, dy: -pos.y + dy, content) }) } #let _calc-text-resize-ratio(width, spacing, styles) = { // Add extra margin to ensure reasonable separation between two adjacent lines let size = measure(text[#width], styles).width * 120% spacing / size * 100% } /// Add a series of evenly spaced x- any y-axis lines to the page. /// /// - dx (length): Horizontal offset from the top left corner of the page /// - dy (length): Vertical offset from the top left corner of the page /// - stroke (paint): Stroke to use for the grid lines. The `paint` of this stroke will /// determine the text color. /// - width (length): Total width of the grid /// - height (length): Total height of the grid /// - spacing (length, array): Spacing between grid lines. If an array is provided, the /// values are taken in (x, y) order. Cannot be provided alongside `divisions`. /// - divisions (int, array): Number of divisions along each axis. If an array is /// provided, the values are taken in (x, y) order. Cannot be provided alongside /// `spacing`. /// - square (bool): Whether to make the grid square. If `true`, and either `divisions` /// or `spacing` is provided, the smaller of the two values will be used for both axes /// to ensure each grid cell is square. /// - relative (bool): If `true` (default), the grid will be placed relative to the /// current container. If `false`, the grid will be placed relative to the top left /// corner of the page. #let rule-grid( dx: 0pt, dy: 0pt, stroke: black, width: 100cm, height: 100cm, spacing: none, divisions: none, square: false, relative: true, ) = { // Unfortunately an int cannot be constructed from a length, so get it through a // hacky method of converting to a string then an int if spacing == none and divisions == none { panic("Either `spacing` or `divisions` must be specified") } if spacing != none and divisions != none { panic("Only one of `spacing` or `divisions` can be specified") } if divisions != none and type(divisions) != "array" { divisions = (divisions, divisions) } if spacing != none and type(spacing) != "array" { spacing = (spacing, spacing) } let place-func = if relative {place} else {absolute-place} let global-dx = dx let global-dy = dy let to-int(amt) = int(amt.abs / 1pt) let to-pt(amt) = amt * 1pt let (divisions, spacing) = (divisions, spacing) if divisions != none { divisions = divisions.map(to-pt) spacing = (width/divisions.at(0), height/divisions.at(1)) if square { spacing = (calc.min(..spacing), calc.min(..spacing)) } spacing = spacing.map(to-pt) } let (x-spacing, y-spacing) = spacing let (width, height, step) = (width, height, x-spacing).map(to-int) style(styles => { // Assume text width is the limiting factor since a number will often be wider than // tall. This works in the majority of cases let scale-factor = _calc-text-resize-ratio(width, x-spacing, styles) set line(stroke: stroke) let dummy-line = line(stroke: stroke) set text(size: 1em * scale-factor, fill: dummy-line.stroke.paint) locate(loc => { for (ii, dx) in range(0, width, step: step).enumerate() { place-func( dx: global-dx, dy: global-dy, line(start: (dx * 1pt, 0pt), end: (dx * 1pt, height * 1pt)) ) place-func( dx: global-dx + (dx * 1pt), dy: global-dy, repr(ii * step) ) } let step = to-int(y-spacing) for (ii, dy) in range(0, height, step: step).enumerate() { place-func( dx: global-dx, dy: global-dy, line(start: (0pt, dy * 1pt), end: (width * 1pt, dy * 1pt)) ) place-func( dy: global-dy + dy * 1pt, dx: global-dx, repr(ii * step) ) } }) }) } /// Changes the default properties for margin notes. See documentation on /// `margin-note-defaults` for available options. #let set-margin-note-defaults(..defaults) = { defaults = defaults.named() margin-note-defaults.update(old => { if type(old) != "dictionary" { panic("margin-note-defaults must be a dictionary") } if (old + defaults).len() != old.len() { let allowed-keys = array(old.keys()) let violators = array(defaults.keys()).filter(key => key not in allowed-keys) panic("margin-note-defaults can only contain the following keys: " + allowed-keys.join(", ") + ". Got: " + violators.join(", ")) } old + defaults }) } #let place-margin-rects(padding: 1%, ..rect-kwargs) = { let rect-kwargs = rect-kwargs.named() if "height" not in rect-kwargs { rect-kwargs.insert("height", 100%) } locate(loc => { let props = margin-note-defaults.at(loc) let (page-width, r-width, l-width) = ( props.page-width, props.margin-right, props.margin-left, ) let r(w) = rect(width: w, ..rect-kwargs) absolute-place(r(l-width - padding)) absolute-place(dx: page-width + l-width + padding, r(r-width - padding)) }) } /// Required for `margin-note` to work, since it informs `drafting` of the page setup. /// Since margins are not yet automatically identifiable, they must be specified /// manually. #let set-page-properties(margin-right: 0pt, margin-left: 0pt, ..kwargs) = { let kwargs = kwargs.named() layout(layout-size => { set-margin-note-defaults( margin-right: margin-right, margin-left: margin-left, page-width: layout-size.width, ..kwargs ) }) } #let margin-lines(stroke: gray + 0.5pt) = { locate(loc => { let r-margin = margin-note-defaults.at(loc).margin-right let l-margin = margin-note-defaults.at(loc).margin-left place(dx: -2%, rect(height: 100%, width: 104%, stroke: (left: stroke, right: stroke))) // absolute-place(dx: 100% - l-margin, line(end: (0%, 100%))) }) } #let _path-from-diffs(start: (0pt, 0pt), ..diffs) = { let diffs = diffs.pos() let out-path = (start, ) let next-pt = start for diff in diffs { next-pt = (next-pt.at(0) + diff.at(0), next-pt.at(1) + diff.at(1)) out-path.push(next-pt) } out-path } #let _get-page-pct(props) = { let page-width = props.page-width if page-width == none { panic("drafting's default `page-width` must be specified and non-zero before creating a note") } page-width/100 } #let _get-descent-at-page(loc, descents-dict: none) = { if descents-dict == none { descents-dict = note-descent.at(loc) } let page-cnt = str(counter(page).at(loc).first()) (page-cnt, descents-dict.at(page-cnt, default: (left: 0pt, right: 0pt))) } #let _update-descent(side, dy, anchor-y, note-rect) = { style(styles => { locate(loc => { let height = measure(note-rect, styles).height let dy = measure(v(dy + height), styles).height + anchor-y note-descent.update(old => { let (cnt, props) = _get-descent-at-page(loc, descents-dict: old) props.insert(side, calc.max(dy, props.at(side))) old.insert(cnt, props) old }) }) }) } #let _margin-note-right(body, dy, anchor-x, anchor-y, ..props) = { props = props.named() let pct = _get-page-pct(props) let dist-to-margin = 101*pct - anchor-x + props.margin-left let text-offset = 0.5em let right-width = props.margin-right - 4*pct let path-pts = _path-from-diffs( // make an upward line before coming back down to go all the way to // the top of the lettering (0pt, -1em), (0pt, 1em + text-offset), (dist-to-margin, 0pt), (0pt, dy), (1*pct + right-width / 2, 0pt) ) dy += text-offset let note-rect = props.at("rect")( stroke: props.stroke, width: right-width, body ) // Boxing prevents forced paragraph breaks box[ #place(path(stroke: props.stroke, ..path-pts)) #place(dx: dist-to-margin + 1*pct, dy: dy, [#note-rect<margin-note>]) ] _update-descent("right", dy, anchor-y, note-rect) } #let _margin-note-left(body, dy, anchor-x, anchor-y, ..props) = { props = props.named() let pct = _get-page-pct(props) let dist-to-margin = -anchor-x + 1*pct let text-offset = 0.4em let box-width = props.margin-left - 4*pct let path-pts = _path-from-diffs( (0pt, -1em), (0pt, 1em + text-offset), (-anchor-x + props.margin-left + 1*pct, 0pt), (-2*pct, 0pt), (0pt, dy), (-1*pct - box-width / 2, 0pt), ) dy += text-offset let note-rect = props.at("rect")( stroke: props.stroke, width: box-width, body ) // Boxing prevents forced paragraph breaks box[ #place(path(stroke: props.stroke, ..path-pts)) #place(dx: dist-to-margin + 1*pct, dy: dy, [#note-rect<margin-note>]) ] _update-descent("left", dy, anchor-y, note-rect) } /// Places a boxed note in the left or right page margin. /// /// - body (content): Margin note contents, usually text /// - dy (length): Vertical offset from the note's location -- negative values /// move the note up, positive values move the note down /// - ..kwargs (dictionary): Additional properties to apply to the note. Accepted values are keys from `margin-note-defaults`. #let margin-note(body, dy: auto, ..kwargs) = { _run-func-on-first-loc(loc => { let pos = loc.position() let properties = margin-note-defaults.at(loc) + kwargs.named() let (anchor-x, anchor-y) = (pos.x - properties.page-offset-x, pos.y) if properties.hidden { return } if properties.side == auto { let (r, l) = (properties.margin-right, properties.margin-left) properties.side = if calc.max(r, l) == r {right} else {left} } // `let` assignment allows mutating argument let dy = dy if dy == auto { let (cur-page, descents) = _get-descent-at-page(loc) let cur-descent = descents.at(repr(properties.side)) dy = calc.max(0pt, cur-descent - loc.position().y) // Notes at the end of a line misreport their x position, the placed box will wrap // onto the next line and invalidate the calculated distance. // A hacky fix is to manually replace the x position to an offset of 0. let is-end-of-line = calc.abs( anchor-x - properties.margin-left - properties.page-width - properties.page-offset-x ) < 0.1pt if is-end-of-line { anchor-x -= properties.page-width } } let margin-func = if properties.side == right { _margin-note-right } else { _margin-note-left } margin-func( body, dy, anchor-x, anchor-y, ..properties ) }) } /// Place a note inline with the text body. /// /// - body (content): Margin note contents, usually text /// - par-break (bool): Whether to break the paragraph after the note, which places /// the note on its own line. /// - ..kwargs (dictionary): Additional properties to apply to the note. /// #let inline-note(body, par-break: true, ..kwargs) = { locate(loc => { let properties = margin-note-defaults.at(loc) + kwargs.named() if properties.hidden { return } let rect-func = properties.at("rect") if par-break { return [#rect-func(body, stroke: properties.stroke)<inline-note>] } // else let s = none let dummy-rect = rect-func(stroke: properties.stroke)[dummy content] let default-rect = rect(stroke: properties.stroke)[dummy content] if "stroke" in dummy-rect.fields() { s = dummy-rect.stroke } else { s = default-rect.stroke } let bottom = 0.35em let top = 1em set text(top-edge: "ascender", bottom-edge: "descender") let cap-line = { let t = if s.thickness == auto {0pt} else {s.thickness / 2} box(height: top, outset: (bottom: bottom + t, top: t), stroke: (left: properties.stroke)) } let new-body = underline(stroke: properties.stroke, [ #body ], offset: bottom) if dummy-rect.has("fill") and dummy-rect.fill != auto { new-body = highlight(new-body, fill: dummy-rect.fill) } new-body = [ #underline([#cap-line#new-body#cap-line], stroke: properties.stroke, offset: -top) <inline-note> ] new-body }) }
https://github.com/jrihon/cv
https://raw.githubusercontent.com/jrihon/cv/main/sections/competencies.typ
typst
#import "../brilliant-template/template.typ": * #cvSection("Competencies") #columns(2, gutter: 24pt)[ #cvSubSection("Informatics") #skill("Python (Software development, figures, scripting)", 4) #skill("Shell (Scripting, sysadmin)", 3) #skill("LaTeX (Manuscripts, presentations)", 3) #skill("Rust (Software development)", 3) #skill("Typst (PhD thesis, this CV)", 3) #skill("Lua (NeoVim plugins)", 1) #colbreak() #cvSubSection("Languages") #skill("Dutch (native)", 5) #skill("English", 5) #skill("French", 4) ] #cvSubSection("Software knowledge") - *Operating System* : #graytext("I main") #underline("GNU/Linux", offset:0.1em)#graytext(" on all machines, but am comfortable on Windows and MacOS.") - *Scientific Software* : #underline("ORCA", offset:0.1em) #graytext("for quantum mechanics applications,") #underline("AMBER MD", offset:0.1em) #graytext("for atomistic simulations of biomolecular systems.") - *Graphic Design* : #graytext("Proficient in") #underline("InkScape", offset:0.1em) #graytext("for vectorised figures.") #underline("Matplotlib", offset:0.1em) #graytext("for all generated graphs.") - *Dev. Environment* : #underline("NeoVim", offset:0.1em) #graytext("for programming and general text manipulation purposes.") #underline("Tmux", offset:0.1em) #graytext(" to keep track of multiple projects. ") #underline("Git ", offset:0.1em)#graytext(" for version control.")
https://github.com/Myriad-Dreamin/typst.ts
https://raw.githubusercontent.com/Myriad-Dreamin/typst.ts/main/fuzzers/corpora/layout/place-nested_01.typ
typst
Apache License 2.0
#import "/contrib/templates/std-tests/preset.typ": * #show: test-page #box( fill: aqua, width: 30pt, height: 30pt, { box(fill: yellow, { [Hello] place(horizon, line(start: (0pt, 0pt), end: (20pt, 0pt), stroke: red + 2pt)) }) place(horizon, line(start: (0pt, 0pt), end: (20pt, 0pt), stroke: green + 3pt)) } )
https://github.com/NiklasEi/ndc_spin
https://raw.githubusercontent.com/NiklasEi/ndc_spin/main/templates/package/template.typ
typst
#include "file.typ" a test template #let input = if sys.inputs.keys().contains("input") {json.decode(sys.inputs.input);} else {json("sample.json");} #input.test #set table( stroke: none, gutter: 0.2em, fill: (x, y) => if x == 0 or y == 0 { gray }, inset: (right: 1.5em), ) #table( columns: 4, [], [Exam 1], [Exam 2], [Exam 3], ..for (name, one, two, three) in input.items { (name, one, two, three) } ) #set text(font: "PT Sans") This is sans-serif. \ هذا عربي. #set text(font: ( "Inria Serif", "Noto Sans Arabic", )) This is Latin. \ هذا عربي.
https://github.com/unforswearing/typst_invoice
https://raw.githubusercontent.com/unforswearing/typst_invoice/main/README.md
markdown
# Typst Invoice A simple invoice written with Typst, for contracting work. - Invoice variables are stored in `invoice_data.json`. - See `invoice_tmpl.typ` for example of how variables are used. - Example pdf can be found at `invoice_tmpl.pdf`.
https://github.com/michalrzak/muw-typst-template
https://raw.githubusercontent.com/michalrzak/muw-typst-template/main/main.typ
typst
#import "template.typ": * // README // --------------------------------------------- // Before writting the thesis definetly check out the guide at // https://ub.meduniwien.ac.at/fileadmin/content/OE/ub/dokumente/Leitfaden_Studierende_Hochschulschriften_MedUni_Wien.pdf // // You are for example required to have a list of abbreviations in your document, if any are used. // For this simply fill out the appropriate field in the initialization. // // This template should automatically take care of any requirements, if you fins something missing, contributions are // welcome. // // NOTE: You might need to disable the printing of List of Figures / List of Tables / List of Formulas depending on // if you are using them in your thesis. You can do this with the appropriate parameters. // --------------------------------------------- // Customize the following fields with your data! #show: project.with( type: "Masterarbeit", title_en: "A title in English", title_de: "Ein Titel auf Deutsch", targeted_acadmic_degree: "Diplomingenieur (Dipl. Ing.)", study_program: "Medizininformatik", conducted_at: "Your institute", supervisors: ("Supervisor","Co-supervisor"), your_name: "<NAME>", your_orcid: "sample", date: "March 7, 2024", place: "Wien", // Insert your abstract after the colon, wrapped in brackets. // Example: `abstract: [This is my abstract...]` abstract_en: lorem(59), abstract_de: lorem(59), // The acknowledgements and motivation are both optional fields. // If you do not need them in your thesis simply leave out the field. // Formatting same as abstract acknowledgements: lorem(59), motivation: lorem(59), // The abbreviations field is also optional. // If you need to use extend the dictionary with values as indicated // bellow. abbreviations: ( A: "A stands for alphabet", B: "B stands for bannana" ), bibfile: "bibliography.bib", // This is needed as there is no way (I know of) to dynamically find if tables/figures/equations // were used and only print the lists then. // Simply disable the ones you do not need. skip_figure_list: false, skip_table_list: false, skip_formula_list: false, ) = Introduction #lorem(60) = Methods #lorem(120) #figure(image("logo.svg"), caption: [Some image]) == Subsection #lorem(500) $ a + 10 = 10 $ = Results #lorem(60) #figure(table( columns: (auto, auto), inset: 10pt, align: horizon, [*Area*], [*Parameters*], $ pi h (D^2 - d^2) / 4 $, [ $h$: height \ $D$: outer radius \ $d$: inner radius ], ), caption: [Some result table]) = Discussion #lorem(20)