Update 009.md

This commit is contained in:
Katia Gatt 2025-03-22 17:51:05 +01:00
parent 36cd954095
commit 2d74872a6e

View file

@ -1,9 +1,7 @@
# Exercise 9: Cross-referencing content
In this exercise, you will learn how to create references to other parts of your book, such as chapters, sections, equations, tables, and figures.
In this exercise, you will learn how to create references to other parts of your book, such as chapters, sections, equations, tables, figures, and links.
::::::{topic} Exercise objective
Can you create internal references to other sections, equations, tables, and figures?
Can you create internal references to other sections, equations, tables, figures, and links?
::::::
```{tip}
@ -55,15 +53,19 @@ Then, you can reference this section in three ways:
```
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
To reference an equation, you need to define a label using `{eq}` and refer to it elsewhere in your text:
```md
```{math}
:label: eq-example
E = mc^2
```
```
You can then reference this equation using:
@ -72,8 +74,6 @@ You can then reference this equation using:
Equation {eq}`eq-example`
```
This will display: Equation {eq}`eq-example`.
## 3. Referencing a Table
@ -81,12 +81,12 @@ This will display: Equation {eq}`eq-example`.
To reference a table, assign a label when defining it:
```md
```{table} Example Table
:label: tab-example
| Column 1 | Column 2 |
|----------|----------|
| A | B |
```
```{table} Example Table
:label: tab-example
| Column 1 | Column 2 |
|----------|----------|
| A | B |
```
```
And refer to it using:
@ -95,19 +95,20 @@ And refer to it using:
Table {numref}`tab-example`
```
## 4. Referencing a Figure
To reference a figure, label it when inserting it:
```md
```{figure} figures/example.png
---
width: 80%
align: center
name: fig-example
---
Example figure.
```
```{figure} figures/example.png
---
width: 80%
align: center
name: fig-example
---
Example figure.
```
```
And refer to it using: