From 04055182bbc1824ed4001add7e3af3a224de9a26 Mon Sep 17 00:00:00 2001 From: Andrew Voynov Date: Tue, 4 Mar 2025 14:33:39 +0300 Subject: [PATCH] Change the par example to underline --- docs/tutorial/2-formatting.md | 37 ++++++++++------------------------- 1 file changed, 10 insertions(+), 27 deletions(-) diff --git a/docs/tutorial/2-formatting.md b/docs/tutorial/2-formatting.md index 4bea444db..910e0d564 100644 --- a/docs/tutorial/2-formatting.md +++ b/docs/tutorial/2-formatting.md @@ -13,21 +13,12 @@ your report using Typst's styling system. 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 -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. +might have when you want, for example, to underline text with dotted line, could +be to look for a function that does that and wrap the desired text in it. ```example -= Background -#par(justify: true)[ - In the case of glaciers, fluid - dynamics principles can be used - to understand how the movement - and behaviour of the ice is - influenced by factors such as - temperature, pressure, and the - presence of other fluids (such as - water). -] +Let's make a #underline(stroke: (dash: "dotted"))[simple] sentence example +and use it #underline(stroke: (dash: "dotted"))[here]. ``` Wait, shouldn't all arguments of a function be specified within parentheses? Why @@ -37,27 +28,19 @@ do in Typst, there is special syntax for it: Instead of putting the content 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 can quickly become -cumbersome. +As seen above, that works. The [`underline`] function draws a dotted line under +the text. However, wrapping the document in countless functions (or just a +single bulky one) can quickly become 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 rule by entering the `{set}` keyword, followed by the name of the function whose properties you want to set, and a list of arguments in parentheses. ```example -#set par(justify: true) +#set underline(stroke: (dash: "dotted")) -= Background -In the case of glaciers, fluid -dynamics principles can be used -to understand how the movement -and behaviour of the ice is -influenced by factors such as -temperature, pressure, and the -presence of other fluids (such as -water). +Let's make a #underline[simple] sentence example and use it #underline[here]. ```