update rest of 9

This commit is contained in:
Katia Gatt 2025-03-25 23:27:06 +01:00
parent 0b29820e46
commit c574592c84

View file

@ -24,7 +24,16 @@ For example, if you want to link to Exercise 7, you can write:
```md ```md
[Go to Exercise 7](../exercises/007.md) [Go to Exercise 7](../exercises/007.md)
``` ```
3. Try out another way of referencing by using a target header. Navigate to the chapter or section you want to reference and assign it an identifier using `{ref}` as shown in the example below. This could be either in the same markdown file, or a different file altogether.
3. If we want to refer to a section within the same file, we can use local refencing by directly inputting the name of the required section.
```md
[Jump to the next section](# 2. Referencing an Equation)
```
[Jump to the next section](# 2. Referencing an Equation)
4. Try out another way of referencing by using a target header. Navigate to the chapter or section you want to reference and assign it an identifier using `{ref}` as shown in the example below. This could be once again in the same markdown file, or a different file altogether.
```md ```md
(exercise_1)= (exercise_1)=
@ -32,7 +41,7 @@ For example, if you want to link to Exercise 7, you can write:
Let's start with the most basic edit: add some text to a file and see that the website is updated... Let's start with the most basic edit: add some text to a file and see that the website is updated...
``` ```
4. 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: 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:
```md ```md
My favourite exercise was {ref}`exercise_1`. My favourite exercise was {ref}`exercise_1`.
@ -40,7 +49,7 @@ Let's start with the most basic edit: add some text to a file and see that the w
This will display: My favourite exercise was {ref}`exercise_1`. This will display: My favourite exercise was {ref}`exercise_1`.
5. 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 the `` and calling the identifier within the <> as follows: 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 the `` and calling the identifier within the <> as follows:
```md ```md
My favourite exercise was {ref}`the first one <exercise_1>`. My favourite exercise was {ref}`the first one <exercise_1>`.
@ -48,7 +57,7 @@ Let's start with the most basic edit: add some text to a file and see that the w
This will display: My favourite exercise was {ref}`the first one <exercise_1>`. This will display: My favourite exercise was {ref}`the first one <exercise_1>`.
6. The final 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 the [] and calling the identifier within the <> as shown below: 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 the [] and calling the identifier within the <> as shown below:
```md ```md
@ -56,11 +65,11 @@ Let's start with the most basic edit: add some text to a file and see that the w
``` ```
This will display: My favourite exercise was [this one](exercise_1). This will display: My favourite exercise was [this one](exercise_1).
These three referencing methods can also be used for referencing equations, tables and figures.
## 2. Referencing an Equation ## 2. Referencing an Equation
7. 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. 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
@ -69,48 +78,46 @@ These three referencing methods can also be used for referencing equations, tabl
``` ```
This will display as follows:
$$ F = m \cdot a$$ (eq:Newton) $$ F = m \cdot a$$ (eq:Newton)
8. In this step, we will use the three referencing methods discussed above to reference this equation as follows: 8. To refer to this equation we need to use {eq} and call the identifier within the ``. This will display: Refer to Equation {eq}`eq:Newton`.
```md ```md
Refer to Equation {eq}`eq:Newton` Refer to Equation {eq}`eq:Newton`
Refer to the {eq}'above equation <eq:Newton>'
Refer to [this equation](eq:Newton)
``` ```
These will display as:
Refer to Equation {eq}`eq:Newton`
Refer to the {eq}'above equation <eq:Newton>'
Refer to [this equation](eq:Newton)
## 3. Referencing a Table ## 3. Referencing a Table
To reference a table, assign a label when defining it: 9. Similar methods can also be used to refer to a table. Start by creating a table by copying the markdown below. The identifier is defined using ':name:'.
```md ```md
```{table} Example Table ```{table} Example Table
:label: tab-example :name: tab-example
| Column 1 | Column 2 | | Column 1 | Column 2 |
|----------|----------| |----------|----------|
| A | B | | A | B |
``` ```
``` ```
And refer to it using `{numref}`: ```{table} Example Table
name: tab-example
| Column 1 | Column 2 |
|----------|----------|
| A | B |
```
10. Refer to the table like {numref}`Table {number} <tab-example>` using {numref} and {number} as follows:
```md ```md
Table {numref}`tab-example` {numref}`Table {number} <tab-example>`
``` ```
## 4. Referencing a Figure ## 4. Referencing a Figure
To reference a figure, label it when inserting it: 11. This can also be done for a figure. Let's add a figure as we learnt in [Exercise 7](007.md), but this time adding an identifier using 'name:'.
```md ```md
```{figure} figures/example.png ```{figure} figures/example.png
@ -123,36 +130,37 @@ To reference a figure, label it when inserting it:
``` ```
``` ```
And refer to it using `{numref}`: 12. Refer to the figure in the format {numref}`Figure {number} <fig-example>` using `{numref}` as follows:
```md ```md
Figure {numref}`fig-example` {numref}`Figure {number} <fig-example>`
``` ```
## 5. Referencing a Link ## 5. Referencing a Link
To reference a link, use the following syntax: 13. Finally, lets reference a link, using the following syntax:
```md ```md
[Text to display](https://teachbooks.github.io/template/) [Text to display](url)
``` ```
For example, you can write: For example, you can use the code below to display: Here is the [link to the template](https://teachbooks.github.io/template/).
```md ```md
Here is the [link to the template](https://teachbooks.github.io/template/). Here is the [link to the template](https://teachbooks.github.io/template/).
``` ```
This wil display: Here is the [link to the template](https://teachbooks.github.io/template/).
## 6. Commit Your Changes ## 6. Commit Your Changes
1. Once you have added your references, commit your changes to the repository. 14. When you are ready, commit your changes to the repository by clicking on the green `Commit changes` button.
2. Click the green `Commit changes` button.
3. Add a commit message. 15. Add a commit message.
4. View your changes using the `Actions` tab and check if they appear correctly.
16. To see you changes, go to {octicon}`play;1em` `Actions` - The most recent workflow run `overview.md / the commit message of the commit you just made` - Wait for it to finish - In the summary, click on the link of your book shown in the table `Branches deployed` and under `Primary book at root` (getting bored of waiting? There'll be exercising on doing this locally which prevents you from waiting).
17. Do you see your change? If you don't see it click `CTRL`+`F5`/`Control`+`F5`to refresh the page.
```{admonition} Check your understanding ```{admonition} Check your understanding
:class: note :class: note