-
-
Notifications
You must be signed in to change notification settings - Fork 3.4k
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
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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$ | ||
Comment on lines
+90
to
+92
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It works in content like this, with the escaped
You've tested I assume? |
||
$if(toccolor)$ | ||
toccolor: [$toccolor$], | ||
$endif$ | ||
cols: $if(columns)$$columns$$else$1$endif$, | ||
doc, | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -16,36 +16,62 @@ | |
keywords: (), | ||
date: none, | ||
abstract: none, | ||
thanks: none, | ||
cols: 1, | ||
margin: (x: 1.25in, y: 1.25in), | ||
paper: "us-letter", | ||
lang: "en", | ||
region: "US", | ||
font: (), | ||
fontsize: 11pt, | ||
mathfont: "New Computer Modern Math", | ||
codefont: "DejaVu Sans Mono", | ||
Comment on lines
+27
to
+28
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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? |
||
linestretch: 1, | ||
sectionnumbering: none, | ||
linkcolor: ["#800000"], | ||
citecolor: ["#0000FF"], | ||
toccolor: ["#800000"], | ||
Comment on lines
+31
to
+33
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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? |
||
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 "), | ||
Comment on lines
-31
to
+38
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I don't like this because |
||
keywords: keywords, | ||
) | ||
set page( | ||
paper: paper, | ||
margin: margin, | ||
numbering: "1", | ||
) | ||
set par(justify: true) | ||
set par( | ||
justify: true, | ||
leading: linestretch * 0.65em | ||
) | ||
Comment on lines
+48
to
+49
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. What does the |
||
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) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I assume this is needed because otherwise the first note would be |
||
}] | ||
#(if subtitle != none { | ||
parbreak() | ||
text(weight: "bold", size: 1.25em)[#subtitle] | ||
|
There was a problem hiding this comment.
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.