Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
christopherkenny opened this issue Jul 5, 2024 · 1 comment

Comments

@christopherkenny
Copy link

christopherkenny commented Jul 5, 2024

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

  • thanks: To the call to #title, we could add:
#if thanks != none {
    footnote(thanks, numbering: "*")
    counter(footnote).update(n => n - 1)
}

Fonts

  • linestretch: 1 = single spaced, 2 = double spaced, and so on
set par(leading: linestretch * 0.65em)
  • mathfont:
#show math.equation: set text(font: mathfont)
  • codefont:
#show raw: set text(font: codefont)
  • linkcolor: Each color setting below require converting content to string or running a .replace("\\#", "#") on linkcolor due to pandoc's escaping
#show link: set text(fill: rgb(linkcolor))
  • filecolor, urlcolor: these have to be handled together as far as I know
#show link: this => {
    if type(this.dest) != label {
        text(this, fill: rgb(filecolor))
    }
}
  • citecolor:
#show ref: this => {
    text(this, fill: rgb(citecolor))
}
  • toccolor
#show link: this => {
    if type(this.dest) == label {
        text(this, fill: rgb(to-string(filecolor)))
    }
}

Metadata

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

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

Alternatives:

@jgm
Copy link
Owner

jgm commented Jul 6, 2024

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants