Initial commit

This commit is contained in:
Popa committed 2026-09-10 20:02:22 +02:00
commit d524878451
18 files changed
+1852

No files matched your search

+21
View File
@@ -0,0 +1,21 @@
MIT License
Copyright (c) 2026 Popa
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
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.
+21
View File
@@ -0,0 +1,21 @@
MIT License
Copyright (c) 2019 Son A. Pham <sp@sonpham.me>
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
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.
+99
View File
@@ -0,0 +1,99 @@
# Clean Sheets
Clean, modern exercise sheets for university courses. The package provides two
page layouts, an exercise overview, statement boxes, syntax-highlighted code,
and small helpers for mathematical and German-language course material.
## Quick start
Create a ready-to-edit project:
```sh
typst init @preview/clean-sheets:0.2.2
```
Or import the package in an existing document:
```typst
#import "@preview/clean-sheets:0.2.2": base-template, ex_box, qed
#show: body => base-template(
1,
[Linear Algebra I],
[Prof. Ada Example],
[Dr. Alan Assistant],
3,
([Jane Doe], [John Doe]),
[Taylor Tutor],
show-logo: false,
body,
)
= Exercise 1
#ex_box(heading: [Warm-up], points: [10 points])[
Prove that $1 + 1 = 2$.
]
The proof is immediate. #qed
```
## Templates
### `base-template`
The general exercise-sheet layout. Its required positional arguments are
`sheetnumber`, `course`, `prof`, `assistant`, `exercises`, `students`, `tutor`,
and `body`.
Optional arguments:
- `tutor-label`: custom label beside the tutor name (`none`)
- `sheet`: name displayed before the sheet number (`[Exercise Sheet]`)
- `logo`: logo content, usually `image("logo.png")` (`none`)
- `show-logo`: whether to display the provided logo (`true`)
- `page-numbering`: custom page-numbering function
- `table-header-smallcaps`: use small capitals in table headers (`false`)
- `text-font` and `math-font`: font families with portable fallbacks
- `show-end-message`: display the package credit (`false`)
- `end-message`: custom credit content
### `computer-science-template`
A denser layout with submission and test dates, optional digit grouping, and
decimal-comma formatting. Required arguments are `course`, `students`,
`semester`, `university`, `institute`, and `body`.
Optional arguments are `sheetnumber`, `subtitle`, `department`, `submit_until`,
`testats_from`, `testats_until`, `group-digits`, `decimal-comma`,
`page-numbering`, `raw-syntaxes`, `info-text`, `text-font`, `math-font`,
`table-header-smallcaps`, and `no-pagebreak`.
## Components and helpers
- `ex_box`: exercise box with optional `heading`, `points`, `color`,
`stroke-color`, `text-color`, and `radius`
- `def`, `axiom`, `satz`, `lemma`, `kor`: numbered statement boxes; each takes
a body and the optional arguments `label` and `nobreak`
- `Cal` and `Complement`: calligraphic and complement math helpers
- `chevrons`: wraps comma-separated math content in angle brackets
- `german-date-time`: formats a datetime in German
- `group-digits-text`: groups digits in a string
- `qed`: right-aligned square; `jb`: justified line break
- `smallcaps` and `upper`: tracked small-cap and uppercase helpers
See `examples/base.typ` and `examples/computer-science.typ` for complete source
examples.
## Fonts
The defaults use New Computer Modern, New Computer Modern Math, and DejaVu Sans
Mono. All three are bundled with Typst, so the template renders consistently in
the web app and on the command line. Pass `text-font` and `math-font` to either
template if you prefer locally installed fonts such as Fira Sans and Fira Math.
## License and credits
Clean Sheets is licensed under the MIT License. The bundled
`assets/OneHalfLight.tmTheme` is the MIT-licensed One Half Light theme by Son
Pham; see `LICENSE-OneHalfLight`.
+663
View File
@@ -0,0 +1,663 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
Name: One Half Light
Author: Son A. Pham <sp@sonpham.me>
Url: https://github.com/sonph/onehalf
License: The MIT License (MIT)
A light Sublime Text color scheme based on Atom's One. See
github.com/sonph/onehalf for installation instructions, a dark color scheme,
and versions for other editors/terminals such as Vim or iTerm.
Red: #e45649
Green: #50a14f
Yellow: #c18401
Blue: #0184bc
Purple: #a626a4
Cyan: #0997b3
White: #fafafa
Black: #383a42
Fg: #383a42
Bg: #fafafa
Comment: #a0a1a7
Gutter foreground: #d4d4d4
Gutter background: #fafafa
Selection: #bfceff
-->
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>name</key>
<string>OneHalfLight</string>
<key>semanticClass</key>
<string>theme.light.one_half_light</string>
<key>uuid</key>
<string></string>
<key>colorSpaceName</key>
<string>sRGB</string>
<key>author</key>
<string>Son A. Pham &lt;sp@sonpham.me&gt;</string>
<key>comment</key>
<string>A light iTerm color scheme based on Atom&apos;s One. See github.com&#x2f;sonph&#x2f;onehalf for installation instructions, a dark color scheme, and versions for other editors&#x2f;terminals such as (Neo)Vim and Sublime Text.</string>
<key>settings</key>
<array>
<dict>
<key>settings</key>
<dict>
<key>fontStyle</key>
<string></string>
<key>foreground</key>
<string>#383a42</string>
<key>background</key>
<string>#fafafa</string>
<key>bracketsOptions</key>
<string>underline</string>
<key>caret</key>
<string>#383a42</string>
<key>gutter</key>
<string>#fafafa</string>
<key>gutterForeground</key>
<string>#d4d4d4</string>
<key>invisibles</key>
<string>#a0a1a7</string>
<key>lineHighlight</key>
<string>#f0f0f0</string>
<key>selection</key>
<string>#bfceff</string>
<key>selectionBorder</key>
<string>#bfceff</string>
<key>tagsForeground</key>
<string></string>
<key>tagsOptions</key>
<string>stippled_underline</string>
<key>bracketContentsOptions</key>
<string>underline</string>
</dict>
</dict>
<dict>
<key>name</key>
<string>Comments</string>
<key>scope</key>
<string>comment</string>
<key>settings</key>
<dict>
<key>foreground</key>
<string>#a0a1a7</string>
</dict>
</dict>
<dict>
<key>name</key>
<string>Text</string>
<key>scope</key>
<string>variable.parameter.function</string>
<key>settings</key>
<dict>
<key>foreground</key>
<string>#383a42</string>
</dict>
</dict>
<dict>
<key>name</key>
<string>Delimiters</string>
<key>scope</key>
<string>none</string>
<key>settings</key>
<dict>
<key>foreground</key>
<string></string>
</dict>
</dict>
<dict>
<key>name</key>
<string>Operators</string>
<key>scope</key>
<string>keyword.operator</string>
<key>settings</key>
<dict>
<key>foreground</key>
<string></string>
</dict>
</dict>
<dict>
<key>name</key>
<string>Keywords</string>
<key>scope</key>
<string>keyword</string>
<key>settings</key>
<dict>
<key>foreground</key>
<string>#a626a4</string>
</dict>
</dict>
<dict>
<key>name</key>
<string>Variables</string>
<key>scope</key>
<string>variable</string>
<key>settings</key>
<dict>
<key>foreground</key>
<string>#e45649</string>
</dict>
</dict>
<dict>
<key>name</key>
<string>Functions</string>
<key>scope</key>
<string>entity.name.function, meta.require, support.function.any-method</string>
<key>settings</key>
<dict>
<key>foreground</key>
<string>#0184bc</string>
</dict>
</dict>
<dict>
<key>name</key>
<string>Classes</string>
<key>scope</key>
<string>support.class, entity.name.class, entity.name.type.class</string>
<key>settings</key>
<dict>
<key>foreground</key>
<string>#c18401</string>
</dict>
</dict>
<dict>
<key>name</key>
<string>Classes</string>
<key>scope</key>
<string>meta.class</string>
<key>settings</key>
<dict>
<key>foreground</key>
<string>#c18401</string>
</dict>
</dict>
<dict>
<key>name</key>
<string>Methods</string>
<key>scope</key>
<string>keyword.other.special-method</string>
<key>settings</key>
<dict>
<key>foreground</key>
<string>#0184bc</string>
</dict>
</dict>
<dict>
<key>name</key>
<string>Storage</string>
<key>scope</key>
<string>storage</string>
<key>settings</key>
<dict>
<key>foreground</key>
<string>#a626a4</string>
</dict>
</dict>
<dict>
<key>name</key>
<string>Support</string>
<key>scope</key>
<string>support.function</string>
<key>settings</key>
<dict>
<key>foreground</key>
<string>#0184bc</string>
</dict>
</dict>
<dict>
<key>name</key>
<string>Strings, Inherited Class</string>
<key>scope</key>
<string>string</string>
<key>settings</key>
<dict>
<key>foreground</key>
<string>#50a14f</string>
</dict>
</dict>
<dict>
<key>name</key>
<string>Integers</string>
<key>scope</key>
<string>constant.numeric</string>
<key>settings</key>
<dict>
<key>foreground</key>
<string>#c18401</string>
</dict>
</dict>
<dict>
<key>name</key>
<string>Floats</string>
<key>scope</key>
<string>none</string>
<key>settings</key>
<dict>
<key>foreground</key>
<string>#c18401</string>
</dict>
</dict>
<dict>
<key>name</key>
<string>Boolean</string>
<key>scope</key>
<string>none</string>
<key>settings</key>
<dict>
<key>foreground</key>
<string>#c18401</string>
</dict>
</dict>
<dict>
<key>name</key>
<string>Constants</string>
<key>scope</key>
<string>constant</string>
<key>settings</key>
<dict>
<key>foreground</key>
<string>#c18401</string>
</dict>
</dict>
<dict>
<key>name</key>
<string>HTML: Tags</string>
<key>scope</key>
<string>entity.name.tag</string>
<key>settings</key>
<dict>
<key>foreground</key>
<string>#e45649</string>
</dict>
</dict>
<dict>
<key>name</key>
<string>HTML: Tag attributes</string>
<key>scope</key>
<string>entity.other.attribute-name</string>
<key>settings</key>
<dict>
<key>foreground</key>
<string>#c18401</string>
</dict>
</dict>
<dict>
<key>name</key>
<string>Attribute IDs</string>
<key>scope</key>
<string>entity.other.attribute-name.id, punctuation.definition.entity</string>
<key>settings</key>
<dict>
<key>foreground</key>
<string>#c18401</string>
</dict>
</dict>
<dict>
<key>name</key>
<string>Selector</string>
<key>scope</key>
<string>meta.selector</string>
<key>settings</key>
<dict>
<key>foreground</key>
<string>#a626a4</string>
</dict>
</dict>
<dict>
<key>name</key>
<string>Markdown: Headings</string>
<key>scope</key>
<string>markup.heading punctuation.definition.heading, entity.name.section</string>
<key>settings</key>
<dict>
<key>fontStyle</key>
<string></string>
<key>foreground</key>
<string>#0184bc</string>
</dict>
</dict>
<dict>
<key>name</key>
<string>Markdown: Bold</string>
<key>scope</key>
<string>markup.bold, punctuation.definition.bold</string>
<key>settings</key>
<dict>
<key>foreground</key>
<string>#a626a4</string>
</dict>
</dict>
<dict>
<key>name</key>
<string>Markdown: Italic</string>
<key>scope</key>
<string>markup.italic, punctuation.definition.italic</string>
<key>settings</key>
<dict>
<key>foreground</key>
<string>#a626a4</string>
</dict>
</dict>
<dict>
<key>name</key>
<string>Markdown: Code</string>
<key>scope</key>
<string>markup.raw.inline</string>
<key>settings</key>
<dict>
<key>foreground</key>
<string>#50a14f</string>
</dict>
</dict>
<dict>
<key>name</key>
<string>Markdown: Link Text</string>
<key>scope</key>
<string>string.other.link, punctuation.definition.string.end.markdown</string>
<key>settings</key>
<dict>
<key>foreground</key>
<string></string>
</dict>
</dict>
<dict>
<key>name</key>
<string>Markdown: Link Url</string>
<key>scope</key>
<string>meta.link</string>
<key>settings</key>
<dict>
<key>foreground</key>
<string>#50a14f</string>
</dict>
</dict>
<dict>
<key>name</key>
<string>Markdown: Lists</string>
<key>scope</key>
<string>markup.list</string>
<key>settings</key>
<dict>
<key>foreground</key>
<string></string>
</dict>
</dict>
<dict>
<key>name</key>
<string>Markdown: Quotes</string>
<key>scope</key>
<string>markup.quote</string>
<key>settings</key>
<dict>
<key>foreground</key>
<string>#50a14f</string>
</dict>
</dict>
<dict>
<key>name</key>
<string>Java Source</string>
<key>scope</key>
<string>source.java meta.class.java meta.method.java</string>
<key>settings</key>
<dict>
<key>foreground</key>
<string>#383a42</string>
</dict>
</dict>
<dict>
<key>name</key>
<string>Java Class Body</string>
<key>scope</key>
<string>source.java meta.class.java meta.class.body.java</string>
<key>settings</key>
<dict>
<key>foreground</key>
<string>#383a42</string>
</dict>
</dict>
<dict>
<key>name</key>
<string>Javascript: Function Arguments</string>
<key>scope</key>
<string>source.js meta.function.js variable.parameter.function.js</string>
<key>settings</key>
<dict>
<key>foreground</key>
<string>#e45649</string>
</dict>
</dict>
<dict>
<key>name</key>
<string>Javascript: New Variables</string>
<key>scope</key>
<string>source.js variable.other.readwrite.js</string>
<key>settings</key>
<dict>
<key>foreground</key>
<string>#e45649</string>
</dict>
</dict>
<dict>
<key>name</key>
<string>Javascript: Variables</string>
<key>scope</key>
<string>source.js variable.other.object.js</string>
<key>settings</key>
<dict>
<key>foreground</key>
<string>#383a42</string>
</dict>
</dict>
<dict>
<key>name</key>
<string>Javascript: Variables in Function Calls</string>
<key>scope</key>
<string>source.js meta.function-call.method.js variable.other.readwrite.js</string>
<key>settings</key>
<dict>
<key>foreground</key>
<string>#e45649</string>
</dict>
</dict>
<dict>
<key>name</key>
<string>Javascript: New Block Variables</string>
<key>scope</key>
<string>source.js meta.block.js variable.other.readwrite.js</string>
<key>settings</key>
<dict>
<key>foreground</key>
<string>#e45649</string>
</dict>
</dict>
<dict>
<key>name</key>
<string>Javascript: Block Variables</string>
<key>scope</key>
<string>source.js meta.block.js variable.other.object.js</string>
<key>settings</key>
<dict>
<key>foreground</key>
<string>#383a42</string>
</dict>
</dict>
<dict>
<key>name</key>
<string>Javascript: Block Variables in Function Calls</string>
<key>scope</key>
<string>source.js meta.block.js meta.function-call.method.js variable.other.readwrite.js</string>
<key>settings</key>
<dict>
<key>foreground</key>
<string>#383a42</string>
</dict>
</dict>
<dict>
<key>name</key>
<string>Javascript: Function Calls</string>
<key>scope</key>
<string>source.js meta.function-call.method.js variable.function.js</string>
<key>settings</key>
<dict>
<key>foreground</key>
<string>#383a42</string>
</dict>
</dict>
<dict>
<key>name</key>
<string>Javascript: Properties</string>
<key>scope</key>
<string>source.js meta.property.object.js entity.name.function.js</string>
<key>settings</key>
<dict>
<key>foreground</key>
<string>#0184bc</string>
</dict>
</dict>
<dict>
<key>name</key>
<string>Javascript: Prototypes</string>
<key>scope</key>
<string>source.js support.constant.prototype.js</string>
<key>settings</key>
<dict>
<key>foreground</key>
<string>#383a42</string>
</dict>
</dict>
<dict>
<key>name</key>
<string>Separator</string>
<key>scope</key>
<string>meta.separator</string>
<key>settings</key>
<dict>
<key>background</key>
<string></string>
<key>foreground</key>
<string></string>
</dict>
</dict>
<dict>
<key>name</key>
<string>Inserted</string>
<key>scope</key>
<string>markup.inserted</string>
<key>settings</key>
<dict>
<key>foreground</key>
<string>#98c379</string>
</dict>
</dict>
<dict>
<key>name</key>
<string>Deleted</string>
<key>scope</key>
<string>markup.deleted</string>
<key>settings</key>
<dict>
<key>foreground</key>
<string>#e06c75</string>
</dict>
</dict>
<dict>
<key>name</key>
<string>Changed</string>
<key>scope</key>
<string>markup.changed</string>
<key>settings</key>
<dict>
<key>foreground</key>
<string>#e5c07b</string>
</dict>
</dict>
<dict>
<key>name</key>
<string>Regular Expressions</string>
<key>scope</key>
<string>string.regexp</string>
<key>settings</key>
<dict>
<key>foreground</key>
<string>#50a14f</string>
</dict>
</dict>
<dict>
<key>name</key>
<string>Escape Characters</string>
<key>scope</key>
<string>constant.character.escape</string>
<key>settings</key>
<dict>
<key>foreground</key>
<string>#0997b3</string>
</dict>
</dict>
<dict>
<key>name</key>
<string>Embedded</string>
<key>scope</key>
<string>punctuation.section.embedded, variable.interpolation</string>
<key>settings</key>
<dict>
<key>foreground</key>
<string></string>
</dict>
</dict>
<dict>
<key>name</key>
<string>Illegal</string>
<key>scope</key>
<string>invalid.illegal</string>
<key>settings</key>
<dict>
<key>background</key>
<string>#e06c75</string>
<key>foreground</key>
<string>#fafafa</string>
</dict>
</dict>
<dict>
<key>name</key>
<string>Broken</string>
<key>scope</key>
<string>invalid.broken</string>
<key>settings</key>
<dict>
<key>background</key>
<string>#e5c07b</string>
<key>foreground</key>
<string>#fafafa</string>
</dict>
</dict>
<dict>
<key>name</key>
<string>Deprecated</string>
<key>scope</key>
<string>invalid.deprecated</string>
<key>settings</key>
<dict>
<key>background</key>
<string>#e5c07b</string>
<key>foreground</key>
<string>#fafafa</string>
</dict>
</dict>
<dict>
<key>name</key>
<string>Unimplemented</string>
<key>scope</key>
<string>invalid.unimplemented</string>
<key>settings</key>
<dict>
<key>background</key>
<string>#c678dd</string>
<key>foreground</key>
<string>#fafafa</string>
</dict>
</dict>
</array>
</dict>
</plist>
+131
View File
@@ -0,0 +1,131 @@
%YAML 1.2
---
name: Pseudocode
file_extensions:
- psd
- pseudo
- pseudocode
scope: source.pseudocode
version: 2
variables:
control_keywords: '\b(?i:(IF|THEN|ELSE|END_IF|WHILE|DO|END_WHILE|END_DO|FOR|FROM|TO|DOWNTO|BEGIN|END|IN|RETURN|BREAK|CONTINUE|EXIT))\b'
declaration_keywords: '\b(?i:(GLOBAL|DEF|PROCEDURE|PROCESS|RETURNS))\b'
io_keywords: '\b(?i:(INPUT|OUTPUT|REGISTER|READ|KEYWORD|ARGUMENT|PRINT|PRINTS))\b'
logical_keywords: '\b(?i:(AND|OR))\b'
boolean_keywords: '\b(?i:(TRUE|FALSE))\b'
builtin_keywords: '\b(?i:(LEN|LENGTH|MIN|MAX|ABS|ROUND))\b'
basic_types: '\b(?i:(INT|STRING|BOOL|BOOLEAN|FLOAT|DOUBLE|CHAR|VOID|LIST|ARRAY|DICT|DICTIONARY|SET|MAP|TUPLE|STACK|QUEUE|MUTEX))\b'
number: '\b\d+(?:\.\d+)?\b'
identifier: '[A-Za-z_][A-Za-z0-9_]*'
contexts:
prototype:
- include: at_escape
main:
- include: comments
- include: strings
- include: math_inline
- include: function_definitions
- include: keywords
- include: operators
- include: function_calls
- include: numbers
function_definitions:
- match: '(?i)\b(DEF|PROCEDURE)\b(\s+)({{identifier}})(\s*)(\()'
captures:
1: storage.type.function.pseudocode
2: text.whitespace
3: entity.name.function.pseudocode
4: text.whitespace
5: punctuation.section.group.begin.pseudocode
function_calls:
- match: '\b(?i:(LEN|MIN))\b(?=\s*\()'
scope: support.function.builtin.pseudocode
- match: '\b{{identifier}}\b(?=\s*\()'
scope: variable.function.pseudocode
keywords:
- match: '{{basic_types}}'
scope: storage.type.pseudocode
- match: '{{logical_keywords}}'
scope: keyword.operator.logical.pseudocode
- match: '{{boolean_keywords}}'
scope: constant.language.boolean.pseudocode
- match: '{{builtin_keywords}}'
scope: support.function.builtin.pseudocode
- match: '{{declaration_keywords}}'
scope: storage.type.function.pseudocode
- match: '{{io_keywords}}'
scope: support.function.builtin.pseudocode
- match: '{{control_keywords}}'
scope: keyword.control.pseudocode
operators:
- match: '(?:<<=|>>=|\+=|-=|\*=|/=|%=|&=|\|=|\^=|\+\+|--)'
scope: keyword.operator.assignment.pseudocode
- match: '=(?!=)'
scope: keyword.operator.assignment.pseudocode
- match: '(?:<=|<|>=|>|===|!==|==|!=)'
scope: keyword.operator.comparison.pseudocode
numbers:
- match: '{{number}}'
scope: constant.numeric.pseudocode
comments:
- match: '(?:\/\/|\#|\-\-|\;|REM\b)'
scope: punctuation.definition.comment.pseudocode
push: line_comment
- match: '/\*'
scope: punctuation.definition.comment.begin.pseudocode
push: block_comment
line_comment:
- meta_scope: comment.line.double-slash.pseudocode
- match: '$'
pop: true
block_comment:
- meta_scope: comment.block.pseudocode
- match: '\*/'
scope: punctuation.definition.comment.end.pseudocode
pop: true
strings:
- match: '"'
scope: punctuation.definition.string.begin.pseudocode
push: double_quoted_string
double_quoted_string:
- meta_content_scope: string.quoted.double.pseudocode
- match: '\\.'
scope: constant.character.escape.pseudocode
- match: '"'
scope: punctuation.definition.string.end.pseudocode
pop: true
at_escape:
- match: '@'
scope: punctuation.section.embedded.begin.pseudocode
push: escaped_region
escaped_region:
- meta_content_scope: meta.embedded.escape.pseudocode
- match: '@'
scope: punctuation.section.embedded.end.pseudocode
pop: true
math_inline:
- match: '\$'
scope: punctuation.section.embedded.begin.pseudocode
push: math_inline_body
math_inline_body:
- meta_content_scope: meta.embedded.math.pseudocode
- match: '\$'
scope: punctuation.section.embedded.end.pseudocode
pop: true
+103
View File
@@ -0,0 +1,103 @@
#import "@preview/clean-sheets:0.2.2": Cal, base-template, ex_box, qed
#show: body => base-template(
1,
[Linear Algebra I],
[Prof. Dr. Daniel Docent],
[Dr. Anne Assistant],
4,
([Jane Doe], [Joe Shmoe]),
[John Q. Public],
show-logo: false,
show-end-message: true,
body,
)
= Exercise 1
#ex_box(
heading: [#lorem(5)],
points: [$5 + 10 + 5$ Points],
)[
#lorem(30)
+ #lorem(10)
+ #lorem(15)
- #lorem(10)
- #lorem(12)
+ #lorem(8)
#lorem(40)
]
#lorem(59)#footnote[#lorem(21)]
$
(a + b)^n = sum_(k = 0)^n binom(n, k) space.thin a^(n - k) b^k
$
#lorem(30) #qed
= Exercise 2
#ex_box(points: [$25$ Points])[
#lorem(41)
#lorem(26)
]
#lorem(17) $-pi/2 < arctan(x) := integral_0^x (dif t) / (1 + t^2) < pi/2 space forall x in RR$. #lorem(24)
$
V(x_1, ..., x_n) := mat(
1, x_1, x_1^2, dots.c, x_1^(n-1);
1, x_2, x_2^2, dots.c, x_2^(n-1);
1, x_3, x_3^2, dots.c, x_3^(n-1);
dots.v, dots.v, dots.v, dots.down, dots.v;
1, x_n, x_n^2, dots.c, x_n^(n-1)
)
$
#lorem(20)
$
det V(x_1, ..., x_n) = product_(1 <= i < j <= n)(x_j - x_i)
$
#lorem(60)#footnote[#lorem(31)]#footnote[#lorem(13)] #qed
#lorem(30) #qed
= Exercise 3
#ex_box(heading: [#lorem(8)])[
#lorem(20)
#lorem(30)
]
```js
#!/usr/bin/env node
/* block comment */ // line comment
const π = 0xFF + 0b1010 + 0o755 + 1_000 + 1.2e-3, nil = null, nope = undefined;
let str = "double\n\"quote\"", s = 'single\'quote', tpl = `template ${π ?? 42} \`tick\``;
const re = /(?<=foo)[a-z\d_-]+?(?=bar)/giu;
const obj = { key: true, ["computed-"+π]: false, nested: { ...{x: 1} } };
const fn = async (x = 0) => x?.foo?.(π) ?? (() => { throw new Error("💥"); })();
class Ω extends Array { #private = 1; static get x() { return this?.name; } }
if (π >= 0 && π !== Infinity || !NaN) for (const [k,v] of Object.entries(obj)) console.log(k, v);
try { await Promise.resolve(fn?.({foo:n=>n**2})); } catch (e) { console.error(`${e}`); }
```
$
bold("B")(P) =
mu_0 / (4 pi)
integral
(I times bold(hat("r"))) / r^2 dif bold(l)
= (mu_0 I) / (4 pi)
integral
(dif bold(l) times bold(hat("r"))) / r^2
$
#lorem(30) #qed
+47
View File
@@ -0,0 +1,47 @@
#import "@preview/clean-sheets:0.2.2": Cal, chevrons, computer-science-template, def, ex_box, qed, satz
#show: body => computer-science-template(
[Exemplarische Grundlagen I],
(
([Max Mustermann], [1234567]),
([Erika Musterfrau], [7654321]),
),
[Wintersemester 2025/26],
[Beispiel-Universität Musterstadt],
[Institut für Exemplarisches],
sheetnumber: 1,
subtitle: lorem(5),
department: [Abteilung Beispiel],
submit_until: datetime(day: 1, month: 1, year: 2026, hour: 14, minute: 0, second: 0),
testats_from: datetime(day: 1, month: 1, year: 2026, hour: 18, minute: 0, second: 0),
testats_until: datetime(day: 8, month: 1, year: 2026, hour: 10, minute: 0, second: 0),
group-digits: true,
decimal-comma: true,
body,
)
= Aufgabe 1
#ex_box(
heading: [Aufgabe 1],
points: [10 Punkte],
)[
Zeigen Sie eine einfache Aussage über Listen.
]
```pseudo
DEF magic_recursive(string s, string p):
IF len(p) == 0 THEN return TRUE
IF len(s) == 0 OR p[0] != s[0] THEN return FALSE
return magic_recursive(s[1:], p[1:])
```
#table(
columns: 6,
[Heading 1], [Heading 2], [Heading 3], [Heading 4], [Heading 5], [Heading 6],
[Cell 1], [Cell 2], [Cell 3], [Cell 4], [Cell 5], [Cell 6],
[Cell 7], [Cell 8], [Cell 9], [Cell 10], [Cell 11], [Cell 12],
)
+6
View File
@@ -0,0 +1,6 @@
#import "src/templates/base.typ": base-template
#import "src/templates/computer-science.typ": computer-science-template
#import "src/helpers.typ": Cal, Complement, chevrons, german-date-time, group-digits-text, jb, qed
#import "src/components/boxes.typ": axiom, def, ex_box, kor, lemma, satz
#import "src/theme.typ": smallcaps, upper
+144
View File
@@ -0,0 +1,144 @@
#import "../theme.typ": colors, statement-colors
#let _box(header, body, color) = block(
inset: 12pt,
radius: 3pt,
width: 100%,
fill: rgb(..color, 10),
stroke: (
left: (paint: rgb(..color), thickness: 2pt),
rest: (paint: rgb(..color, 155), thickness: 0.6pt),
),
breakable: false,
[
#text(rgb(..color))[#header] #body
],
)
#let _stmt(kind, body, color, label: [], nobreak: false) = context {
let h = counter(heading).get()
let x = if h.len() >= 1 { h.at(0) } else { 0 }
let y = if h.len() >= 2 { h.at(1) } else { 0 }
let statement = counter(
"statement-" + str(x) + "-" + str(y),
)
let lbl = if label != [] { [ (#label)] } else { [] }
let brk = if nobreak { "" } else { [\ ] }
[
#statement.step()
#context {
let mark = statement.display(
z => numbering("1.1.1", x, y, z),
)
_box(
[*#kind #mark*#lbl*.* #brk],
body,
color,
)
}
]
}
#let def(body, label: [], nobreak: false) = _stmt(
"Definition",
body,
statement-colors.definition,
label: label,
nobreak: nobreak,
)
#let axiom(body, label: [], nobreak: false) = _stmt(
"Axiom",
body,
statement-colors.axiom,
label: label,
nobreak: nobreak,
)
#let satz(body, label: [], nobreak: false) = _stmt(
"Satz",
body,
statement-colors.theorem,
label: label,
nobreak: nobreak,
)
#let lemma(body, label: [], nobreak: false) = _stmt(
"Lemma",
body,
statement-colors.lemma,
label: label,
nobreak: nobreak,
)
#let kor(body, label: [], nobreak: false) = _stmt(
"Korollar",
body,
statement-colors.corollary,
label: label,
nobreak: nobreak,
)
#let ex_box(
body,
heading: [],
points: [],
color: colors.accent,
stroke-color: colors.stroke,
text-color: colors.text,
radius: 5pt,
) = context {
let background = color.lighten(95%)
let label-box = content => block(
fill: white,
stroke: stroke-color + 0.4pt,
radius: radius * 0.75,
inset: 5pt,
text(text-color, content),
)
let head = if heading != [] or points != [] {
if heading != [] {
let b = label-box(heading)
place(dy: -measure(b).height / 2 - 12pt, b)
}
if points != [] {
let b = label-box(points)
place(
dy: -measure(b).height / 2 - 12pt,
box(width: 100%, align(right)[#b]),
)
}
v(0.5em)
} else { [] }
if head != [] { v(1em) }
block(
fill: background,
stroke: (
left: color + 1.7pt,
top: stroke-color + 0.4pt,
right: stroke-color + 0.6pt,
bottom: stroke-color + 0.6pt,
),
width: 100%,
radius: radius,
inset: 12pt,
above: 12pt,
below: 18pt,
[
#set enum(numbering: "(i)")
#head
#body
],
)
}
+49
View File
@@ -0,0 +1,49 @@
#let _student-names(students) = {
if type(students) == str {
students
} else {
students.join(", ")
}
}
#let exercise-overview(exercises, students, tutor, col: black, border: gray, tutor-label: none) = {
let text-color = col.darken(25%)
let _s = 0.4pt + border
set par(justify: false)
grid(
columns: (1fr, 1fr),
column-gutter: 1em,
stroke: (bottom: 0.5pt + text-color),
inset: (y: 0.75em),
align: bottom,
grid(
columns: 2,
column-gutter: 1em,
text(fill: text-color)[Name:], _student-names(students),
),
grid(
columns: 2,
column-gutter: 1em,
text(fill: text-color)[#if tutor-label != none { tutor-label } else { [Tutor:] }], tutor,
),
)
let ex_cells = ()
for i in range(1, exercises + 1) {
ex_cells += (table.cell(stroke: (right: _s, bottom: _s))[A#i],)
}
v(0.75cm)
set text(fill: text-color)
table(
columns: (1fr,) * (exercises + 1),
align: center,
stroke: none,
..ex_cells,
table.cell(stroke: (bottom: _s))[$Sigma$],
..(table.cell(stroke: (right: _s), inset: (y: 0.75em))[],) * exercises,
)
}
+20
View File
@@ -0,0 +1,20 @@
#let custom-raw-syntaxes = (
"../../assets/syntaxes/Pseudo.sublime-syntax",
)
#let weekdays-short-de = ("Mo", "Di", "Mi", "Do", "Fr", "Sa", "So")
#let months-de = (
"Januar",
"Februar",
"März",
"April",
"Mai",
"Juni",
"Juli",
"August",
"September",
"Oktober",
"November",
"Dezember",
)
+68
View File
@@ -0,0 +1,68 @@
#import "config.typ": months-de, weekdays-short-de
#import "theme.typ": fonts
#let Cal(body) = math.class(
"normal",
text(font: fonts.cmu-math, math.cal(body)),
)
#let Complement = math.class(
"normal",
text(font: fonts.cmu-math, math.complement),
)
#let qed = [#h(1fr) $square$]
#let jb = linebreak(justify: true)
#let chevrons(..children) = {
let body = children.pos().join(", ")
math.lr([$chevron.l #body chevron.r$])
}
#let german-date-time(value) = [#{ weekdays-short-de.at(int(value.display("[weekday repr:monday]")) - 1) }.,
#{ value.day() }. #{ months-de.at(int(value.display("[month]")) - 1) },
#value.display("[hour]") Uhr]
#let group-digits-text(value, sep: sym.space.nobreak.narrow) = {
let chars = value.clusters()
let n = chars.len()
for (i, ch) in chars.enumerate() {
if i > 0 and calc.rem(n - i, 3) == 0 {
sep
}
ch
}
}
#let content-to-string(content) = {
if type(content) == str {
content
} else if content.has("text") {
if type(content.text) == str {
content.text
} else {
content-to-string(content.text)
}
} else if content.has("children") {
content.children.map(content-to-string).join("")
} else if content.has("body") {
content-to-string(content.body)
} else if content == [] {
" "
}
}
#let render-footnote-entry(entry, numbering-pattern: "[1]") = {
let loc = entry.note.location()
let mark = numbering(numbering-pattern + ":", ..counter(footnote).at(loc))
pad(left: entry.indent)[
#grid(
columns: (auto, 1fr),
gutter: 0.3em,
mark,
entry.note.body,
)
]
}
+143
View File
@@ -0,0 +1,143 @@
#import "../config.typ": custom-raw-syntaxes
#import "../helpers.typ": content-to-string, render-footnote-entry
#import "../theme.typ": base-theme, code-theme, colors, common-theme, end-message, smallcaps
#import "../components/student-table.typ": exercise-overview
/// Base template for exercise sheets.
#let base-template(
sheetnumber,
course,
prof,
assistant,
exercises,
students,
tutor,
tutor-label: none,
sheet: [Exercise Sheet],
logo: none,
show-logo: true,
page-numbering: common-theme.page-numbering,
table-header-smallcaps: false,
text-font: base-theme.text-font,
math-font: base-theme.math-font,
show-end-message: false,
end-message: end-message,
body,
) = {
assert.eq(type(exercises), int, message: "exercises must be an integer")
assert(exercises > 0, message: "exercises must be a positive integer")
let ttl = sheet + if { sheetnumber < 10 } { " 0" } else { " " } + str(sheetnumber)
set document(
title: ttl,
description: course,
author: students.map(content-to-string),
date: datetime.today(),
)
let font-size = base-theme.font-size
set page(
numbering: page-numbering,
header: context {
if counter(page).get().first() > 1 [
#set text(base-theme.header-size, weight: 450)
#grid(
columns: (2fr, 1fr, 2fr),
align: (start, center, end),
course, text(fill: colors.text)[#ttl], (prof, assistant).join([#h(0.25em)·#h(0.25em)]),
)
#line(length: 100%, stroke: 0.4pt + colors.stroke)
]
},
)
set par(..common-theme.paragraph)
set text(font: text-font, size: font-size, lang: common-theme.lang)
show math.equation: set text(font: math-font)
show heading.where(level: 1): set text(..base-theme.heading-1)
show heading.where(level: 2): set text(..base-theme.heading-2)
show heading: set text(fill: colors.text)
let first-h1 = state("first-h1", true)
show heading.where(level: 1): it => {
if first-h1.get() {
first-h1.update(false)
} else {
// pagebreak(weak: true)
}
v(0.3em)
it
v(-0.9em)
line(length: 100%, stroke: 0.4pt + colors.stroke)
v(0.3em)
}
set footnote(numbering: common-theme.footnote.numbering.note)
set footnote.entry(
indent: common-theme.footnote.indent,
separator: line(length: 30% + 0pt, stroke: 0.4pt + colors.text),
)
show footnote.entry: it => render-footnote-entry(
it,
numbering-pattern: common-theme.footnote.numbering.text,
)
set raw(syntaxes: custom-raw-syntaxes, tab-size: code-theme.tab-size, theme: code-theme.theme)
show raw: set text(
font: code-theme.font,
features: code-theme.features,
size: font-size - code-theme.size-offset,
)
show raw.where(block: true): box.with(..base-theme.raw-block)
show raw.where(block: false): box.with(..code-theme.inline)
let logo-content = if not show-logo or logo == none {
[]
} else {
logo
}
show title: set text(fill: colors.text, weight: base-theme.title-weight)
[
#grid(
columns: (6fr, 1fr),
align: (start + horizon, end + horizon),
row-gutter: 0.25cm,
[
#title[#sheet #if sheetnumber < 10 { "0" };#sheetnumber]
],
logo-content,
grid.cell(
colspan: 2,
align: center,
stroke: (y: 0.4pt + colors.stroke),
inset: (y: 0.5cm),
)[*#course* \ #(prof, assistant).join([#h(0.5em)·#h(0.5em)])],
)
#exercise-overview(exercises, students, tutor, col: colors.accent, border: colors.stroke, tutor-label: tutor-label)
]
show figure.where(kind: table): set block(breakable: true)
set table(..common-theme.table)
show table.cell.where(y: 0): it => if table-header-smallcaps { smallcaps(it) } else { it }
body
if show-end-message {
v(1fr)
set text(size: 10pt)
align(center)[#end-message]
}
}
+153
View File
@@ -0,0 +1,153 @@
#import "../config.typ": custom-raw-syntaxes
#import "../theme.typ": code-theme, common-theme, computer-science-theme, smallcaps
#import "../helpers.typ": german-date-time, group-digits-text, render-footnote-entry
/// Computer science exercise sheet template.
#let computer-science-template(
sheetnumber: 0,
subtitle: none,
course,
students,
semester,
university,
institute,
department: none,
submit_until: none,
testats_from: none,
testats_until: none,
group-digits: false,
decimal-comma: false,
page-numbering: common-theme.page-numbering,
raw-syntaxes: custom-raw-syntaxes,
info-text: none,
text-font: computer-science-theme.text-font,
math-font: computer-science-theme.math-font,
table-header-smallcaps: false,
no-pagebreak: false,
body,
) = {
let font-size = computer-science-theme.font-size
set page(
header: context {
if counter(page).get().first() > 1 [
#set text(computer-science-theme.header-size)
#grid(
columns: (3fr, 2fr, 3fr),
align(start)[_#course _],
align(center)[*Übungsblatt #sheetnumber*],
align(end)[#students.map(((name, matrNr)) => name).join(", ")],
)
#line(length: 100%, stroke: 0.4pt + computer-science-theme.divider)
]
},
numbering: page-numbering,
)
set par(..common-theme.paragraph)
set text(font: text-font, size: font-size, lang: common-theme.lang)
show math.equation: set text(font: math-font)
let first-h1 = state("first-h1", true)
show heading.where(level: 1): it => {
if first-h1.get() {
first-h1.update(false)
} else {
if (not no-pagebreak) {
pagebreak(weak: true)
}
}
it
}
set footnote(numbering: common-theme.footnote.numbering.note)
set footnote.entry(indent: common-theme.footnote.indent)
show footnote.entry: it => render-footnote-entry(
it,
numbering-pattern: common-theme.footnote.numbering.text,
)
set raw(syntaxes: raw-syntaxes, tab-size: code-theme.tab-size, theme: code-theme.theme)
show raw: set text(
font: code-theme.font,
features: code-theme.features,
size: font-size - code-theme.size-offset,
)
show raw.where(block: true): box.with(..computer-science-theme.raw-block)
show raw.where(block: false): box.with(..code-theme.inline)
show figure.where(kind: table): set block(breakable: true)
set table(..common-theme.table)
show table.cell.where(y: 0): it => if table-header-smallcaps { smallcaps(it) } else { it }
show math.equation: it => {
show regex("\\d+\\.\\d+"): it => if decimal-comma {
show ".": { "," + h(0pt) }
it
} else { it }
it
}
let digit-grouping = state("digit-grouping", group-digits)
let no-digit-grouping(body) = context {
let was-enabled = digit-grouping.get()
digit-grouping.update(false)
body
digit-grouping.update(was-enabled)
}
show regex("\\b\\d{4,}\\b"): it => context {
if digit-grouping.get() {
group-digits-text(it.text)
} else {
it
}
}
[
#grid(
columns: (1fr, 1fr),
align(start)[
*#course* \
#students.map(((name, matrNr)) => [#name (#no-digit-grouping[#matrNr])]).join(linebreak())
],
align(horizon + right)[
*#no-digit-grouping[#semester]* \
#university \
#institute \
#if department != none [#department]
],
)
#v(0.2cm)
#line(length: 100%, stroke: 0.4pt + computer-science-theme.divider)
#v(0.3cm)
#align(center)[
#title[Bearbeitung des #sheetnumber. Übungsblatts]
#if subtitle != none [== #subtitle #v(1em)]
]
]
v(2em)
[
#if submit_until != none [
*Abgabe bis #german-date-time(submit_until);.*
]
#if testats_from != none and testats_until != none [
*Testate vom #german-date-time(testats_from) bis #german-date-time(testats_until).*
]
#if info-text != none [#info-text]
]
body
}
+111
View File
@@ -0,0 +1,111 @@
#let std-smallcaps = smallcaps
#let std-upper = upper
#let smallcaps(body, std: false) = if (std) { std-smallcaps(body) } else { std-smallcaps(text(tracking: 0.6pt, body)) }
#let upper(body) = std-upper(text(tracking: 0.6pt, body))
#let colors = (
accent: eastern,
text: eastern.darken(25%),
stroke: eastern.lighten(50%),
code-border: gray,
code-inline-border: rgb("CCCCCC"),
code-block-fill: luma(98.75%),
code-inline-fill: luma(96%),
)
#let fonts = (
base: "New Computer Modern",
base-math: "New Computer Modern Math",
cmu: "New Computer Modern",
cmu-math: "New Computer Modern Math",
code: "DejaVu Sans Mono",
)
#let code-text-features = (
calt: 1,
cv02: 1, // g
cv04: 1, // i
cv06: 1,
cv08: 1, // l
cv16: 1,
ss01: 1, // r
ss02: 1, // >=
ss03: 1,
ss04: 1,
ss05: 1,
ss06: 1,
ss08: 1,
zero: 1, // 0
)
#let default-page-numbering = (..nums) => [
#set text(size: 10pt)
*#nums.at(0)* / #nums.at(-1)
]
#let common-theme = (
lang: "de",
page-numbering: default-page-numbering,
paragraph: (justify: true),
footnote: (
numbering: (text: "[1]", note: "1"),
indent: 1em,
),
table: (
inset: 7pt,
stroke: 0.5pt + colors.stroke,
),
)
#let code-theme = (
font: fonts.code,
features: code-text-features,
tab-size: 4,
size-offset: 2.5pt,
block: (
stroke: 0.4pt + colors.code-border,
fill: colors.code-block-fill,
radius: 0.2em,
inset: (x: 1.25em, y: 1em),
width: 100%,
),
inline: (
stroke: 0.4pt + colors.code-inline-border,
fill: colors.code-inline-fill,
inset: (x: 3pt, y: 0pt),
outset: (y: 3pt),
radius: 2pt,
),
theme: "../../assets/OneHalfLight.tmTheme",
)
#let base-theme = (
font-size: 12pt,
text-font: fonts.base,
math-font: fonts.base-math,
header-size: 8.5pt,
heading-1: (size: 18pt, weight: 300),
heading-2: (weight: 380),
title-weight: 300,
raw-block: code-theme.block,
)
#let computer-science-theme = (
font-size: 10.5pt,
text-font: fonts.cmu,
math-font: fonts.cmu-math,
header-size: 10pt,
divider: black,
raw-block: code-theme.block,
)
#let end-message = [_Typeset with #link("https://typst.app")[#text(fill: colors.text)[#underline[Typst]]]\; template available from #link("https://git.p0pa.de/Popa/clean-sheets")[#text(fill: colors.text)[#underline[clean-sheets]]]._]
#let statement-colors = (
definition: (247, 57, 72),
axiom: (247, 92, 37),
theorem: (100, 100, 255),
lemma: (22, 147, 220),
corollary: (157, 82, 255),
)
+55
View File
@@ -0,0 +1,55 @@
#import "@preview/clean-sheets:0.2.2": base-template, ex_box, qed
#let logo = box(
width: 2.4cm,
height: 1cm,
stroke: 0.8pt + eastern,
radius: 3pt,
align(center + horizon, text(fill: eastern, weight: "bold")[LOGO]),
)
#show: body => base-template(
1,
[Introduction to Examples],
[Prof. Ada Example],
[Dr. Alan Assistant],
3,
([Jane Doe], [John Doe]),
[Taylor Tutor],
logo: logo,
body,
)
= Exercise 1
#ex_box(
heading: [Warm-up],
points: [10 points],
)[
Prove the following identity for every natural number $n$:
$
sum_(k=1)^n k = (n (n + 1)) / 2.
$
]
Write a proof by induction. #qed
= Exercise 2
#ex_box(points: [15 points])[
Implement a function that returns the first $n$ Fibonacci numbers.
]
```python
def fibonacci(n):
values = [0, 1]
while len(values) < n:
values.append(values[-1] + values[-2])
return values[:n]
```
= Exercise 3
#ex_box(heading: [Discussion])[
Compare the iterative and recursive solutions.
]
BIN
View File
Binary file not shown.

After

Width:  |  Height:  |  Size: 235 KiB

+18
View File
@@ -0,0 +1,18 @@
[package]
name = "clean-sheets"
version = "0.2.2"
compiler = "0.15.0"
repository = "https://git.p0pa.de/Popa/clean-sheets"
entrypoint = "lib.typ"
authors = ["Popa <https://git.p0pa.de/Popa>"]
categories = ["layout", "components", "report"]
disciplines = ["education", "mathematics", "computer-science"]
license = "MIT"
description = "Clean exercise sheets for university courses."
keywords = ["exercise sheets", "homework", "university", "education"]
exclude = ["/examples/"]
[template]
path = "template"
entrypoint = "main.typ"
thumbnail = "thumbnail.png"