Cleared the code formatting.

This commit is contained in:
orca 2024-01-17 05:34:12 +01:00
parent 7157b184d1
commit 20124d45ba
Signed by: orca
GPG Key ID: 6923B8DFED96A68A
1 changed files with 33 additions and 29 deletions

View File

@ -1,15 +1,17 @@
// This is a fully documented Typst configuration file.
// If something is unclear, check the referece: https://typst.app/docs/reference/.
// If something is unclear, check the Typst docs or file an issue.
// ===============================================================
// Constants.
// ----------
// The QED sign - a square drawn with four strokes.
/* The QED sign - a square drawn with four strokes. */
#let qed = [$square.stroked$]
// Language-specific constants.
#let lang = "fr"
// Environments name.
/* Environments name. */
#let outline-title = [Table des matières]
#let abstract-text = "Résumé"
#let proposition-text = "Propostition"
@ -21,32 +23,32 @@
#let example-text = "Exemple"
#let proof-text = "Démonstration"
// Number the equations starting with the heading hierarchy before them.
// E.g. if we are looking at the 6th equation in the 4th subheading
// of the 2nd heading, it will show "(2.4.6)" in the right.
/* Number the equations starting with the heading hierarchy before them.
E.g. if we are looking at the 6th equation in the 4th subheading
of the 2nd heading, it will show "(2.4.6)" in the right. */
#let numbering-equation(equation) = [(#counter(heading).display()#equation)]
#let numbered-equation(body) = math.equation(numbering: numbering-equation, block: true)[#body]
// Functions.
// ----------
/* Emphasize a block by placing it in a decorated rectangle. */
#let block-emph(body, way: "") = {
if way == "fill" {
// Empathize text by putting it in a very light filled gray box.
rect(fill: rgb(0, 0, 0, 10), width: 100%, radius: 1pt)[#body]
} else if way == "outline" {
// Empathize text by putting it in a very light gray box.
rect(stroke: rgb(0, 0, 0, 18) + 4pt, width: 100%, radius: 1pt)[#body]
} else {
[#body]
}
}
// The `name` named variable allows us to give a name to be displayed instead of the numbers.
#let math-block(body, name: "", kind: "", emphasis: "bold", decoration: "fill") = {
// We create a counter to be able to index the environment.
let current-counter = counter(kind)
/* The `name` named variable allows us to give a name to be displayed instead of the numbers. */
#let math-block(body, name: "", id: "", emphasis: "bold", decoration: "fill") = {
/* We create a counter to be able to index the environment. */
let current-counter = counter(id)
let id = if name == "" {
let name = if name == "" {
current-counter.step()
counter(heading).display() + current-counter.display()
} else {
@ -54,27 +56,29 @@
}
if emphasis == "bold" {
block-emph(way: decoration)[*#kind #id.* #body]
block-emph(way: decoration)[*#id #name.* #body]
} else if emphasis == "italics" {
block-emph(way: decoration)[_#kind #id._ #body]
block-emph(way: decoration)[_#id #name._ #body]
} else {
block-emph(way: decoration)[#kind #id. #body]
block-emph(way: decoration)[#id #name. #body]
}
}
#let proposition(body, name: "") = math-block(body, name: name, kind: proposition-text)
#let lemma(body, name: "") = math-block(body, name: name, kind: lemma-text)
#let theorem(body, name: "") = math-block(body, name: name, kind: lemma-text)
#let corrolary(body, name: "") = math-block(body, name: name, kind: lemma-text)
#let definition(body, name: "") = math-block(body, name: name, kind: definition-text, emphasis: "italics", decoration: "outline")
#let remark(body, name: "") = math-block(body, name: name, kind: remark-text, decoration: "none")
#let example(body, name: "") = math-block(body, name: name, kind: example-text, decoration: "none")
// Functions we will directly use.
#let proposition(body, name: "") = math-block(body, name: name, id: proposition-text)
#let lemma(body, name: "") = math-block(body, name: name, id: lemma-text)
#let theorem(body, name: "") = math-block(body, name: name, id: lemma-text)
#let corrolary(body, name: "") = math-block(body, name: name, id: lemma-text)
#let definition(body, name: "") = math-block(body, name: name, id: definition-text, emphasis: "italics", decoration: "outline")
#let remark(body, name: "") = math-block(body, name: name, id: remark-text, decoration: "none")
#let example(body, name: "") = math-block(body, name: name, id: example-text, decoration: "none")
// It takes the body of the proof, and formats it by adding the QED
// symbol at the end, and the _#proof-text._ text at the front.
/* It takes the body of the proof, and formats it by adding the QED
symbol at the end, and the _#proof-text._ text at the front. */
#let proof(body) = [_#proof-text._ #body #h(3em) #place(right, dy: -7pt, qed)]
// Configuration of the paper.
// ---------------------------
#let configuration(title: none, authors: (), abstract: [], doc) = {
set document(title: title, author: if authors.len() != 0 {
@ -89,11 +93,11 @@
set text(lang: lang, font: "New Computer Modern", size: 10pt)
// Similar formatting to LaTeX.
/* Similar formatting to LaTeX. */
set par(leading: 0.55em, justify: true)
set heading(numbering: "1.")
// Show headings like in asmart.
/* Show headings like in asmart. */
show heading: it => {
set block(above: 1.8em, below: 1.2em)
set align(center)
@ -105,7 +109,7 @@
block(counter(heading).display() + " " + smallcaps(it.body))
}
// We want equations to be local to their heading.
/* We want equations to be local to their heading. */
counter(math.equation).update(0)
}
@ -115,7 +119,7 @@
v(1em)
// We print authors' information in a grid.
/* We print authors' information in a grid. */
let count = authors.len()
let ncols = calc.min(count, 3)
grid(columns: (1fr,) * ncols, row-gutter: 24pt, ..authors.map(author => [