mirror of
https://github.com/typst/typst
synced 2025-08-14 07:07:54 +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
|
## Set rules
|
||||||
As we have seen in the previous chapter, Typst has functions that _insert_
|
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
|
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
|
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
|
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.
|
for a function that does that and wrap the complete document in it.
|
||||||
|
|
||||||
```example
|
```example
|
||||||
|
= Background
|
||||||
#par(justify: true)[
|
#par(justify: true)[
|
||||||
= Background
|
|
||||||
In the case of glaciers, fluid
|
In the case of glaciers, fluid
|
||||||
dynamics principles can be used
|
dynamics principles can be used
|
||||||
to understand how the movement
|
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?
|
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
|
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
|
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
|
inside the argument list, you can write it in square brackets directly after the
|
||||||
the normal arguments, saving on punctuation.
|
normal arguments, saving on punctuation.
|
||||||
|
|
||||||
As seen above, that works. The [`par`] function justifies all paragraphs within
|
As seen above, that works. The [`par`] function justifies all paragraphs within
|
||||||
it. However, wrapping the document in countless functions and applying styles
|
it. However, wrapping the document in countless functions can quickly become
|
||||||
selectively and in-situ can quickly become cumbersome.
|
cumbersome.
|
||||||
|
|
||||||
Fortunately, Typst has a more elegant solution. With _set rules,_ you can apply
|
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
|
style properties to all occurrences of some kind of content. You write a set
|
||||||
@ -61,7 +61,6 @@ water).
|
|||||||
```
|
```
|
||||||
|
|
||||||
<div class="info-box">
|
<div class="info-box">
|
||||||
|
|
||||||
Want to know in more technical terms what is happening here?
|
Want to know in more technical terms what is happening here?
|
||||||
|
|
||||||
Set rules can be conceptualized as setting default values
|
Set rules can be conceptualized as setting default values
|
||||||
|
Loading…
x
Reference in New Issue
Block a user