mirror of
https://github.com/TeachBooks/template.git
synced 2026-11-12 22:25:52 +00:00
Update 009.md
This commit is contained in:
parent
5f44447e7e
commit
b33df99f2b
1 changed files with 32 additions and 4 deletions
|
|
@ -1,6 +1,6 @@
|
|||
# Exercise 9: Cross-referencing content
|
||||
|
||||
In this exercise, you will learn how to create references to other parts of your book, such as chapters, 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, and figures.
|
||||
|
||||
::::::{topic} Exercise objective
|
||||
Can you create internal references to other sections, equations, tables, and figures?
|
||||
|
|
@ -24,6 +24,36 @@ For example, if you want to link to Exercise 7, you can write:
|
|||
[Go to Exercise 7](../exercises/007.md)
|
||||
```
|
||||
|
||||
Alternatively, you can use `{ref}` to reference a section with a target header.
|
||||
|
||||
First, define the section you want to reference by assigning it an identifier:
|
||||
|
||||
```md
|
||||
(exercise_1)=
|
||||
# Exercise 1: First file edit
|
||||
|
||||
Let's start with the most basic edit: add some text to a file and see that the website is updated...
|
||||
```
|
||||
|
||||
Then, you can reference this section in three ways:
|
||||
|
||||
- Using the standard title text:
|
||||
```md
|
||||
My favourite exercise was {ref}`exercise_1`.
|
||||
```
|
||||
This will display: *My favourite exercise was Exercise 1: First file edit.*
|
||||
|
||||
- Specifying a custom title text:
|
||||
```md
|
||||
My favourite exercise was {ref}`the first one <exercise_1>`.
|
||||
```
|
||||
This will display: *My favourite exercise was the first one.*
|
||||
|
||||
- Using Markdown syntax:
|
||||
```md
|
||||
My favourite exercise was [this one](exercise_1).
|
||||
```
|
||||
This will display: *My favourite exercise was this one.*
|
||||
|
||||
## 2. Referencing an Equation
|
||||
|
||||
|
|
@ -93,8 +123,6 @@ Figure {numref}`fig-example`
|
|||
:class: note
|
||||
|
||||
Before moving on to the next exercise, make sure you understand the following:
|
||||
- How do you reference another chapter?
|
||||
- How do you reference another chapter or section?
|
||||
- How do you create a reference to an equation?
|
||||
- How can you refer to a table or a figure in your book?
|
||||
|
||||
```
|
||||
Loading…
Add table
Add a link
Reference in a new issue