summaryrefslogtreecommitdiff
path: root/data/templates/template.typst
diff options
context:
space:
mode:
authorJohn MacFarlane <jgm@berkeley.edu>2023-03-26 13:37:08 -0700
committerJohn MacFarlane <jgm@berkeley.edu>2023-03-26 19:02:05 -0700
commitcd6b3bde622c93eea763e981692b4bc53dd5e5df (patch)
tree78659dda4e5c40ef4ab62e8ad3949165da442c9d /data/templates/template.typst
parent657ebffd8f4efe334e27e7398700c5b92e453363 (diff)
Typst writer improvements.
+ Fix non-decimal enumerated lists. + Fix endnotes ending with code blocks. + Improve default template to use a typst template. + Factor out definitions and typst template into partials. + Properly escape backslash and quote inside double quotes. + Update tests.
Diffstat (limited to 'data/templates/template.typst')
-rw-r--r--data/templates/template.typst73
1 files changed, 73 insertions, 0 deletions
diff --git a/data/templates/template.typst b/data/templates/template.typst
new file mode 100644
index 000000000..29edca969
--- /dev/null
+++ b/data/templates/template.typst
@@ -0,0 +1,73 @@
+#let conf(
+ title: none,
+ authors: none,
+ date: none,
+ abstract: none,
+ cols: 1,
+ margin: (x: 1.25in, y: 1.25in),
+ paper: "us-letter",
+ lang: none,
+ font: none,
+ fontsize: 11pt,
+ sectionnumbering: none,
+ doc,
+) = {
+ set page(
+ paper: paper,
+ margin: margin,
+ numbering: "1",
+ )
+ set par(justify: true)
+ if lang != none {
+ set text(lang: lang)
+ }
+ if font != none {
+ set text(font: font)
+ }
+ if fontsize != none {
+ set text(size: fontsize)
+ }
+ if sectionnumbering != none {
+ set heading(numbering: sectionnumbering)
+ }
+
+ if title != none {
+ align(center)[#block(inset: 2em)[
+ #text(weight: "bold", size: 1.5em)[#title]
+ ]]
+ }
+
+ if authors != none {
+ let count = authors.len()
+ let ncols = calc.min(count, 3)
+ grid(
+ columns: (1fr,) * ncols,
+ row-gutter: 1.5em,
+ ..authors.map(author =>
+ align(center)[
+ #author.name \
+ #author.affiliation \
+ #author.email
+ ]
+ )
+ )
+ }
+
+ if date != none {
+ align(center)[#block(inset: 1em)[
+ #date
+ ]]
+ }
+
+ if abstract != none {
+ block(inset: 2em)[
+ #text(weight: "semibold")[Abstract] #h(1em) #abstract
+ ]
+ }
+
+ if cols == 1 {
+ doc
+ } else {
+ columns(cols, doc)
+ }
+}