mirror of
https://github.com/typst/typst
synced 2025-08-13 22:57:56 +08:00
Fix set rule example
This commit is contained in:
parent
cfb3b1a270
commit
ec487298f7
@ -11,14 +11,14 @@ your report using Typst's styling system.
|
||||
|
||||
## Set rules
|
||||
As we have seen in the previous chapter, Typst has functions that _insert_
|
||||
content (e.g. the [`image`] function) and others that _manipulate_ content that
|
||||
they received as arguments (e.g. the [`align`] function). The first impulse you
|
||||
content (e.g., the [`image`] function) and others that _manipulate_ content that
|
||||
they received as arguments (e.g., the [`align`] function). The first impulse you
|
||||
might have when you want, for example, to justify the report, could be to look
|
||||
for a function that does that and wrap the complete document in it.
|
||||
|
||||
```example
|
||||
= Background
|
||||
#par(justify: true)[
|
||||
= Background
|
||||
In the case of glaciers, fluid
|
||||
dynamics principles can be used
|
||||
to understand how the movement
|
||||
@ -34,12 +34,12 @@ Wait, shouldn't all arguments of a function be specified within parentheses? Why
|
||||
is there a second set of square brackets with content _after_ the parentheses?
|
||||
The answer is that, as passing content to a function is such a common thing to
|
||||
do in Typst, there is special syntax for it: Instead of putting the content
|
||||
inside of the argument list, you can write it in square brackets directly after
|
||||
the normal arguments, saving on punctuation.
|
||||
inside the argument list, you can write it in square brackets directly after the
|
||||
normal arguments, saving on punctuation.
|
||||
|
||||
As seen above, that works. The [`par`] function justifies all paragraphs within
|
||||
it. However, wrapping the document in countless functions and applying styles
|
||||
selectively and in-situ can quickly become cumbersome.
|
||||
it. However, wrapping the document in countless functions can quickly become
|
||||
cumbersome.
|
||||
|
||||
Fortunately, Typst has a more elegant solution. With _set rules,_ you can apply
|
||||
style properties to all occurrences of some kind of content. You write a set
|
||||
@ -61,7 +61,6 @@ water).
|
||||
```
|
||||
|
||||
<div class="info-box">
|
||||
|
||||
Want to know in more technical terms what is happening here?
|
||||
|
||||
Set rules can be conceptualized as setting default values
|
||||
|
Loading…
x
Reference in New Issue
Block a user