Update & fix tutorial part 3 & 4 example code (#6778)

This commit is contained in:
Clemens Koza 2025-08-27 22:10:52 +02:00 committed by GitHub
parent 2d5fa4f0ff
commit 16758e7daa
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 167 additions and 154 deletions

View File

@ -51,7 +51,7 @@ Let's start by writing some set rules for the document.
```example ```example
#set page( #set page(
>>> margin: auto, >>> margin: auto,
paper: "us-letter", paper: "us-letter",
header: align(right)[ header: align(right)[
A fluid dynamic model for A fluid dynamic model for
@ -141,8 +141,6 @@ Now, let's add the abstract. Remember that the conference wants the abstract to
be set ragged and centered. be set ragged and centered.
```example:0,0,612,317.5 ```example:0,0,612,317.5
>>> #set text(font: "Libertinus Serif", 11pt)
>>> #set par(justify: true)
>>> #set page( >>> #set page(
>>> "us-letter", >>> "us-letter",
>>> margin: auto, >>> margin: auto,
@ -152,6 +150,8 @@ be set ragged and centered.
>>> ], >>> ],
>>> numbering: "1", >>> numbering: "1",
>>> ) >>> )
>>> #set par(justify: true)
>>> #set text(font: "Libertinus Serif", 11pt)
>>> >>>
>>> #align(center, text(17pt)[ >>> #align(center, text(17pt)[
>>> *A fluid dynamic model >>> *A fluid dynamic model
@ -200,18 +200,18 @@ keyword:
<<< ... <<< ...
>>> #set text(font: "Libertinus Serif", 11pt)
>>> #set par(justify: true)
#set page( #set page(
>>> "us-letter", >>> "us-letter",
>>> margin: auto, >>> margin: auto,
header: align( header: align(
right + horizon, right + horizon,
title title
), ),
<<< ... <<< ...
>>> numbering: "1", >>> numbering: "1",
) )
>>> #set par(justify: true)
>>> #set text(font: "Libertinus Serif", 11pt)
#align(center, text(17pt)[ #align(center, text(17pt)[
*#title* *#title*
@ -283,9 +283,6 @@ or bottom of the page is not occupied by any other content.
>>> for glacier flow >>> for glacier flow
>>> ] >>> ]
>>> >>>
>>> #set text(font: "Libertinus Serif", 11pt)
>>> #set par(justify: true)
>>>
#set page( #set page(
>>> margin: auto, >>> margin: auto,
paper: "us-letter", paper: "us-letter",
@ -296,6 +293,8 @@ or bottom of the page is not occupied by any other content.
numbering: "1", numbering: "1",
columns: 2, columns: 2,
) )
>>> #set par(justify: true)
>>> #set text(font: "Libertinus Serif", 11pt)
#place( #place(
top + center, top + center,
@ -303,25 +302,25 @@ or bottom of the page is not occupied by any other content.
scope: "parent", scope: "parent",
clearance: 2em, clearance: 2em,
)[ )[
>>> #text( >>> #text(
>>> 17pt, >>> 17pt,
>>> weight: "bold", >>> weight: "bold",
>>> title, >>> title,
>>> ) >>> )
>>> >>>
>>> #grid( >>> #grid(
>>> columns: (1fr, 1fr), >>> columns: (1fr, 1fr),
>>> [ >>> [
>>> Therese Tungsten \ >>> Therese Tungsten \
>>> Artos Institute \ >>> Artos Institute \
>>> #link("mailto:tung@artos.edu") >>> #link("mailto:tung@artos.edu")
>>> ], >>> ],
>>> [ >>> [
>>> Dr. John Doe \ >>> Dr. John Doe \
>>> Artos Institute \ >>> Artos Institute \
>>> #link("mailto:doe@artos.edu") >>> #link("mailto:doe@artos.edu")
>>> ] >>> ]
>>> ) >>> )
<<< ... <<< ...
#par(justify: false)[ #par(justify: false)[
@ -352,8 +351,6 @@ a way to set any of that, we need to write our own heading show rule.
>>> for glacier flow >>> for glacier flow
>>> ] >>> ]
>>> >>>
>>> #set text(font: "Libertinus Serif", 11pt)
>>> #set par(justify: true)
>>> #set page( >>> #set page(
>>> "us-letter", >>> "us-letter",
>>> margin: auto, >>> margin: auto,
@ -364,6 +361,8 @@ a way to set any of that, we need to write our own heading show rule.
>>> numbering: "1", >>> numbering: "1",
>>> columns: 2, >>> columns: 2,
>>> ) >>> )
>>> #set par(justify: true)
>>> #set text(font: "Libertinus Serif", 11pt)
#show heading: it => [ #show heading: it => [
#set align(center) #set align(center)
#set text(13pt, weight: "regular") #set text(13pt, weight: "regular")
@ -371,7 +370,6 @@ a way to set any of that, we need to write our own heading show rule.
] ]
<<< ... <<< ...
>>>
>>> #place( >>> #place(
>>> top + center, >>> top + center,
>>> float: true, >>> float: true,
@ -403,11 +401,13 @@ a way to set any of that, we need to write our own heading show rule.
>>> #lorem(80) >>> #lorem(80)
>>> ] >>> ]
>>> ] >>> ]
>>>
>>> = Introduction = Introduction
<<< ...
>>> #lorem(35) >>> #lorem(35)
>>>
>>> == Motivation == Motivation
<<< ...
>>> #lorem(45) >>> #lorem(45)
``` ```
@ -432,8 +432,6 @@ differentiate between section and subsection headings:
>>> for glacier flow >>> for glacier flow
>>> ] >>> ]
>>> >>>
>>> #set text(font: "Libertinus Serif", 11pt)
>>> #set par(justify: true)
>>> #set page( >>> #set page(
>>> "us-letter", >>> "us-letter",
>>> margin: auto, >>> margin: auto,
@ -444,6 +442,8 @@ differentiate between section and subsection headings:
>>> numbering: "1", >>> numbering: "1",
>>> columns: 2, >>> columns: 2,
>>> ) >>> )
>>> #set par(justify: true)
>>> #set text(font: "Libertinus Serif", 11pt)
>>> >>>
#show heading.where( #show heading.where(
level: 1 level: 1
@ -474,19 +474,19 @@ differentiate between section and subsection headings:
>>> title, >>> title,
>>> ) >>> )
>>> >>>
>>> #grid( >>> #grid(
>>> columns: (1fr, 1fr), >>> columns: (1fr, 1fr),
>>> [ >>> [
>>> Therese Tungsten \ >>> Therese Tungsten \
>>> Artos Institute \ >>> Artos Institute \
>>> #link("mailto:tung@artos.edu") >>> #link("mailto:tung@artos.edu")
>>> ], >>> ],
>>> [ >>> [
>>> Dr. John Doe \ >>> Dr. John Doe \
>>> Artos Institute \ >>> Artos Institute \
>>> #link("mailto:doe@artos.edu") >>> #link("mailto:doe@artos.edu")
>>> ] >>> ]
>>> ) >>> )
>>> >>>
>>> #par(justify: false)[ >>> #par(justify: false)[
>>> *Abstract* \ >>> *Abstract* \

View File

@ -99,6 +99,7 @@ previous chapter.
right + horizon, right + horizon,
title title
), ),
>>> numbering: "1",
columns: 2, columns: 2,
<<< ... <<< ...
) )
@ -110,27 +111,22 @@ previous chapter.
// Heading show rules. // Heading show rules.
<<< ... <<< ...
>>> show heading.where( >>> show heading.where(
>>> level: 1 >>> level: 1
>>> ): it => block( >>> ): it => block(width: 100%)[
>>> align(center, >>> #set align(center)
>>> text( >>> #set text(13pt, weight: "regular")
>>> 13pt, >>> #smallcaps(it.body)
>>> weight: "regular", >>> ]
>>> smallcaps(it.body), >>>
>>> ) >>> show heading.where(
>>> ), >>> level: 2
>>> ) >>> ): it => text(
>>> show heading.where( >>> size: 11pt,
>>> level: 2 >>> weight: "regular",
>>> ): it => box( >>> style: "italic",
>>> text( >>> it.body + [.],
>>> 11pt, >>> )
>>> weight: "regular",
>>> style: "italic",
>>> it.body + [.],
>>> )
>>> )
doc doc
} }
@ -141,9 +137,9 @@ previous chapter.
) )
= Introduction = Introduction
#lorem(90)
<<< ... <<< ...
>>> #lorem(90)
>>>
>>> == Motivation >>> == Motivation
>>> #lorem(140) >>> #lorem(140)
>>> >>>
@ -182,7 +178,10 @@ to work like this:
```typ ```typ
#show: doc => conf( #show: doc => conf(
title: [Towards Improved Modelling], title: [
A fluid dynamic model for
glacier flow
],
authors: ( authors: (
( (
name: "Theresa Tungsten", name: "Theresa Tungsten",
@ -240,30 +239,41 @@ The resulting template function looks like this:
doc, doc,
) = { ) = {
// Set and show rules from before. // Set and show rules from before.
>>> #set page(columns: 2) >>> // (skipped)
<<< ... <<< ...
set align(center) place(
text(17pt, title) top + center,
float: true,
scope: "parent",
clearance: 2em,
{
text(
17pt,
weight: "bold",
title,
)
let count = authors.len() let count = authors.len()
let ncols = calc.min(count, 3) let ncols = calc.min(count, 3)
grid( grid(
columns: (1fr,) * ncols, columns: (1fr,) * ncols,
row-gutter: 24pt, row-gutter: 24pt,
..authors.map(author => [ ..authors.map(author => [
#author.name \ #author.name \
#author.affiliation \ #author.affiliation \
#link("mailto:" + author.email) #link("mailto:" + author.email)
]), ]),
)
par(justify: false)[
*Abstract* \
#abstract
]
}
) )
par(justify: false)[
*Abstract* \
#abstract
]
set align(left)
doc doc
} }
``` ```
@ -291,71 +301,74 @@ call.
>>> abstract: [], >>> abstract: [],
>>> doc, >>> doc,
>>> ) = { >>> ) = {
>>> set text(font: "Libertinus Serif", 11pt) >>> set page(
>>> set par(justify: true) >>> "us-letter",
>>> set page( >>> margin: auto,
>>> "us-letter", >>> header: align(
>>> margin: auto, >>> right + horizon,
>>> header: align( >>> title
>>> right + horizon, >>> ),
>>> title >>> numbering: "1",
>>> ), >>> columns: 2,
>>> numbering: "1", >>> )
>>> columns: 2, >>> set par(justify: true)
>>> ) >>> set text(font: "Libertinus Serif", 11pt)
>>> >>>
>>> show heading.where( >>> show heading.where(
>>> level: 1 >>> level: 1
>>> ): it => block( >>> ): it => block(width: 100%)[
>>> align(center, >>> #set align(center)
>>> text( >>> #set text(13pt, weight: "regular")
>>> 13pt, >>> #smallcaps(it.body)
>>> weight: "regular", >>> ]
>>> smallcaps(it.body),
>>> )
>>> ),
>>> )
>>> show heading.where(
>>> level: 2
>>> ): it => box(
>>> text(
>>> 11pt,
>>> weight: "regular",
>>> style: "italic",
>>> it.body + [.],
>>> )
>>> )
>>> >>>
>>> place( >>> show heading.where(
>>> top, >>> level: 2
>>> float: true, >>> ): it => text(
>>> scope: "parent", >>> size: 11pt,
>>> clearance: 2em, >>> weight: "regular",
>>> { >>> style: "italic",
>>> set align(center) >>> it.body + [.],
>>> text(17pt, title) >>> )
>>> let count = calc.min(authors.len(), 3) >>>
>>> grid( >>> place(
>>> columns: (1fr,) * count, >>> top + center,
>>> row-gutter: 24pt, >>> float: true,
>>> ..authors.map(author => [ >>> scope: "parent",
>>> #author.name \ >>> clearance: 2em,
>>> #author.affiliation \ >>> {
>>> #link("mailto:" + author.email) >>> text(
>>> ]), >>> 17pt,
>>> ) >>> weight: "bold",
>>> par(justify: false)[ >>> title,
>>> *Abstract* \ >>> )
>>> #abstract >>>
>>> ] >>> let count = authors.len()
>>> }, >>> let ncols = calc.min(count, 3)
>>> ) >>> grid(
>>> doc >>> columns: (1fr,) * ncols,
>>>} >>> row-gutter: 24pt,
>>> ..authors.map(author => [
>>> #author.name \
>>> #author.affiliation \
>>> #link("mailto:" + author.email)
>>> ]),
>>> )
>>>
>>> par(justify: false)[
>>> *Abstract* \
>>> #abstract
>>> ]
>>> }
>>> )
>>>
>>> doc
>>> }
<<< #import "conf.typ": conf <<< #import "conf.typ": conf
#show: conf.with( #show: conf.with(
title: [ title: [
Towards Improved Modelling A fluid dynamic model for
glacier flow
], ],
authors: ( authors: (
( (