summaryrefslogtreecommitdiff
path: root/docs/tutorial/3-advanced.md
diff options
context:
space:
mode:
Diffstat (limited to 'docs/tutorial/3-advanced.md')
-rw-r--r--docs/tutorial/3-advanced.md231
1 files changed, 133 insertions, 98 deletions
diff --git a/docs/tutorial/3-advanced.md b/docs/tutorial/3-advanced.md
index f1ed8154..b7f338db 100644
--- a/docs/tutorial/3-advanced.md
+++ b/docs/tutorial/3-advanced.md
@@ -10,7 +10,7 @@ base a conference paper on it! The report will of course have to comply with the
conference's style guide. Let's see how we can achieve that.
Before we start, let's create a team, invite your supervisor and add them to the
-team. You can do this by going back to the app dashboard with the back icon in
+team. You can do this by going back to the app dashboard with the back icon in
the top left corner of the editor. Then, choose the plus icon in the left
toolbar and create a team. Finally, click on the new team and go to its settings
by clicking 'manage team' next to the team name. Now you can invite your
@@ -248,17 +248,34 @@ on another title, we can easily change it in one place.
## Adding columns and headings { #columns-and-headings }
The paper above unfortunately looks like a wall of lead. To fix that, let's add
-some headings and switch our paper to a two-column layout. The [`columns`]
-function takes a number and content, and layouts the content into the specified
-number of columns. Since we want everything after the abstract to be in two
-columns, we need to apply the column function to our whole document.
-
-Instead of wrapping the whole document in a giant function call, we can use an
-"everything" show rule. To write such a show rule, put a colon directly behind
-the show keyword and then provide a function. This function is given the rest of
-the document as a parameter. We have called the parameter `rest` here, but you
-are free to choose any name. The function can then do anything with this
-content. In our case, it passes it on to the `columns` function.
+some headings and switch our paper to a two-column layout. Fortunately, that's
+easy to do: We just need to amend our `page` set rule with the `columns`
+argument.
+
+By adding `{columns: 2}` to the argument list, we have wrapped the whole
+document in two columns. However, that would also affect the title and authors
+overview. To keep them spanning the whole page, we can wrap them in a function
+call to [`{place}`]($place). Place expects an alignment and the content it
+should place as positional arguments. Using the named `{scope}` argument, we can
+decide if the items should be placed relative to the current column or its
+parent (the page). There is one more thing to configure: If no other arguments
+are provided, `{place}` takes its content out of the flow of the document and
+positions it over the other content without affecting the layout of other
+content in its container:
+
+```example
+#place(
+ top + center,
+ rect(fill: black),
+)
+#lorem(30)
+```
+
+If we hadn't used `{place}` here, the square would be in its own line, but here
+it overlaps the few lines of text following it. Likewise, that text acts like as
+if there was no square. To change this behavior, we can pass the argument
+`{float: true}` to ensure that the space taken up by the placed item at the top
+or bottom of the page is not occupied by any other content.
```example:single
>>> #let title = [
@@ -268,45 +285,50 @@ content. In our case, it passes it on to the `columns` function.
>>>
>>> #set text(font: "Libertinus Serif", 11pt)
>>> #set par(justify: true)
->>> #set page(
->>> "us-letter",
->>> margin: auto,
->>> header: align(
->>> right + horizon,
->>> title
->>> ),
->>> numbering: "1",
->>> )
>>>
->>> #align(center, text(
->>> 17pt,
->>> weight: "bold",
->>> title,
->>> ))
->>>
->>> #grid(
->>> columns: (1fr, 1fr),
->>> align(center)[
->>> Therese Tungsten \
->>> Artos Institute \
->>> #link("mailto:tung@artos.edu")
->>> ],
->>> align(center)[
->>> Dr. John Doe \
->>> Artos Institute \
->>> #link("mailto:doe@artos.edu")
->>> ]
->>> )
+#set page(
+>>> margin: auto,
+ paper: "us-letter",
+ header: align(
+ right + horizon,
+ title
+ ),
+ numbering: "1",
+ columns: 2,
+)
+
+#place(
+ top + center,
+ float: true,
+ scope: "parent",
+ clearance: 2em,
+)[
+>>> #text(
+>>> 17pt,
+>>> weight: "bold",
+>>> title,
+>>> )
>>>
->>> #align(center)[
->>> #set par(justify: false)
->>> *Abstract* \
->>> #lorem(80)
->>> ]
->>> #v(4mm)
-<<< ...
+>>> #grid(
+>>> columns: (1fr, 1fr),
+>>> [
+>>> Therese Tungsten \
+>>> Artos Institute \
+>>> #link("mailto:tung@artos.edu")
+>>> ],
+>>> [
+>>> Dr. John Doe \
+>>> Artos Institute \
+>>> #link("mailto:doe@artos.edu")
+>>> ]
+>>> )
+<<< ...
-#show: rest => columns(2, rest)
+ #par(justify: false)[
+ *Abstract* \
+ #lorem(80)
+ ]
+]
= Introduction
#lorem(300)
@@ -315,6 +337,11 @@ content. In our case, it passes it on to the `columns` function.
#lorem(200)
```
+In this example, we also used the `clearance` argument of the `{place}` function
+to provide the space between it and the body instead of using the [`{v}`]($v)
+function. We can also remove the explicit `{align(center, ..)}` calls around the
+various parts since they inherit the center alignment from the placement.
+
Now there is only one thing left to do: Style our headings. We need to make them
centered and use small capitals. Because the `heading` function does not offer
a way to set any of that, we need to write our own heading show rule.
@@ -335,6 +362,7 @@ a way to set any of that, we need to write our own heading show rule.
>>> title
>>> ),
>>> numbering: "1",
+>>> columns: 2,
>>> )
#show heading: it => [
#set align(center)
@@ -344,35 +372,38 @@ a way to set any of that, we need to write our own heading show rule.
<<< ...
>>>
->>> #align(center, text(
->>> 17pt,
->>> weight: "bold",
->>> title,
->>> ))
+>>> #place(
+>>> top + center,
+>>> float: true,
+>>> scope: "parent",
+>>> clearance: 2em,
+>>> )[
+>>> #text(
+>>> 17pt,
+>>> weight: "bold",
+>>> title,
+>>> )
>>>
->>> #grid(
->>> columns: (1fr, 1fr),
->>> align(center)[
->>> Therese Tungsten \
->>> Artos Institute \
->>> #link("mailto:tung@artos.edu")
->>> ],
->>> align(center)[
->>> 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")
+>>> ]
+>>> )
>>>
->>> #align(center)[
->>> #set par(justify: false)
->>> *Abstract* \
->>> #lorem(80)
+>>> #par(justify: false)[
+>>> *Abstract* \
+>>> #lorem(80)
+>>> ]
>>> ]
>>>
->>> #v(4mm)
->>> #show: rest => columns(2, rest)
->>>
>>> = Introduction
>>> #lorem(35)
>>>
@@ -411,6 +442,7 @@ differentiate between section and subsection headings:
>>> title
>>> ),
>>> numbering: "1",
+>>> columns: 2,
>>> )
>>>
#show heading.where(
@@ -430,35 +462,38 @@ differentiate between section and subsection headings:
it.body + [.],
)
>>>
->>> #align(center, text(
->>> 17pt,
->>> weight: "bold",
->>> title,
->>> ))
+>>> #place(
+>>> top + center,
+>>> float: true,
+>>> scope: "parent",
+>>> clearance: 2em,
+>>> )[
+>>> #text(
+>>> 17pt,
+>>> weight: "bold",
+>>> title,
+>>> )
>>>
->>> #grid(
->>> columns: (1fr, 1fr),
->>> align(center)[
->>> Therese Tungsten \
->>> Artos Institute \
->>> #link("mailto:tung@artos.edu")
->>> ],
->>> align(center)[
->>> 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")
+>>> ]
+>>> )
>>>
->>> #align(center)[
->>> #set par(justify: false)
->>> *Abstract* \
->>> #lorem(80)
+>>> #par(justify: false)[
+>>> *Abstract* \
+>>> #lorem(80)
+>>> ]
>>> ]
>>>
->>> #v(4mm)
->>> #show: rest => columns(2, rest)
->>>
>>> = Introduction
>>> #lorem(35)
>>>