Skip to content

Commit 03face3

Browse files
updated typst partials for quarto create extension
addresses #11616
1 parent f951dde commit 03face3

File tree

2 files changed

+54
-4
lines changed

2 files changed

+54
-4
lines changed

src/resources/create/extensions/format-typst/_extensions/qstart-filesafename-qend/typst-show.typ

Lines changed: 28 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
12
// Typst custom formats typically consist of a 'typst-template.typ' (which is
23
// the source code for a typst template) and a 'typst-show.typ' which calls the
34
// template's function (forwarding Pandoc metadata values as required)
@@ -11,11 +12,13 @@
1112
// documentation on creating typst templates here and some examples here:
1213
// - https://typst.app/docs/tutorial/making-a-template/
1314
// - https://github.com/typst/templates
14-
1515
#show: doc => article(
1616
$if(title)$
1717
title: [$title$],
1818
$endif$
19+
$if(subtitle)$
20+
subtitle: [$subtitle$],
21+
$endif$
1922
$if(by-author)$
2023
authors: (
2124
$for(by-author)$
@@ -48,9 +51,33 @@ $if(papersize)$
4851
$endif$
4952
$if(mainfont)$
5053
font: ("$mainfont$",),
54+
$elseif(brand.typography.base.family)$
55+
font: ("$brand.typography.base.family$",),
5156
$endif$
5257
$if(fontsize)$
5358
fontsize: $fontsize$,
59+
$elseif(brand.typography.base.size)$
60+
fontsize: $brand.typography.base.size$,
61+
$endif$
62+
$if(title)$
63+
$if(brand.typography.headings.family)$
64+
heading-family: ("$brand.typography.headings.family$",),
65+
$endif$
66+
$if(brand.typography.headings.weight)$
67+
heading-weight: $brand.typography.headings.weight$,
68+
$endif$
69+
$if(brand.typography.headings.style)$
70+
heading-style: "$brand.typography.headings.style$",
71+
$endif$
72+
$if(brand.typography.headings.decoration)$
73+
heading-decoration: "$brand.typography.headings.decoration$",
74+
$endif$
75+
$if(brand.typography.headings.color)$
76+
heading-color: $brand.typography.headings.color$,
77+
$endif$
78+
$if(brand.typography.headings.line-height)$
79+
heading-line-height: $brand.typography.headings.line-height$,
80+
$endif$
5481
$endif$
5582
$if(section-numbering)$
5683
sectionnumbering: "$section-numbering$",

src/resources/create/extensions/format-typst/_extensions/qstart-filesafename-qend/typst-template.typ

Lines changed: 26 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313

1414
#let article(
1515
title: none,
16+
subtitle: none,
1617
authors: none,
1718
date: none,
1819
abstract: none,
@@ -22,8 +23,15 @@
2223
paper: "us-letter",
2324
lang: "en",
2425
region: "US",
25-
font: (),
26+
font: "linux libertine",
2627
fontsize: 11pt,
28+
title-size: 1.5em,
29+
subtitle-size: 1.25em,
30+
heading-family: "linux libertine",
31+
heading-weight: "bold",
32+
heading-style: "normal",
33+
heading-color: black,
34+
heading-line-height: 0.65em,
2735
sectionnumbering: none,
2836
toc: false,
2937
toc_title: none,
@@ -42,10 +50,25 @@
4250
font: font,
4351
size: fontsize)
4452
set heading(numbering: sectionnumbering)
45-
4653
if title != none {
4754
align(center)[#block(inset: 2em)[
48-
#text(weight: "bold", size: 1.5em)[#title]
55+
#set par(leading: heading-line-height)
56+
#if (heading-family != none or heading-weight != "bold" or heading-style != "normal"
57+
or heading-color != black or heading-decoration == "underline"
58+
or heading-background-color != none) {
59+
set text(font: heading-family, weight: heading-weight, style: heading-style, fill: heading-color)
60+
text(size: title-size)[#title]
61+
if subtitle != none {
62+
parbreak()
63+
text(size: subtitle-size)[#subtitle]
64+
}
65+
} else {
66+
text(weight: "bold", size: title-size)[#title]
67+
if subtitle != none {
68+
parbreak()
69+
text(weight: "bold", size: subtitle-size)[#subtitle]
70+
}
71+
}
4972
]]
5073
}
5174

0 commit comments

Comments
 (0)