diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..6f7cfff --- /dev/null +++ b/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2025 Gaspard Jankowiak + +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. diff --git a/lib.typ b/src/lib.typ similarity index 98% rename from lib.typ rename to src/lib.typ index a2004c6..05e5090 100644 --- a/lib.typ +++ b/src/lib.typ @@ -13,9 +13,9 @@ * Macros */ -// Frame for table, no vertical lines, top and bottom are bold +// stroke helper function for table, no vertical lines, top and bottom are bold // s: stroke, to specify e.g. the width and color of strokes -#let frame(s) = (x, y) => ( +#let horiz-only(s) = (x, y) => ( left: none, right: none, top: if y > 0 { s } else { 2*s }, diff --git a/template/exam.typ b/template/exam.typ new file mode 100644 index 0000000..847a832 --- /dev/null +++ b/template/exam.typ @@ -0,0 +1,85 @@ +#import "@local/exam:0.2.0": exam, exercise, exercise-items, mtext, horiz-only + +// General configuration +#show: exam.with( + title: "Exam", + + course-title: [Abstract Binary Computation & Elegant Finite Graphs], + + // Top left header + institution: [Super University], + + // Top right header + course-short-title: "ABC & EFG", + date: "1. January 1970", + + // Exam details, appears below the title + course-code: "π", + duration-minutes: "90", + + // Configure personal information fields + ask-trainer-name: false, + ask-group: true, + ask-student-number: false, + + // Configure language, either "de" or "en" + language: "en", + + // custom instructions + // instructions: none, + + // change font-size + // font-size: 12pt, + + // custom paper size + // paper-size: "a4", + + // custom numbering of exercises + // exercise-numbering: "1", +) + +// First exercise +#exercise("Relations and their properties", 2) + +Consider the relation $R subset NN^2$, defined as follows: + +$ (x, y) in R #h(0.5cm) <==> #h(0.5cm) x + y #mtext[is odd]. $ + +Is $R$ reflexive? transitive? symmetric? antisymmetric? + +// Second exercise +#exercise("Properties of functions", 3) + +Let $f : (0, +infinity) → (0, +infinity)$ with $f (x) = e^(-x)$. + +// Several sub-questions +#exercise-items(( + (1, [Is $f$ injective?]), // The first argument is the number + // of points the item is worth + (1, [Is $f$ surjective?]), + (2, [Is $f$ bijective?]), +)) + +// Third exercise +#exercise("Logical operators", 3.14) + +Consider the following truthtable: + +#align(center, table( + stroke: horiz-only(0.5pt), + columns: (auto, auto, auto), + align: center, + [$A$], [$B$], [$A or B$], + [1], [1], [1], + [1], [0], [1], + [0], [1], [1], + [0], [0], [1], +)) + +// More sub-questions +// override-points to false, so that the exercise total points are not recomputed. +#exercise-items(override-points: false, numbering: "i)", ( + (1, [Is the truthtable correct?]), + (1, [If not, fix it.]), +)) + diff --git a/thumbnail.png b/thumbnail.png new file mode 100644 index 0000000..e37c37c Binary files /dev/null and b/thumbnail.png differ diff --git a/typst.toml b/typst.toml index bdc9dac..e3f14e5 100644 --- a/typst.toml +++ b/typst.toml @@ -1,8 +1,14 @@ [package] name = "exam" -version = "0.1.0" -entrypoint = "lib.typ" +version = "0.2.0" +entrypoint = "src/lib.typ" authors = ["Gaspard Jankowiak"] license = "MIT" description = "Exams for NAWI Graz." compiler = "0.14.0" +categories = ["layout", "office"] + +[template] +path = "template" +entrypoint = "exam.typ" +thumbnail = "thumbnail.png"