diff options
| author | Laurenz <laurmaedje@gmail.com> | 2024-02-27 11:05:16 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-02-27 10:05:16 +0000 |
| commit | 145723b1ef4fa23f1f6665b8907dfe79d0bf83cf (patch) | |
| tree | 02a7de661ddd5dafa75dfce3e3c8b45a7333b9dc /docs/guides | |
| parent | e9ee00a7c0df083663ff5ccca162238b88525e14 (diff) | |
New context system (#3497)
Diffstat (limited to 'docs/guides')
| -rw-r--r-- | docs/guides/guide-for-latex-users.md | 4 | ||||
| -rw-r--r-- | docs/guides/page-setup.md | 45 |
2 files changed, 24 insertions, 25 deletions
diff --git a/docs/guides/guide-for-latex-users.md b/docs/guides/guide-for-latex-users.md index 4b8c43b1..d991ef78 100644 --- a/docs/guides/guide-for-latex-users.md +++ b/docs/guides/guide-for-latex-users.md @@ -603,7 +603,7 @@ The example below This should be a good starting point! If you want to go further, why not create a reusable template? -## Bibliographies { #bibliographies } +## Bibliographies Typst includes a fully-featured bibliography system that is compatible with BibTeX files. You can continue to use your `.bib` literature libraries by loading them with the [`bibliography`]($bibliography) function. Another @@ -627,7 +627,7 @@ use in prose (cf. `\citet` and `\textcite`) are available with You can find more information on the documentation page of the [`bibliography`]($bibliography) function. -## Installation { #installation } +## Installation You have two ways to use Typst: In [our web app](https://typst.app/signup/) or by [installing the compiler](https://github.com/typst/typst/releases) on your computer. When you use the web app, we provide a batteries-included diff --git a/docs/guides/page-setup.md b/docs/guides/page-setup.md index 046bf9f4..a70f025f 100644 --- a/docs/guides/page-setup.md +++ b/docs/guides/page-setup.md @@ -174,13 +174,13 @@ conditionally remove the header on the first page: ```typ >>> #set page("a5", margin: (x: 2.5cm, y: 3cm)) -#set page(header: locate(loc => { - if counter(page).at(loc).first() > 1 [ +#set page(header: context { + if counter(page).get().first() > 1 [ _Lisa Strassner's Thesis_ #h(1fr) National Academy of Sciences ] -})) +}) #lorem(150) ``` @@ -206,12 +206,12 @@ such a label exists on the current page: ```typ >>> #set page("a5", margin: (x: 2.5cm, y: 3cm)) -#set page(header: locate(loc => { - let page-counter = counter(page) - let matches = query(<big-table>, loc) - let current = page-counter.at(loc) +#set page(header: context { + let page-counter = + let matches = query(<big-table>) + let current = counter(page).get() let has-table = matches.any(m => - page-counter.at(m.location()) == current + counter(page).at(m.location()) == current ) if not has-table [ @@ -291,7 +291,7 @@ a custom footer with page numbers and more. ```example >>> #set page("iso-b6", margin: 1.75cm) -#set page(footer: [ +#set page(footer: context [ *American Society of Proceedings* #h(1fr) #counter(page).display( @@ -314,21 +314,20 @@ circle for each page. ```example >>> #set page("iso-b6", margin: 1.75cm) -#set page(footer: [ +#set page(footer: context [ *Fun Typography Club* #h(1fr) - #counter(page).display(num => { - let circles = num * ( - box(circle( - radius: 2pt, - fill: navy, - )), - ) - box( - inset: (bottom: 1pt), - circles.join(h(1pt)) - ) - }) + #let (num,) = counter(page).get() + #let circles = num * ( + box(circle( + radius: 2pt, + fill: navy, + )), + ) + #box( + inset: (bottom: 1pt), + circles.join(h(1pt)) + ) ]) This page has a custom footer. @@ -382,7 +381,7 @@ page counter, you can use the [`page`]($locate) method on the argument of the // This returns one even though the // page counter was incremented by 5. -#locate(loc => loc.page()) +#context here().page() ``` You can also obtain the page numbering pattern from the `{locate}` closure |
