From 296068131ad6f1daf56b41c4031580e16505382f Mon Sep 17 00:00:00 2001 From: Christopher Kenny Date: Mon, 8 Jul 2024 22:08:30 -0400 Subject: [PATCH 1/5] add thanks to title --- data/templates/default.typst | 3 +++ data/templates/template.typst | 6 +++++- test/writer.typst | 6 +++++- 3 files changed, 13 insertions(+), 2 deletions(-) diff --git a/data/templates/default.typst b/data/templates/default.typst index c5e602e4a9d1..98044008cb0b 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$ diff --git a/data/templates/template.typst b/data/templates/template.typst index 42532e1b24f0..a2db7057ea9f 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", @@ -45,7 +46,10 @@ 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..576ee20f5dd2 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", @@ -67,7 +68,10 @@ 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] From c5011d8fce26d64f120e9ef6b72600ffa2dabbaa Mon Sep 17 00:00:00 2001 From: Christopher Kenny Date: Mon, 8 Jul 2024 22:11:28 -0400 Subject: [PATCH 2/5] add linestretch (aka leading) in par --- data/templates/default.typst | 3 +++ data/templates/template.typst | 6 +++++- test/writer.typst | 5 ++++- 3 files changed, 12 insertions(+), 2 deletions(-) diff --git a/data/templates/default.typst b/data/templates/default.typst index 98044008cb0b..0b503e92975c 100644 --- a/data/templates/default.typst +++ b/data/templates/default.typst @@ -72,6 +72,9 @@ $endif$ $if(fontsize)$ fontsize: $fontsize$, $endif$ +$if(linestretch)$ + linestretch: $linestretch$, +$endif$ $if(section-numbering)$ sectionnumbering: "$section-numbering$", $endif$ diff --git a/data/templates/template.typst b/data/templates/template.typst index a2db7057ea9f..8772001e4f98 100644 --- a/data/templates/template.typst +++ b/data/templates/template.typst @@ -24,6 +24,7 @@ region: "US", font: (), fontsize: 11pt, + linestretch: 1, sectionnumbering: none, doc, ) = { @@ -37,7 +38,10 @@ margin: margin, numbering: "1", ) - set par(justify: true) + set par( + justify: true, + leading: linestretch * 0.65em + ) set text(lang: lang, region: region, font: font, diff --git a/test/writer.typst b/test/writer.typst index 576ee20f5dd2..0e2e765975d6 100644 --- a/test/writer.typst +++ b/test/writer.typst @@ -59,7 +59,10 @@ margin: margin, numbering: "1", ) - set par(justify: true) + set par( + justify: true, + leading: linestretch * 0.65em + ) set text(lang: lang, region: region, font: font, From 3b86a98ad2586e5146bbacba44f5ca48fc92f89b Mon Sep 17 00:00:00 2001 From: Christopher Kenny Date: Mon, 8 Jul 2024 22:14:37 -0400 Subject: [PATCH 3/5] add linestretch to test --- test/writer.typst | 1 + 1 file changed, 1 insertion(+) diff --git a/test/writer.typst b/test/writer.typst index 0e2e765975d6..0a0553b6dbbe 100644 --- a/test/writer.typst +++ b/test/writer.typst @@ -46,6 +46,7 @@ region: "US", font: (), fontsize: 11pt, + linestretch: 1, sectionnumbering: none, doc, ) = { From 608bbc24f582d69d17382e260afee8fb95dd5b81 Mon Sep 17 00:00:00 2001 From: Christopher Kenny Date: Mon, 8 Jul 2024 22:24:37 -0400 Subject: [PATCH 4/5] add font pieces --- data/templates/default.typst | 6 ++++++ data/templates/template.typst | 4 ++++ test/writer.typst | 4 ++++ 3 files changed, 14 insertions(+) diff --git a/data/templates/default.typst b/data/templates/default.typst index 0b503e92975c..631eeb4821a1 100644 --- a/data/templates/default.typst +++ b/data/templates/default.typst @@ -72,6 +72,12 @@ $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$ diff --git a/data/templates/template.typst b/data/templates/template.typst index 8772001e4f98..82857771d8c1 100644 --- a/data/templates/template.typst +++ b/data/templates/template.typst @@ -24,6 +24,8 @@ region: "US", font: (), fontsize: 11pt, + mathfont: "New Computer Modern Math", + codefont: "DejaVu Sans Mono", linestretch: 1, sectionnumbering: none, doc, @@ -46,6 +48,8 @@ region: region, font: font, size: fontsize) + show math.equation: set text(font: mathfont) + show raw: set text(font: codefont) set heading(numbering: sectionnumbering) if title != none { diff --git a/test/writer.typst b/test/writer.typst index 0a0553b6dbbe..4bbfe26cb20e 100644 --- a/test/writer.typst +++ b/test/writer.typst @@ -46,6 +46,8 @@ region: "US", font: (), fontsize: 11pt, + mathfont: "New Computer Modern Math", + codefont: "DejaVu Sans Mono", linestretch: 1, sectionnumbering: none, doc, @@ -68,6 +70,8 @@ region: region, font: font, size: fontsize) + show math.equation: set text(font: mathfont) + show raw: set text(font: codefont) set heading(numbering: sectionnumbering) if title != none { From 7b5bf8e93e986308a3a698a2a39376b450b4917a Mon Sep 17 00:00:00 2001 From: Christopher Kenny Date: Wed, 10 Jul 2024 18:12:20 -0400 Subject: [PATCH 5/5] add link colors --- data/templates/default.typst | 9 +++++++++ data/templates/template.typst | 16 +++++++++++++++- test/writer.typst | 16 +++++++++++++++- 3 files changed, 39 insertions(+), 2 deletions(-) diff --git a/data/templates/default.typst b/data/templates/default.typst index 631eeb4821a1..54498583d81d 100644 --- a/data/templates/default.typst +++ b/data/templates/default.typst @@ -83,6 +83,15 @@ $if(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 82857771d8c1..a1e3d962dcd1 100644 --- a/data/templates/template.typst +++ b/data/templates/template.typst @@ -28,11 +28,14 @@ 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( @@ -52,6 +55,17 @@ 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 #if thanks != none { diff --git a/test/writer.typst b/test/writer.typst index 4bbfe26cb20e..369b7b5f4cae 100644 --- a/test/writer.typst +++ b/test/writer.typst @@ -50,11 +50,14 @@ 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( @@ -74,6 +77,17 @@ 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 #if thanks != none {