From 16758e7daa3de1fb657904b4d17829dd894b84ee Mon Sep 17 00:00:00 2001 From: Clemens Koza Date: Wed, 27 Aug 2025 22:10:52 +0200 Subject: [PATCH] Update & fix tutorial part 3 & 4 example code (#6778) --- docs/tutorial/3-advanced.md | 102 ++++++++--------- docs/tutorial/4-template.md | 219 +++++++++++++++++++----------------- 2 files changed, 167 insertions(+), 154 deletions(-) diff --git a/docs/tutorial/3-advanced.md b/docs/tutorial/3-advanced.md index 41e60ece..06a604fb 100644 --- a/docs/tutorial/3-advanced.md +++ b/docs/tutorial/3-advanced.md @@ -51,7 +51,7 @@ Let's start by writing some set rules for the document. ```example #set page( ->>> margin: auto, +>>> margin: auto, paper: "us-letter", header: align(right)[ 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. ```example:0,0,612,317.5 ->>> #set text(font: "Libertinus Serif", 11pt) ->>> #set par(justify: true) >>> #set page( >>> "us-letter", >>> margin: auto, @@ -152,6 +150,8 @@ be set ragged and centered. >>> ], >>> numbering: "1", >>> ) +>>> #set par(justify: true) +>>> #set text(font: "Libertinus Serif", 11pt) >>> >>> #align(center, text(17pt)[ >>> *A fluid dynamic model @@ -200,18 +200,18 @@ keyword: <<< ... ->>> #set text(font: "Libertinus Serif", 11pt) ->>> #set par(justify: true) #set page( ->>> "us-letter", ->>> margin: auto, +>>> "us-letter", +>>> margin: auto, header: align( right + horizon, title ), <<< ... ->>> numbering: "1", +>>> numbering: "1", ) +>>> #set par(justify: true) +>>> #set text(font: "Libertinus Serif", 11pt) #align(center, text(17pt)[ *#title* @@ -283,9 +283,6 @@ or bottom of the page is not occupied by any other content. >>> for glacier flow >>> ] >>> ->>> #set text(font: "Libertinus Serif", 11pt) ->>> #set par(justify: true) ->>> #set page( >>> margin: auto, paper: "us-letter", @@ -296,6 +293,8 @@ or bottom of the page is not occupied by any other content. numbering: "1", columns: 2, ) +>>> #set par(justify: true) +>>> #set text(font: "Libertinus Serif", 11pt) #place( top + center, @@ -303,25 +302,25 @@ or bottom of the page is not occupied by any other content. scope: "parent", clearance: 2em, )[ ->>> #text( ->>> 17pt, ->>> weight: "bold", ->>> title, ->>> ) +>>> #text( +>>> 17pt, +>>> weight: "bold", +>>> title, +>>> ) >>> ->>> #grid( ->>> columns: (1fr, 1fr), ->>> [ ->>> Therese Tungsten \ ->>> Artos Institute \ ->>> #link("mailto:tung@artos.edu") ->>> ], ->>> [ ->>> Dr. John Doe \ ->>> Artos Institute \ ->>> #link("mailto:doe@artos.edu") ->>> ] ->>> ) +>>> #grid( +>>> columns: (1fr, 1fr), +>>> [ +>>> Therese Tungsten \ +>>> Artos Institute \ +>>> #link("mailto:tung@artos.edu") +>>> ], +>>> [ +>>> Dr. John Doe \ +>>> Artos Institute \ +>>> #link("mailto:doe@artos.edu") +>>> ] +>>> ) <<< ... #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 >>> ] >>> ->>> #set text(font: "Libertinus Serif", 11pt) ->>> #set par(justify: true) >>> #set page( >>> "us-letter", >>> margin: auto, @@ -364,6 +361,8 @@ a way to set any of that, we need to write our own heading show rule. >>> numbering: "1", >>> columns: 2, >>> ) +>>> #set par(justify: true) +>>> #set text(font: "Libertinus Serif", 11pt) #show heading: it => [ #set align(center) #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( >>> top + center, >>> float: true, @@ -403,11 +401,13 @@ a way to set any of that, we need to write our own heading show rule. >>> #lorem(80) >>> ] >>> ] ->>> ->>> = Introduction + += Introduction +<<< ... >>> #lorem(35) ->>> ->>> == Motivation + +== Motivation +<<< ... >>> #lorem(45) ``` @@ -432,8 +432,6 @@ differentiate between section and subsection headings: >>> for glacier flow >>> ] >>> ->>> #set text(font: "Libertinus Serif", 11pt) ->>> #set par(justify: true) >>> #set page( >>> "us-letter", >>> margin: auto, @@ -444,6 +442,8 @@ differentiate between section and subsection headings: >>> numbering: "1", >>> columns: 2, >>> ) +>>> #set par(justify: true) +>>> #set text(font: "Libertinus Serif", 11pt) >>> #show heading.where( level: 1 @@ -474,19 +474,19 @@ differentiate between section and subsection headings: >>> title, >>> ) >>> ->>> #grid( ->>> columns: (1fr, 1fr), ->>> [ ->>> Therese Tungsten \ ->>> Artos Institute \ ->>> #link("mailto:tung@artos.edu") ->>> ], ->>> [ ->>> Dr. John Doe \ ->>> Artos Institute \ ->>> #link("mailto:doe@artos.edu") ->>> ] ->>> ) +>>> #grid( +>>> columns: (1fr, 1fr), +>>> [ +>>> Therese Tungsten \ +>>> Artos Institute \ +>>> #link("mailto:tung@artos.edu") +>>> ], +>>> [ +>>> Dr. John Doe \ +>>> Artos Institute \ +>>> #link("mailto:doe@artos.edu") +>>> ] +>>> ) >>> >>> #par(justify: false)[ >>> *Abstract* \ diff --git a/docs/tutorial/4-template.md b/docs/tutorial/4-template.md index 7542cd6e..3950e860 100644 --- a/docs/tutorial/4-template.md +++ b/docs/tutorial/4-template.md @@ -99,6 +99,7 @@ previous chapter. right + horizon, title ), +>>> numbering: "1", columns: 2, <<< ... ) @@ -110,27 +111,22 @@ previous chapter. // Heading show rules. <<< ... ->>> show heading.where( ->>> level: 1 ->>> ): it => block( ->>> align(center, ->>> text( ->>> 13pt, ->>> weight: "regular", ->>> smallcaps(it.body), ->>> ) ->>> ), ->>> ) ->>> show heading.where( ->>> level: 2 ->>> ): it => box( ->>> text( ->>> 11pt, ->>> weight: "regular", ->>> style: "italic", ->>> it.body + [.], ->>> ) ->>> ) +>>> show heading.where( +>>> level: 1 +>>> ): it => block(width: 100%)[ +>>> #set align(center) +>>> #set text(13pt, weight: "regular") +>>> #smallcaps(it.body) +>>> ] +>>> +>>> show heading.where( +>>> level: 2 +>>> ): it => text( +>>> size: 11pt, +>>> weight: "regular", +>>> style: "italic", +>>> it.body + [.], +>>> ) doc } @@ -141,9 +137,9 @@ previous chapter. ) = Introduction -#lorem(90) - <<< ... +>>> #lorem(90) +>>> >>> == Motivation >>> #lorem(140) >>> @@ -182,7 +178,10 @@ to work like this: ```typ #show: doc => conf( - title: [Towards Improved Modelling], + title: [ + A fluid dynamic model for + glacier flow + ], authors: ( ( name: "Theresa Tungsten", @@ -240,30 +239,41 @@ The resulting template function looks like this: doc, ) = { // Set and show rules from before. ->>> #set page(columns: 2) +>>> // (skipped) <<< ... - set align(center) - text(17pt, title) + place( + top + center, + float: true, + scope: "parent", + clearance: 2em, + { + text( + 17pt, + weight: "bold", + title, + ) - let count = authors.len() - let ncols = calc.min(count, 3) - grid( - columns: (1fr,) * ncols, - row-gutter: 24pt, - ..authors.map(author => [ - #author.name \ - #author.affiliation \ - #link("mailto:" + author.email) - ]), + let count = authors.len() + let ncols = calc.min(count, 3) + grid( + columns: (1fr,) * ncols, + row-gutter: 24pt, + ..authors.map(author => [ + #author.name \ + #author.affiliation \ + #link("mailto:" + author.email) + ]), + ) + + par(justify: false)[ + *Abstract* \ + #abstract + ] + + } ) - par(justify: false)[ - *Abstract* \ - #abstract - ] - - set align(left) doc } ``` @@ -291,71 +301,74 @@ call. >>> abstract: [], >>> doc, >>> ) = { ->>> set text(font: "Libertinus Serif", 11pt) ->>> set par(justify: true) ->>> set page( ->>> "us-letter", ->>> margin: auto, ->>> header: align( ->>> right + horizon, ->>> title ->>> ), ->>> numbering: "1", ->>> columns: 2, ->>> ) +>>> set page( +>>> "us-letter", +>>> margin: auto, +>>> header: align( +>>> right + horizon, +>>> title +>>> ), +>>> numbering: "1", +>>> columns: 2, +>>> ) +>>> set par(justify: true) +>>> set text(font: "Libertinus Serif", 11pt) >>> ->>> show heading.where( ->>> level: 1 ->>> ): it => block( ->>> align(center, ->>> text( ->>> 13pt, ->>> weight: "regular", ->>> smallcaps(it.body), ->>> ) ->>> ), ->>> ) ->>> show heading.where( ->>> level: 2 ->>> ): it => box( ->>> text( ->>> 11pt, ->>> weight: "regular", ->>> style: "italic", ->>> it.body + [.], ->>> ) ->>> ) +>>> show heading.where( +>>> level: 1 +>>> ): it => block(width: 100%)[ +>>> #set align(center) +>>> #set text(13pt, weight: "regular") +>>> #smallcaps(it.body) +>>> ] >>> ->>> place( ->>> top, ->>> float: true, ->>> scope: "parent", ->>> clearance: 2em, ->>> { ->>> set align(center) ->>> text(17pt, title) ->>> let count = calc.min(authors.len(), 3) ->>> grid( ->>> columns: (1fr,) * count, ->>> row-gutter: 24pt, ->>> ..authors.map(author => [ ->>> #author.name \ ->>> #author.affiliation \ ->>> #link("mailto:" + author.email) ->>> ]), ->>> ) ->>> par(justify: false)[ ->>> *Abstract* \ ->>> #abstract ->>> ] ->>> }, ->>> ) ->>> doc ->>>} +>>> show heading.where( +>>> level: 2 +>>> ): it => text( +>>> size: 11pt, +>>> weight: "regular", +>>> style: "italic", +>>> it.body + [.], +>>> ) +>>> +>>> place( +>>> top + center, +>>> float: true, +>>> scope: "parent", +>>> clearance: 2em, +>>> { +>>> text( +>>> 17pt, +>>> weight: "bold", +>>> title, +>>> ) +>>> +>>> let count = authors.len() +>>> let ncols = calc.min(count, 3) +>>> grid( +>>> 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 #show: conf.with( title: [ - Towards Improved Modelling + A fluid dynamic model for + glacier flow ], authors: ( (