From 551c3f0a3026151d1adb808e3566ade0884eb2b5 Mon Sep 17 00:00:00 2001 From: Tom van Woudenberg Date: Thu, 27 Mar 2025 08:41:51 +0100 Subject: [PATCH] Update 009.md --- book/syntax_exercises/009.md | 61 ++++++++++++++++++------------------ 1 file changed, 31 insertions(+), 30 deletions(-) diff --git a/book/syntax_exercises/009.md b/book/syntax_exercises/009.md index 64883c8..ee85af1 100644 --- a/book/syntax_exercises/009.md +++ b/book/syntax_exercises/009.md @@ -51,25 +51,25 @@ Let's start with the most basic edit: add some text to a file and see that the w ``` 5. Now, let's explore three different ways to reference this section or chapter! For the first method, we use the standard title text by calling the identifier as follows. This will display: My favourite exercise was {ref}`exercise_1`. - ```md - My favourite exercise was {ref}`exercise_1`. - ``` +```md +My favourite exercise was {ref}`exercise_1`. +``` 6. For the second method, we want to refer to the section using a custom title text. Try this out by placing the text that you want to be displayed within `` and calling the identifier within <>. This will display: My favourite exercise was {ref}`the first one `. - ```md - My favourite exercise was {ref}`the first one `. - ``` +```md +My favourite exercise was {ref}`the first one `. +``` 7. The last method uses markdown syntax to also display a custom title text. Refer to the desired section once again, this time by putting the custom text within [] and calling the identifier within <> as shown below. This will display: My favourite exercise was [this one](exercise_1). - ```md - My favourite exercise was [this one](exercise_1). - ``` +```md +My favourite exercise was [this one](exercise_1). +``` ## Referencing an Equation @@ -77,11 +77,11 @@ This will display: My favourite exercise was {ref}`the first one `. 8. Now we will test our knowledge using an equation. Similar to the code below, create an equation using $$ and identify it using a label within the brackets. - ```md +```md - $$ F = m \cdot a$$ (eq:Newton) +$$ F = m \cdot a$$ (eq:Newton) - ``` +``` $$ F = m \cdot a$$ (eq:Newton) @@ -96,14 +96,14 @@ Refer to Equation {eq}`eq:Newton` 10. Similar methods can also be used to refer to a table. Start by creating a table by copying the code below. The identifier is defined using `:name:`. - ````md - ```{table} Example Table - :name: tab-example - | Column 1 | Column 2 | - |----------|----------| - | A | B | - ``` - ```` +````md +```{table} Example Table +:name: tab-example +| Column 1 | Column 2 | +|----------|----------| +| A | B | +``` +```` ```{table} Example Table @@ -126,16 +126,16 @@ Refer to Equation {eq}`eq:Newton` 12. This can also be done for a figure. Let's add a figure as we learnt to do in [Exercise 8](008.md), but this time adding an identifier using `name:`. - ````md - ```{figure} figures/example.png - --- - width: 80% - align: center - name: fig-example - --- - Example figure. - ``` - ```` +````md +```{figure} figures/example.png +--- +width: 80% +align: center +name: fig-example +--- +Example figure. +``` +```` 13. Refer to the figure in the format {numref}`Figure {number} ` using `{numref}` as follows: @@ -175,3 +175,4 @@ Before moving on to the next exercise, make sure you understand the following: - How do you reference another chapter or section? - How do you create a reference to an equation, table or figure in your book? - How do you reference a link? +``` \ No newline at end of file