diff --git a/packages/preview/clean-math-paper/0.2.5/.gitignore b/packages/preview/clean-math-paper/0.2.5/.gitignore new file mode 100644 index 0000000000..ff5160eff9 --- /dev/null +++ b/packages/preview/clean-math-paper/0.2.5/.gitignore @@ -0,0 +1,4 @@ +.vscode/ +.vscode/* +*.code-workspace +*.pdf diff --git a/packages/preview/clean-math-paper/0.2.5/LICENSE b/packages/preview/clean-math-paper/0.2.5/LICENSE new file mode 100644 index 0000000000..91cd01d350 --- /dev/null +++ b/packages/preview/clean-math-paper/0.2.5/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2024-present Joshua Lampert + +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/packages/preview/clean-math-paper/0.2.5/README.md b/packages/preview/clean-math-paper/0.2.5/README.md new file mode 100644 index 0000000000..8f55a9e4a0 --- /dev/null +++ b/packages/preview/clean-math-paper/0.2.5/README.md @@ -0,0 +1,106 @@ +# clean-math-paper + +[![Build Typst Document](https://github.com/JoshuaLampert/clean-math-paper/actions/workflows/build.yml/badge.svg)](https://github.com/JoshuaLampert/clean-math-paper/actions/workflows/build.yml) +[![Repo](https://img.shields.io/badge/GitHub-repo-blue)](https://github.com/JoshuaLampert/clean-math-paper) +[![License: MIT](https://img.shields.io/badge/License-MIT-success.svg)](https://opensource.org/licenses/MIT) + +[Typst](https://typst.app/home/) paper template for mathematical papers built for simple, efficient use and a clean look. +Of course, it can also be used for other subjects, but the following math-specific features are already contained in the template: + +- theorems, lemmas, corollaries, proofs etc. prepared using [great-theorems](https://typst.app/universe/package/great-theorems) +- equation settings + +## Set-Up + +The template is already filled with dummy data, to give users an impression what it looks like. The paper is obtained by compiling `main.typ`. + +- after [installing Typst](https://github.com/typst/typst?tab=readme-ov-file#installation) you can conveniently use the following to create a new folder containing this project. + +```bash +typst init @preview/clean-math-paper:0.2.5 +``` + +- edit the data in `main.typ` → `#show template.with([your data])` + +### Parameters of the Template + +- `title`: Title of the paper. +- `authors`: List of names of the authors of the paper. Each entry of the list is a dictionary with the following keys: + - `name`: Name of the author. + - `affiliation-id`: The ID of the affiliation in `affiliations`, see below. Can also be left empty. + - optionally `orcid`: The [ORCID](https://orcid.org/) of the author. If provided, the author's name will be linked to their ORCID profile. +- `affiliations`: List of affiliations of the authors. Each entry of the list is a dictionary with the following keys: + - `id`: ID of the affiliation, which is used to link the authors to the affiliation, see above. Can also be left empty. + - `name`: Name of the affiliation. +- `date`: Date of the paper. +- `abstract`: Abstract of the paper. If not provided, nothing will be shown. +- `keywords`: List of keywords of the paper. If not provided, nothing will be shown. +- `AMS`: List of AMS subject classifications of the paper. If not provided, nothing will be shown. +- `lang`: Language of the paper. Supported languages are English, German, French, and Spanish, default is "en". +- `translations`: Dictionary to override the language translations. Please refer to the `Support for languages` section for more information. +- `heading-color`: Color of the headings including the title. +- `link-color`: Color of the links. +- `lines`: Boolean to enable or disable the horizontal lines around the title. Default is `true`. +- `ncolumns`: Number of columns of the paper. Default is `1`. +- `page-args`: Dictionary to set page arguments, e.g., to change the number of columns or page numbering. See [Typst docs](https://typst.app/docs/reference/layout/page/) for more information. The default page arguments can be accessed via `page-args`, i.e., if you want to change only some of the default settings, you can use `insert` on `page-args` to change specific settings. +- `text-args-title`: Dictionary to set text arguments for the title, e.g., to change the font size or color. See [Typst docs](https://typst.app/docs/reference/text/text/) for more information. The default arguments can be accessed via `text-args-title`, i.e., if you want to change only some of the default settings, you can use `insert` on `text-args-title` to change specific settings. +- `text-args-authors`: Dictionary to set text arguments for the authors' names, e.g., to change the font weight or style. See [Typst docs](https://typst.app/docs/reference/text/text/) for more information. The default arguments can be accessed via `text-args-authors`, i.e., if you want to change only some of the default settings, you can use `insert` on `text-args-authors` to change specific settings. + +### Support for mathblocks + +This template uses the [great-theorems](https://typst.app/universe/package/great-theorems) package to provide a set of mathblocks. Currently, the following blocks are available: `theorem`, `proposition`, `corollary`, `lemma`, `definition`, `remark`, `example`, `question`, and `proof`. If you want to define your own block, you can do this, e.g., by + +```typst +#let answer = my-mathblock( + blocktitle: "Answer", + bodyfmt: text.with(style: "italic"), +) +``` + +where `my-mathblock` already includes the counter shared between mathblocks. You can also directly use `mathblock` instead if you do not want to use the default setting used in this template. + +### Support for languages + +This template includes translations for English, German, French, and Spanish. To use one of these languages, set the lang parameter to `en`, `de`, `fr`, or `es`: + +```typst +#show: template.with( + lang: "en" +) +``` + +For languages not included by default, or to override existing translations: + +- set `lang` to your language's ISO code (see [Typst docs](https://typst.app/docs/reference/text/text/#parameters-lang)) +- provide a `translations` dictionary with your custom translations, like below + +```typst +#show: template.with( + lang: "en", + translations: ( + "theorem": "Theorem", + "proposition": "Proposition", + "corollary": "Corollary", + "lemma": "Lemma", + "definition": "Definition", + "remark": "Remark", + "example": "Example", + "question": "Question", + "proof": "Proof", + "keywords": "Keywords", + "ams": "AMS subject classification", + "appendix": "Appendix", + "abstract": "Abstract", + ) +) +``` + +To modify specific translations for a supported language, a partial dictionary is enough. Only the specified keys will be overridden. + +## Acknowledgements + +Some parts of this template are based on the [arkheion](https://github.com/mgoulao/arkheion) template. + +## Feedback & Improvements + +If you encounter problems, please open issues. In case you found useful extensions or improved anything We are also very happy to accept pull requests. diff --git a/packages/preview/clean-math-paper/0.2.5/lib.typ b/packages/preview/clean-math-paper/0.2.5/lib.typ new file mode 100644 index 0000000000..3567a8f06b --- /dev/null +++ b/packages/preview/clean-math-paper/0.2.5/lib.typ @@ -0,0 +1,345 @@ +#import "@preview/great-theorems:0.1.2": great-theorems-init, mathblock, proofblock +#import "@preview/rich-counters:0.2.2": rich-counter +#import "@preview/i-figured:0.2.4": reset-counters, show-equation + +// Language support +#let language-translations = state( + "language-translations", + ( + en: ( + "theorem": "Theorem", + "proposition": "Proposition", + "corollary": "Corollary", + "lemma": "Lemma", + "definition": "Definition", + "remark": "Remark", + "example": "Example", + "question": "Question", + "proof": "Proof", + "keywords": "Keywords", + "ams": "AMS subject classification", + "appendix": "Appendix", + "abstract": "Abstract", + ), + de: ( + "theorem": "Satz", + "proposition": "Proposition", + "corollary": "Korollar", + "lemma": "Lemma", + "definition": "Definition", + "remark": "Anmerkung", + "example": "Beispiel", + "question": "Frage", + "proof": "Beweis", + "keywords": "Schlüsselwörter", + "ams": "AMS-Klassifikation", + "appendix": "Anhang", + "abstract": "Zusammenfassung", + ), + fr: ( + "theorem": "Théorème", + "proposition": "Proposition", + "corollary": "Corollaire", + "lemma": "Lemme", + "definition": "Définition", + "remark": "Remarque", + "example": "Exemple", + "question": "Question", + "proof": "Preuve", + "keywords": "Mots clés", + "ams": "Classification AMS", + "appendix": "Annexe", + "abstract": "Résumé", + ), + es: ( + "theorem": "Teorema", + "proposition": "Proposición", + "corollary": "Corolario", + "lemma": "Lema", + "definition": "Definición", + "remark": "Comentario", + "example": "Ejemplo", + "question": "Pregunta", + "proof": "Demostración", + "keywords": "Palabras clave", + "ams": "Clasificación AMS", + "appendix": "Apéndice", + "abstract": "Resumen", + ), + ), +) + +#let get-language-title(label) = { + context { + let language = str(text.lang) + let translations = language-translations.get() + if language in translations { + translations.at(language).at(label, default: "Unknown") + } else { + translations.en.at(label, default: "Unknown") + } + } +} + +// counter for mathblocks +#let theoremcounter = rich-counter( + identifier: "mathblocks", + inherited_levels: 1, +) + +#let my-mathblock = mathblock.with( + counter: theoremcounter, + breakable: false, + titlix: title => [(#title):], + // suffix: [#h(1fr) $triangle.r$], +) + +// theorem etc. settings +#let theorem = my-mathblock( + blocktitle: get-language-title("theorem"), + bodyfmt: text.with(style: "italic"), +) + +#let proposition = my-mathblock( + blocktitle: get-language-title("proposition"), + bodyfmt: text.with(style: "italic"), +) + +#let corollary = my-mathblock( + blocktitle: get-language-title("corollary"), + bodyfmt: text.with(style: "italic"), +) + +#let lemma = my-mathblock( + blocktitle: get-language-title("lemma"), + bodyfmt: text.with(style: "italic"), +) + +#let definition = my-mathblock( + blocktitle: get-language-title("definition"), + bodyfmt: text.with(style: "italic"), +) + +#let remark = my-mathblock(blocktitle: [_#get-language-title("remark")_]) + +#let example = my-mathblock(blocktitle: [_#get-language-title("example")_]) + +#let question = my-mathblock(blocktitle: [_#get-language-title("question")_]) + +#let proof = proofblock(prefix: [_#get-language-title("proof")._]) + +// To also handle content (e.g. something like $dagger$) as affiliation-id, +// cf. https://github.com/typst/typst/issues/2196#issuecomment-1728135476 +#let to-string(content) = { + if type(content) in (int, float, decimal, version, bytes, label, type, str) { + str(content) + } else { + if content.has("text") { + content.text + } else if content.has("children") { + content.children.map(to-string).join("") + } else if content.has("body") { + to-string(content.body) + } else if content == [ ] { + " " + } + } +} + +#let page-args = ( + margin: (left: 25mm, right: 25mm, top: 25mm, bottom: 30mm), + numbering: "1", + number-align: center, +) +#let text-args-title = (fill: auto, size: 1.75em,) +#let text-args-authors = (weight: "bold",) + +#let template( + title: "", + authors: (), + affiliations: (), + date: datetime.today().display(), + abstract: none, + keywords: (), + AMS: (), + lang: "en", + translations: none, + heading-color: rgb("#000000"), + link-color: rgb("#000000"), + lines: true, + page-args: page-args, + text-args-title: text-args-title, + text-args-authors: text-args-authors, + ncolumns: 1, + body, +) = { + // Set the document's basic properties. + set document(author: authors.map(a => a.name), title: title) + set page(..page-args) + set text(font: "New Computer Modern", lang: lang) + set enum(numbering: "(i)") + set outline(indent: 2em) // indent: auto does not work well with appendices + show: great-theorems-init + + // Overrides the current translations + if lang != none and translations != none { + language-translations.update(value => { + if lang in value { + value.insert(lang, value.at(lang) + translations) + } else { + value.insert(lang, translations) + } + value + }) + } + + // table label on top and not below the table + show figure.where(kind: table): set figure.caption(position: top) + + // Heading settings. + set heading(numbering: "1.1") + show heading.where(level: 1): set text(size: 14pt, fill: heading-color) + show heading.where(level: 2): set text(size: 12pt, fill: heading-color) + + // Equation settings. + // Using i-figured: + show heading: reset-counters + show math.equation: show-equation.with(prefix: "eq:", only-labeled: true) + + // Using headcount: + // show heading: reset-counter(counter(math.equation)) + // set math.equation(numbering: dependent-numbering("(1.1)")) + set math.equation(supplement: none) + show math.equation: box // no line breaks in inline math + + if lines { + line(length: 100%, stroke: 2pt) + } + // Title row. + if text-args-title.fill == auto { + text-args-title.insert("fill", heading-color) + } + pad( + bottom: 4pt, + top: 4pt, + align(center)[ + #block(text(..text-args-title, title)) + #v(1em, weak: true) + ], + ) + if lines { + line(length: 100%, stroke: 2pt) + } + + // Author information. + pad( + top: 0.5em, + x: 2em, + grid( + columns: (1fr,) * calc.min(3, authors.len()), + gutter: 1.5em, + ..authors.map(author => align(center)[ + #let affiliation-id = if "affiliation-id" in author { + author.affiliation-id + } else { + "" + } + #let author-with-id = [#text(..text-args-authors, author.name)#super(to-string(affiliation-id))] + #if author.keys().contains("orcid") { + link("http://orcid.org/" + author.orcid)[ + #pad( + bottom: -8pt, + grid( + columns: (8pt, auto, 8pt), + rows: 10pt, + [], + author-with-id, + [#pad(left: 4pt, top: -4pt, image("orcid.svg", width: 8pt))], + ), + ) + ] + } else { + grid( + columns: auto, + rows: 2pt, + author-with-id, + ) + } + ]), + ), + ) + + // Affiliation information. + pad( + top: 0.5em, + x: 2em, + if affiliations != none { + for affiliation in affiliations { + align(center)[ + #super(to-string(affiliation.id))#affiliation.name + ] + } + }, + ) + + align(center)[#date] + + // Set the color for links and references after the authors to not overwrite the text color in the case of an available orcid. + show link: set text(fill: link-color) + show ref: set text(fill: link-color) + + // Abstract. + if abstract != none { + pad( + x: 3em, + top: 1em, + bottom: 0.4em, + align(center)[ + #heading( + outlined: false, + numbering: none, + text(0.85em, smallcaps(get-language-title("abstract"))), + ) + #set par(justify: true) + #set text(hyphenate: false) + + #abstract + ], + ) + } + + // Keywords + if keywords.len() > 0 { + [*_#get-language-title("keywords")_*. #h(0.3cm)] + keywords.map(str).join(" · ") + linebreak() + } + // AMS + if AMS.len() > 0 { + [*#get-language-title("ams")*. #h(0.3cm)] + AMS.map(str).join(", ") + } + // Main body. + set par(justify: true) + set text(hyphenate: false) + + columns(ncolumns)[ + #body + ] +} + +#let appendices(body) = { + counter(heading).update(0) + counter("appendices").update(1) + + set heading( + numbering: (..nums) => { + let vals = nums.pos() + let value = "ABCDEFGHIJ".at(vals.at(0) - 1) + if vals.len() == 1 { + return get-language-title("appendix") + " " + value + } else { + return value + "." + nums.pos().slice(1).map(str).join(".") + } + }, + ) + [#colbreak() #body] +} diff --git a/packages/preview/clean-math-paper/0.2.5/orcid.svg b/packages/preview/clean-math-paper/0.2.5/orcid.svg new file mode 100644 index 0000000000..8aec5959e5 --- /dev/null +++ b/packages/preview/clean-math-paper/0.2.5/orcid.svg @@ -0,0 +1,21 @@ + + + + Orcid logo + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/packages/preview/clean-math-paper/0.2.5/template/bibliography.bib b/packages/preview/clean-math-paper/0.2.5/template/bibliography.bib new file mode 100644 index 0000000000..aba16cee62 --- /dev/null +++ b/packages/preview/clean-math-paper/0.2.5/template/bibliography.bib @@ -0,0 +1,10 @@ +@article{Cooley65, + title={An Algorithm for the Machine Calculation of Complex Fourier Series}, + author={James W. Cooley and John W. Tukey}, + journal={Mathematics of Computation}, + year={1965}, + volume={19}, + pages={297-301}, + doi={10.1090/S0025-5718-1965-0178586-1}, + url={https://api.semanticscholar.org/CorpusID:121744946} +} diff --git a/packages/preview/clean-math-paper/0.2.5/template/main.typ b/packages/preview/clean-math-paper/0.2.5/template/main.typ new file mode 100644 index 0000000000..e669ee7656 --- /dev/null +++ b/packages/preview/clean-math-paper/0.2.5/template/main.typ @@ -0,0 +1,112 @@ +#import "@preview/clean-math-paper:0.2.5": * + +#let date = datetime.today().display("[month repr:long] [day], [year]") + +// Modify some arguments, which can be overwritten in the template call +#page-args.insert("numbering", "1/1") +#text-args-title.insert("size", 2em) +#text-args-title.insert("fill", black) +#text-args-authors.insert("size", 12pt) + +#show: template.with( + title: "Typst template for mathematical papers", + authors: ( + (name: "Author 1", affiliation-id: 1, orcid: "0000-0000-0000-0000"), + (name: "Author 2", affiliation-id: "2,*"), + ), + affiliations: ( + (id: 1, name: "Affiliation 1, Address 1"), + (id: 2, name: "Affiliation 2, Address 2"), + (id: "*", name: "Corresponding author") + ), + date: date, + heading-color: rgb("#0000ff"), + link-color: rgb("#008002"), + // Insert your abstract after the colon, wrapped in brackets. + // Example: `abstract: [This is my abstract...]` + abstract: lorem(30), + keywords: ("First keyword", "Second keyword", "etc."), + AMS: ("65M70", "65M12"), + // Pass page-args to change page settings + // page-args: page-args, + // Pass text-args-authors to change author name text settings + // text-args-authors: text-args-authors, + // Pass text-args-title to change title text settings + // text-args-title: text-args-title, +) + += Introduction +#lorem(20) + += Equations + +The template uses #link("https://typst.app/universe/package/i-figured/")[`i-figured`] for labeling equations. Equations will be numbered only if they are labelled. Here is an equation with a label: + +$ + sum_(k=1)^n k = (n(n+1)) / 2 +$ + +We can reference it by `@eq:label` like this: @eq:equation, i.e., we need to prepend the label with `eq:`. The number of an equation is determined by the section it is in, i.e. the first digit is the section number and the second digit is the equation number within that section. + +Here is an equation without a label: + +$ + exp(x) = sum_(n=0)^oo (x^n) / n! +$ + +As we can see, it is not numbered. + += Theorems + +The template uses #link("https://typst.app/universe/package/great-theorems/")[`great-theorems`] for theorems. Here is an example of a theorem: + +#theorem(title: "Example Theorem")[ + This is an example theorem. +] +#proof[ + This is the proof of the example theorem. +] + + +We also provide `definition`, `lemma`, `remark`, `example`, and `question`s among others. Here is an example of a definition: + +#definition(title: "Example Definition")[ + This is an example definition. +] + +#question(title: "Custom mathblock?")[ + How do you define a custom mathblock? +] + +#let answer = my-mathblock( + blocktitle: "Answer", + bodyfmt: text.with(style: "italic"), +) + +#answer[ + You can define a custom mathblock like this: + ```typst + #let answer = my-mathblock( + blocktitle: "Answer", + bodyfmt: text.with(style: "italic"), + ) + ``` +] + +Similar as for the equations, the numbering of the theorems is determined by the section they are in. We can reference theorems by `@label` like this: @th:example. + +To get a bibliography, we also add a citation @Cooley65. + +#lorem(50) + +#bibliography("bibliography.bib") + +// Create appendix section +#show: appendices += + +If you have appendices, you can add them after `#show: appendices`. The appendices are started with an empty heading `=` and will be numbered alphabetically. Any appendix can also have different subsections. + +== Appendix section + +#lorem(100) diff --git a/packages/preview/clean-math-paper/0.2.5/thumbnail.png b/packages/preview/clean-math-paper/0.2.5/thumbnail.png new file mode 100644 index 0000000000..7a99d8173f Binary files /dev/null and b/packages/preview/clean-math-paper/0.2.5/thumbnail.png differ diff --git a/packages/preview/clean-math-paper/0.2.5/typst.toml b/packages/preview/clean-math-paper/0.2.5/typst.toml new file mode 100644 index 0000000000..6c33be9884 --- /dev/null +++ b/packages/preview/clean-math-paper/0.2.5/typst.toml @@ -0,0 +1,18 @@ +[package] +name = "clean-math-paper" +version = "0.2.5" +compiler = "0.12.0" +entrypoint = "lib.typ" +authors = ["Joshua Lampert <@JoshuaLampert>"] +license = "MIT" +description = "A simple and good looking template for mathematical papers" +repository = "https://github.com/JoshuaLampert/clean-math-paper" +keywords = ["arXiv", "paper", "clean", "math", "mathematical", "mathematics", "computer science"] +categories = ["paper"] +disciplines = ["mathematics", "engineering", "computer-science"] +exclude = [".gitignore"] + +[template] +path = "template" +entrypoint = "main.typ" +thumbnail = "thumbnail.png"