Update 009.md

This commit is contained in:
Tom van Woudenberg 2025-03-27 08:41:51 +01:00
parent 52cb1ae06a
commit 551c3f0a30

View file

@ -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 <exercise_1>`.
```md
My favourite exercise was {ref}`the first one <exercise_1>`.
```
```md
My favourite exercise was {ref}`the first one <exercise_1>`.
```
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 <exercise_1>`.
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} <fig-example>` 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?
```