diff --git a/data/templates/default.typst b/data/templates/default.typst index c5e602e4a9d1..54498583d81d 100644 --- a/data/templates/default.typst +++ b/data/templates/default.typst @@ -57,6 +57,9 @@ $endif$ $if(abstract)$ abstract: [$abstract$], $endif$ +$if(thanks)$ + thanks: [$thanks$], +$endif$ $if(margin)$ margin: ($for(margin/pairs)$$margin.key$: $margin.value$,$endfor$), $endif$ @@ -69,8 +72,26 @@ $endif$ $if(fontsize)$ fontsize: $fontsize$, $endif$ +$if(mathfont)$ + mathfont: ($for(mathfont)$"$mathfont$",$endfor$), +$endif$ +$if(codefont)$ + codefont: ($for(codefont)$"$codefont$",$endfor$), +$endif$ +$if(linestretch)$ + linestretch: $linestretch$, +$endif$ $if(section-numbering)$ sectionnumbering: "$section-numbering$", +$endif$ +$if(linkcolor)$ + linkcolor: [$linkcolor$], +$endif$ +$if(citecolor)$ + citecolor: [$citecolor$], +$endif$ +$if(toccolor)$ + toccolor: [$toccolor$], $endif$ cols: $if(columns)$$columns$$else$1$endif$, doc, diff --git a/data/templates/template.typst b/data/templates/template.typst index 42532e1b24f0..a1e3d962dcd1 100644 --- a/data/templates/template.typst +++ b/data/templates/template.typst @@ -16,6 +16,7 @@ keywords: (), date: none, abstract: none, + thanks: none, cols: 1, margin: (x: 1.25in, y: 1.25in), paper: "us-letter", @@ -23,12 +24,18 @@ region: "US", font: (), fontsize: 11pt, + mathfont: "New Computer Modern Math", + codefont: "DejaVu Sans Mono", + linestretch: 1, sectionnumbering: none, + linkcolor: ["#800000"], + citecolor: ["#0000FF"], + toccolor: ["#800000"], doc, ) = { set document( title: title, - author: authors.map(author => content-to-string(author.name)), + author: authors.map(author => content-to-string(author.name)).join(", ", last: ", and "), keywords: keywords, ) set page( @@ -36,16 +43,35 @@ margin: margin, numbering: "1", ) - set par(justify: true) + set par( + justify: true, + leading: linestretch * 0.65em + ) set text(lang: lang, region: region, font: font, size: fontsize) + show math.equation: set text(font: mathfont) + show raw: set text(font: codefont) set heading(numbering: sectionnumbering) + show link: set text(fill: rgb(content-to-string(linkcolor))) + + show link: this => { + if type(this.dest) == label { + text(this, fill: rgb(content-to-string(filecolor))) + } + } + show ref: this => { + text(this, fill: rgb(content-to-string(citecolor))) + } + if title != none { align(center)[#block(inset: 2em)[ - #text(weight: "bold", size: 1.5em)[#title] + #text(weight: "bold", size: 1.5em)[#title #if thanks != none { + footnote(thanks, numbering: "*") + counter(footnote).update(n => n - 1) + }] #(if subtitle != none { parbreak() text(weight: "bold", size: 1.25em)[#subtitle] diff --git a/test/writer.typst b/test/writer.typst index 91d600c81906..369b7b5f4cae 100644 --- a/test/writer.typst +++ b/test/writer.typst @@ -38,6 +38,7 @@ keywords: (), date: none, abstract: none, + thanks: none, cols: 1, margin: (x: 1.25in, y: 1.25in), paper: "us-letter", @@ -45,12 +46,18 @@ region: "US", font: (), fontsize: 11pt, + mathfont: "New Computer Modern Math", + codefont: "DejaVu Sans Mono", + linestretch: 1, sectionnumbering: none, + linkcolor: ["#800000"], + citecolor: ["#0000FF"], + toccolor: ["#800000"], doc, ) = { set document( title: title, - author: authors.map(author => content-to-string(author.name)), + author: authors.map(author => content-to-string(author.name)).join(", ", last: ", and "), keywords: keywords, ) set page( @@ -58,16 +65,35 @@ margin: margin, numbering: "1", ) - set par(justify: true) + set par( + justify: true, + leading: linestretch * 0.65em + ) set text(lang: lang, region: region, font: font, size: fontsize) + show math.equation: set text(font: mathfont) + show raw: set text(font: codefont) set heading(numbering: sectionnumbering) + show link: set text(fill: rgb(content-to-string(linkcolor))) + + show link: this => { + if type(this.dest) == label { + text(this, fill: rgb(content-to-string(filecolor))) + } + } + show ref: this => { + text(this, fill: rgb(content-to-string(citecolor))) + } + if title != none { align(center)[#block(inset: 2em)[ - #text(weight: "bold", size: 1.5em)[#title] + #text(weight: "bold", size: 1.5em)[#title #if thanks != none { + footnote(thanks, numbering: "*") + counter(footnote).update(n => n - 1) + }] #(if subtitle != none { parbreak() text(weight: "bold", size: 1.25em)[#subtitle]