jgm / pandoc

Universal markup converter
https://pandoc.org
Other
33.44k stars 3.32k forks source link

Improving the Typst base template to match equivalent PDF options #9956

Open christopherkenny opened 3 weeks ago

christopherkenny commented 3 weeks ago

Proposed Improvement:

The default template for Typst currently supports many fewer base features than the PDF template. This, of course makes sense, as Typst is much newer. Many features included in PDF templates could be added to the Typst base template without substantial amounts of code. Below, I've shortened a list from a discussion in Quarto:

Title & Author

#if thanks != none {
    footnote(thanks, numbering: "*")
    counter(footnote).update(n => n - 1)
}

Fonts

set par(leading: linestretch * 0.65em)
#show math.equation: set text(font: mathfont)
#show raw: set text(font: codefont)
#show link: set text(fill: rgb(linkcolor))
#show link: this => {
    if type(this.dest) != label {
        text(this, fill: rgb(filecolor))
    }
}
#show ref: this => {
    text(this, fill: rgb(citecolor))
}
#show link: this => {
    if type(this.dest) == label {
        text(this, fill: rgb(to-string(filecolor)))
    }
}

Metadata

#set document(keywords: keywords)
#set document(title: title-meta)
#set document(author: author-meta)

I'm happy to PR in any of these, if you are interested.

Alternatives:

jgm commented 3 weeks ago

I'd certainly consider a PR with changes like this. (It would need careful testing, though.)

Note that author-meta and title-meta are just used in formats that require special treatment for these fields (e.g. formats where these can't contain formatting); we don't use them for typst.