diff options
| author | Laurenz <laurmaedje@gmail.com> | 2024-03-04 15:51:22 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-03-04 14:51:22 +0000 |
| commit | e3bd39c9d156a4a02a8b7398ed5769100a3d877a (patch) | |
| tree | f793037b515289f158a2b69dce3b516127c6b3fa /docs/guides/page-setup.md | |
| parent | b005dc37e5f7e2f519edc1f607f6ba3ab810ec26 (diff) | |
Add support for shortcut links in docs (#3547)
Diffstat (limited to 'docs/guides/page-setup.md')
| -rw-r--r-- | docs/guides/page-setup.md | 38 |
1 files changed, 18 insertions, 20 deletions
diff --git a/docs/guides/page-setup.md b/docs/guides/page-setup.md index a70f025f..14c35e1b 100644 --- a/docs/guides/page-setup.md +++ b/docs/guides/page-setup.md @@ -185,14 +185,13 @@ conditionally remove the header on the first page: #lorem(150) ``` -This example may look intimidating, but let's break it down: We are telling -Typst that the header depends on the current [location]($locate). The `loc` -value allows other functions to find out where on the page we currently are. We -then ask Typst if the page [counter]($counter) is larger than one at our current -position. The page counter starts at one, so we are skipping the header on a -single page. Counters may have multiple levels. This feature is used for items -like headings, but the page counter will always have a single level, so we can -just look at the first one. +This example may look intimidating, but let's break it down: By using the +`{context}` keyword, we are telling Typst that the header depends on where we +are in the document. We then ask Typst if the page [counter] is larger than one +at our (context-dependant) current position. The page counter starts at one, so +we are skipping the header on a single page. Counters may have multiple levels. +This feature is used for items like headings, but the page counter will always +have a single level, so we can just look at the first one. You can, of course, add an `else` to this example to add a different header to the first page instead. @@ -201,8 +200,8 @@ the first page instead. The technique described in the previous section can be adapted to perform more advanced tasks using Typst's labels. For example, pages with big tables could omit their headers to help keep clutter down. We will mark our tables with a -`<big-table>` [label]($label) and use the [query system]($query) to find out if -such a label exists on the current page: +`<big-table>` [label] and use the [query system]($query) to find out if such a +label exists on the current page: ```typ >>> #set page("a5", margin: (x: 2.5cm, y: 3cm)) @@ -334,10 +333,9 @@ This page has a custom footer. ``` In this example, we use the number of pages to create an array of -[circles]($circle). The circles are wrapped in a [box]($box) so they can all -appear on the same line because they are blocks and would otherwise create -paragraph breaks. The length of this [array]($array) depends on the current page -number. +[circles]($circle). The circles are wrapped in a [box] so they can all appear on +the same line because they are blocks and would otherwise create paragraph +breaks. The length of this [array] depends on the current page number. We then insert the circles at the right side of the footer, with 1pt of space between them. The join method of an array will attempt to @@ -354,8 +352,8 @@ want to start with the first page only after the title page. Or maybe you need to skip a few page numbers because you will insert pages into the final printed product. -The right way to modify the page number is to manipulate the page -[counter]($counter). The simplest manipulation is to set the counter back to 1. +The right way to modify the page number is to manipulate the page [counter]. The +simplest manipulation is to set the counter back to 1. ```typ #counter(page).update(1) @@ -373,8 +371,8 @@ In this example, we skip five pages. `n` is the current value of the page counter and `n + 5` is the return value of our function. In case you need to retrieve the actual page number instead of the value of the -page counter, you can use the [`page`]($locate) method on the argument of the -`{locate}` closure: +page counter, you can use the [`page`]($location.page) method on the return +value of the [`here`] function: ```example #counter(page).update(n => n + 5) @@ -384,8 +382,8 @@ page counter, you can use the [`page`]($locate) method on the argument of the #context here().page() ``` -You can also obtain the page numbering pattern from the `{locate}` closure -parameter with the [`page-numbering`]($locate) method. +You can also obtain the page numbering pattern from the location returned by +`here` with the [`page-numbering`]($location.page-numbering) method. ## Add columns { #columns } Add columns to your document to fit more on a page while maintaining legible |
