Skip to content

Commit 4c69f28

Browse files
committed
Revert "Add features to typst base template."
This reverts commit f000fa1.
1 parent 93f8145 commit 4c69f28

4 files changed

Lines changed: 75 additions & 165 deletions

File tree

MANUAL.txt

Lines changed: 1 addition & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -2730,7 +2730,7 @@ Currently the following pipes are predefined:
27302730
documents
27312731

27322732
`abstract-title`
2733-
: title of abstract, currently used only in HTML, EPUB, docx, and Typst.
2733+
: title of abstract, currently used only in HTML, EPUB, and docx.
27342734
This will be set automatically to a localized value,
27352735
depending on `lang`, but can be manually overridden.
27362736

@@ -3403,19 +3403,6 @@ The `--css` option also affects the output.
34033403
`columns`
34043404
: Number of columns for body text.
34053405

3406-
`thanks`
3407-
: contents of acknowledgments footnote after document title
3408-
3409-
`mathfont`, `codefont`
3410-
: Name of system font to use for math and code, respectively.
3411-
3412-
`linestretch`
3413-
: adjusts line spacing, e.g. `1.25`, `1.5`
3414-
3415-
`linkcolor`, `filecolor`, `citecolor`
3416-
: color for external links, internal links, and citation links,
3417-
respectively: expects a hexadecimal color code
3418-
34193406
### Variables for ms
34203407

34213408
`fontfamily`

data/templates/default.typst

Lines changed: 0 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -71,15 +71,9 @@ $endif$
7171
$if(region)$
7272
region: "$region$",
7373
$endif$
74-
$if(abstract-title)$
75-
abstract-title: [$abstract-title$],
76-
$endif$
7774
$if(abstract)$
7875
abstract: [$abstract$],
7976
$endif$
80-
$if(thanks)$
81-
thanks: [$thanks$],
82-
$endif$
8377
$if(margin)$
8478
margin: ($for(margin/pairs)$$margin.key$: $margin.value$,$endfor$),
8579
$endif$
@@ -92,28 +86,10 @@ $endif$
9286
$if(fontsize)$
9387
fontsize: $fontsize$,
9488
$endif$
95-
$if(mathfont)$
96-
mathfont: ($for(mathfont)$"$mathfont$",$endfor$),
97-
$endif$
98-
$if(codefont)$
99-
codefont: ($for(codefont)$"$codefont$",$endfor$),
100-
$endif$
101-
$if(linestretch)$
102-
linestretch: $linestretch$,
103-
$endif$
10489
$if(section-numbering)$
10590
sectionnumbering: "$section-numbering$",
10691
$endif$
10792
pagenumbering: $if(page-numbering)$"$page-numbering$"$else$none$endif$,
108-
$if(linkcolor)$
109-
linkcolor: [$linkcolor$],
110-
$endif$
111-
$if(citecolor)$
112-
citecolor: [$citecolor$],
113-
$endif$
114-
$if(filecolor)$
115-
filecolor: [$filecolor$],
116-
$endif$
11793
cols: $if(columns)$$columns$$else$1$endif$,
11894
doc,
11995
)

data/templates/template.typst

Lines changed: 37 additions & 63 deletions
Original file line numberDiff line numberDiff line change
@@ -15,100 +15,74 @@
1515
authors: (),
1616
keywords: (),
1717
date: none,
18-
abstract-title: none,
1918
abstract: none,
20-
thanks: none,
2119
cols: 1,
2220
margin: (x: 1.25in, y: 1.25in),
2321
paper: "us-letter",
2422
lang: "en",
2523
region: "US",
2624
font: (),
2725
fontsize: 11pt,
28-
mathfont: none,
29-
codefont: none,
30-
linestretch: 1,
3126
sectionnumbering: none,
32-
linkcolor: none,
33-
citecolor: none,
34-
filecolor: none,
3527
pagenumbering: "1",
3628
doc,
3729
) = {
3830
set document(
3931
title: title,
40-
author: authors.map(author => content-to-string(author.name)).join(", ", last: " & "),
32+
author: authors.map(author => content-to-string(author.name)),
4133
keywords: keywords,
4234
)
4335
set page(
4436
paper: paper,
4537
margin: margin,
4638
numbering: pagenumbering,
47-
)
48-
49-
set par(
50-
justify: true,
51-
leading: linestretch * 0.65em
52-
)
39+
columns: cols,
40+
)
41+
set par(justify: true)
5342
set text(lang: lang,
5443
region: region,
5544
font: font,
5645
size: fontsize)
57-
58-
show math.equation: set text(font: mathfont) if mathfont != none
59-
show raw: set text(font: codefont) if codefont != none
60-
6146
set heading(numbering: sectionnumbering)
6247

63-
show link: set text(fill: rgb(content-to-string(linkcolor))) if linkcolor != none
64-
show ref: set text(fill: rgb(content-to-string(citecolor))) if citecolor != none
65-
show link: this => {
66-
if filecolor != none and type(this.dest) == label {
67-
text(this, fill: rgb(content-to-string(filecolor)))
68-
}
48+
place(top, float: true, scope: "parent", clearance: 4mm)[
49+
#if title != none {
50+
align(center)[#block(inset: 2em)[
51+
#text(weight: "bold", size: 1.5em)[#title]
52+
#(if subtitle != none {
53+
parbreak()
54+
text(weight: "bold", size: 1.25em)[#subtitle]
55+
})
56+
]]
6957
}
7058

71-
block(below: 4mm)[
72-
#if title != none {
73-
align(center)[#block(inset: 2em)[
74-
#text(weight: "bold", size: 1.5em)[#title #if thanks != none {
75-
footnote(thanks, numbering: "*")
76-
counter(footnote).update(n => n - 1)
77-
}]
78-
#(
79-
if subtitle != none {
80-
parbreak()
81-
text(weight: "bold", size: 1.25em)[#subtitle]
82-
}
83-
)
84-
]]
85-
}
86-
87-
#if authors != none and authors != [] {
88-
let count = authors.len()
89-
let ncols = calc.min(count, 3)
90-
grid(
91-
columns: (1fr,) * ncols,
92-
row-gutter: 1.5em,
93-
..authors.map(author => align(center)[
94-
#author.name \
95-
#author.affiliation \
96-
#author.email
97-
])
59+
#if authors != none and authors != [] {
60+
let count = authors.len()
61+
let ncols = calc.min(count, 3)
62+
grid(
63+
columns: (1fr,) * ncols,
64+
row-gutter: 1.5em,
65+
..authors.map(author =>
66+
align(center)[
67+
#author.name \
68+
#author.affiliation \
69+
#author.email
70+
]
9871
)
99-
}
72+
)
73+
}
10074

101-
#if date != none {
102-
align(center)[#block(inset: 1em)[
103-
#date
104-
]]
105-
}
75+
#if date != none {
76+
align(center)[#block(inset: 1em)[
77+
#date
78+
]]
79+
}
10680

107-
#if abstract != none {
108-
block(inset: 2em)[
109-
#text(weight: "semibold")[#abstract-title] #h(1em) #abstract
110-
]
111-
}
81+
#if abstract != none {
82+
block(inset: 2em)[
83+
#text(weight: "semibold")[$if(abstract-title)$${abstract-title}$else$Abstract$endif$] #h(1em) #abstract
84+
]
85+
}
11286
]
11387

11488
doc

test/writer.typst

Lines changed: 37 additions & 64 deletions
Original file line numberDiff line numberDiff line change
@@ -39,100 +39,74 @@
3939
authors: (),
4040
keywords: (),
4141
date: none,
42-
abstract-title: none,
4342
abstract: none,
44-
thanks: none,
4543
cols: 1,
4644
margin: (x: 1.25in, y: 1.25in),
4745
paper: "us-letter",
4846
lang: "en",
4947
region: "US",
5048
font: (),
5149
fontsize: 11pt,
52-
mathfont: none,
53-
codefont: none,
54-
linestretch: 1,
5550
sectionnumbering: none,
56-
linkcolor: none,
57-
citecolor: none,
58-
filecolor: none,
5951
pagenumbering: "1",
6052
doc,
6153
) = {
6254
set document(
6355
title: title,
64-
author: authors.map(author => content-to-string(author.name)).join(", ", last: " & "),
56+
author: authors.map(author => content-to-string(author.name)),
6557
keywords: keywords,
6658
)
6759
set page(
6860
paper: paper,
6961
margin: margin,
7062
numbering: pagenumbering,
71-
)
72-
73-
set par(
74-
justify: true,
75-
leading: linestretch * 0.65em
76-
)
63+
columns: cols,
64+
)
65+
set par(justify: true)
7766
set text(lang: lang,
7867
region: region,
7968
font: font,
8069
size: fontsize)
81-
82-
show math.equation: set text(font: mathfont) if mathfont != none
83-
show raw: set text(font: codefont) if codefont != none
84-
8570
set heading(numbering: sectionnumbering)
8671

87-
show link: set text(fill: rgb(content-to-string(linkcolor))) if linkcolor != none
88-
show ref: set text(fill: rgb(content-to-string(citecolor))) if citecolor != none
89-
show link: this => {
90-
if filecolor != none and type(this.dest) == label {
91-
text(this, fill: rgb(content-to-string(filecolor)))
92-
}
72+
place(top, float: true, scope: "parent", clearance: 4mm)[
73+
#if title != none {
74+
align(center)[#block(inset: 2em)[
75+
#text(weight: "bold", size: 1.5em)[#title]
76+
#(if subtitle != none {
77+
parbreak()
78+
text(weight: "bold", size: 1.25em)[#subtitle]
79+
})
80+
]]
9381
}
9482

95-
block(below: 4mm)[
96-
#if title != none {
97-
align(center)[#block(inset: 2em)[
98-
#text(weight: "bold", size: 1.5em)[#title #if thanks != none {
99-
footnote(thanks, numbering: "*")
100-
counter(footnote).update(n => n - 1)
101-
}]
102-
#(
103-
if subtitle != none {
104-
parbreak()
105-
text(weight: "bold", size: 1.25em)[#subtitle]
106-
}
107-
)
108-
]]
109-
}
110-
111-
#if authors != none and authors != [] {
112-
let count = authors.len()
113-
let ncols = calc.min(count, 3)
114-
grid(
115-
columns: (1fr,) * ncols,
116-
row-gutter: 1.5em,
117-
..authors.map(author => align(center)[
118-
#author.name \
119-
#author.affiliation \
120-
#author.email
121-
])
83+
#if authors != none and authors != [] {
84+
let count = authors.len()
85+
let ncols = calc.min(count, 3)
86+
grid(
87+
columns: (1fr,) * ncols,
88+
row-gutter: 1.5em,
89+
..authors.map(author =>
90+
align(center)[
91+
#author.name \
92+
#author.affiliation \
93+
#author.email
94+
]
12295
)
123-
}
96+
)
97+
}
12498

125-
#if date != none {
126-
align(center)[#block(inset: 1em)[
127-
#date
128-
]]
129-
}
99+
#if date != none {
100+
align(center)[#block(inset: 1em)[
101+
#date
102+
]]
103+
}
130104

131-
#if abstract != none {
132-
block(inset: 2em)[
133-
#text(weight: "semibold")[#abstract-title] #h(1em) #abstract
134-
]
135-
}
105+
#if abstract != none {
106+
block(inset: 2em)[
107+
#text(weight: "semibold")[Abstract] #h(1em) #abstract
108+
]
109+
}
136110
]
137111

138112
doc
@@ -148,7 +122,6 @@
148122
email: "" ),
149123
),
150124
date: [July 17, 2006],
151-
abstract-title: [Abstract],
152125
pagenumbering: "1",
153126
cols: 1,
154127
doc,

0 commit comments

Comments
 (0)