summaryrefslogtreecommitdiff
path: root/docs/guides
diff options
context:
space:
mode:
authorMartin Haug <mhaug@live.de>2024-10-18 10:36:21 +0200
committerGitHub <noreply@github.com>2024-10-18 08:36:21 +0000
commitee15ae9c657fc21ac20c62463c2105939ae56ef3 (patch)
tree8f84ea3999a23824597151fb4332f3414a9ecc81 /docs/guides
parentebb60001d8fa7ce7c2f824e8e2396b8d485bbb48 (diff)
Use `set page(columns: n)` in tutorial (#5228)
Co-authored-by: Laurenz <laurmaedje@gmail.com>
Diffstat (limited to 'docs/guides')
-rw-r--r--docs/guides/guide-for-latex-users.md149
-rw-r--r--docs/guides/page-setup.md2
2 files changed, 81 insertions, 70 deletions
diff --git a/docs/guides/guide-for-latex-users.md b/docs/guides/guide-for-latex-users.md
index f8b2e439..743afa5a 100644
--- a/docs/guides/guide-for-latex-users.md
+++ b/docs/guides/guide-for-latex-users.md
@@ -325,62 +325,65 @@ function. The following example illustrates how it works:
>>> 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",
->>> )
+>>> 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
+>>> )
>>>
->>> 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(
+>>> align(center,
+>>> text(
+>>> 13pt,
+>>> weight: "regular",
+>>> smallcaps(it.body),
+>>> )
+>>> ),
+>>> )
+>>> show heading.where(
+>>> level: 2
+>>> ): it => box(
+>>> text(
+>>> 11pt,
+>>> weight: "regular",
+>>> style: "italic",
+>>> it.body + [.],
+>>> )
+>>> )
>>>
->>> set align(center)
->>> text(17pt, title)
+>>> place(top, float: true, scope: "parent", {
+>>> 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)
->>> ]),
->>> )
+>>> 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
->>> ]
+>>> par(justify: false)[
+>>> *Abstract* \
+>>> #abstract
+>>> ]
+>>> })
>>>
->>> set align(left)
->>> columns(2, doc)
->>>}
+>>> set align(left)
+>>> doc
+>>> }
<<< #import "conf.typ": conf
#show: conf.with(
title: [
@@ -404,14 +407,34 @@ function. The following example illustrates how it works:
Let's get started writing this
article by putting insightful
paragraphs right here!
+>>> #lorem(500)
```
-The [`{import}`]($scripting/#modules) statement makes
-[functions]($function) (and other definitions) from another file available.
-In this example, it imports the `conf` function from the `conf.typ` file. This
-function formats a document as a conference article. We use a show rule to apply
-it to the document and also configure some metadata of the article. After
-applying the show rule, we can start writing our article right away!
+The [`{import}`]($scripting/#modules) statement makes [functions]($function)
+(and other definitions) from another file available. In this example, it imports
+the `conf` function from the `conf.typ` file. This function formats a document
+as a conference article. We use a show rule to apply it to the document and also
+configure some metadata of the article. After applying the show rule, we can
+start writing our article right away!
+
+You can also use templates from Typst Universe (which is Typst's equivalent of
+CTAN) using an import statement like this: `[#import
+"@preview/elsearticle:0.2.1": elsearticle]`. Check the documentation of an
+individual template to learn the name of its template function. Templates and
+packages from Typst Universe are automatically downloaded when you first use
+them.
+
+In the web app, you can choose to create a project from a template on Typst
+Universe or even create your own using the template wizard. Locally, you can use
+the `typst init` CLI to create a new project from a template. Check out [the
+list of templates]($universe/search/?kind=templates) published on Typst
+Universe. You can also take a look at the [`awesome-typst`
+repository](https://github.com/qjcg/awesome-typst) to find community templates
+that aren't available through Universe.
+
+You can also [create your own, custom templates.]($tutorial/making-a-template)
+They are shorter and more readable than the corresponding LaTeX `.sty` files by
+orders of magnitude, so give it a try!
<div class="info-box">
@@ -428,18 +451,6 @@ function and pre-configures some if its arguments before passing it on to the
show rule.
</div>
-In the web app, you can choose from predefined templates or even
-create your own using the template wizard. Locally, you can use the
-`typst init` CLI to create a new project from a template. Check out
-[the list of templates]($universe/search/?kind=templates) published on Typst
-Universe, our official package ecosystem. You can also take a look at the
-[`awesome-typst` repository](https://github.com/qjcg/awesome-typst) to find
-community templates that aren't yet available as packages.
-
-You can also [create your own, custom templates.]($tutorial/making-a-template)
-They are shorter and more readable than the corresponding LaTeX `.sty` files by
-orders of magnitude, so give it a try!
-
## How do I load packages? { #packages }
Typst is "batteries included," so the equivalent of many popular LaTeX packages
is built right-in. Below, we compiled a table with frequently loaded packages
diff --git a/docs/guides/page-setup.md b/docs/guides/page-setup.md
index 6ae92f83..d4a1e62c 100644
--- a/docs/guides/page-setup.md
+++ b/docs/guides/page-setup.md
@@ -432,7 +432,7 @@ frequently used for [figures]($figure.placement).
### Use columns anywhere in your document { #columns-anywhere }
To create columns within a nested layout, e.g. within a rectangle, you can use
-the [`columns` function]($columns) directly. However, it should really only be
+the [`columns` function]($columns) directly. However, it really should only be
used within nested layouts. At the page-level, the page set rule is preferrable
because it has better interactions with things like page-level floats,
footnotes, and line numbers.