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

Adding new features to the Typst template #9970

Open
wants to merge 5 commits into
base: main
Choose a base branch
from

Conversation

christopherkenny
Copy link

This implements the changes suggested in #9956, with the exception of the filecolor/urlcolor one. These would require adding some regex to guess the link types. This is theoretically possible to do, but it wasn't clear to me that this is a good thing to put in a default template. Happy to adjust if you have thoughts on this.

Some things to note:

  • I'm converting colors by passing them as content, as I was seeing pandoc escape # if that was included. An alternative here is to just do something like: rgb(linkcolor.replace("\\#", "#")).
  • I set the default fonts for math and code ("raw") to fonts that are bundled with Typst. These need not be those fonts if there are more familiar pandoc preferences.

@christopherkenny
Copy link
Author

Hi @jgm, I don't want to bother you if this is already on your radar, but should I add you as a reviewer (for when you have time)? I'm not 100% sure of the norms for contributions here.

@jgm
Copy link
Owner

jgm commented Aug 23, 2024

Sorry for the delay on this!

Copy link
Owner

@jgm jgm left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for this PR, and sorry I took so long to review it. I made a number of queries and comments, which you can look over.

Comment on lines +75 to +80
$if(mathfont)$
mathfont: ($for(mathfont)$"$mathfont$",$endfor$),
$endif$
$if(codefont)$
codefont: ($for(codefont)$"$codefont$",$endfor$),
$endif$
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Curious why you used $for$ here. mathfont would normally be expected to be a string in pandoc templates.

Comment on lines +90 to +92
$if(citecolor)$
citecolor: [$citecolor$],
$endif$
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It works in content like this, with the escaped #?

citecolor: [\#ffffff]

You've tested I assume?

Comment on lines +27 to +28
mathfont: "New Computer Modern Math",
codefont: "DejaVu Sans Mono",
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are these different from the fonts Typst uses by default? Would it not be better to allow these to be specified but stay with Typst's normal defaults by default?

Comment on lines +31 to +33
linkcolor: ["#800000"],
citecolor: ["#0000FF"],
toccolor: ["#800000"],
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Again, is this the same as Typst's default behavior? If not, why these colors? Would it perhaps be better to make Typst use its standard defaults unless these are specified?

Comment on lines -31 to +38
author: authors.map(author => content-to-string(author.name)),
author: authors.map(author => content-to-string(author.name)).join(", ", last: ", and "),
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't like this because and is an English word; anyone writing in another language would need to change the template. We could consider using &, or just use commas.

Comment on lines +48 to +49
leading: linestretch * 0.65em
)
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What does the leading do here, and why is it needed with linestretch? Is the result the same as Typst's defaults when the default linestretch is used?

#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)
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I assume this is needed because otherwise the first note would be 2? That's a bit unexpected when numbering is explicitly specified, but maybe Typst works that way? (I'd consider it a bug if so.)

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

Successfully merging this pull request may close these issues.

3 participants