mirror of
https://github.com/TeachBooks/template.git
synced 2026-11-12 22:25:52 +00:00
update 9.2
This commit is contained in:
parent
8370b7e62f
commit
0b29820e46
1 changed files with 28 additions and 17 deletions
|
|
@ -12,8 +12,8 @@ Referencing elements properly ensures that readers can navigate your book more e
|
|||
|
||||
## 1. Referencing a Chapter or Section
|
||||
|
||||
1. Open the Markdown file where you want to add a reference.
|
||||
2. Lets start with the simplest way to create a reference to another chapter or section. This is by directly linking it through the file path as shown in the following syntax:
|
||||
1. Open a new or existing Markdown file where you want to add a reference.
|
||||
2. Let's start with the simplest way to create a reference to another chapter. This is by directly linking it through the file path as shown in the following syntax:
|
||||
|
||||
```md
|
||||
[Text to display](path/to/file.md)
|
||||
|
|
@ -24,7 +24,7 @@ For example, if you want to link to Exercise 7, you can write:
|
|||
```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.
|
||||
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.
|
||||
|
||||
```md
|
||||
(exercise_1)=
|
||||
|
|
@ -32,13 +32,14 @@ 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...
|
||||
```
|
||||
4. Now, lets explore three different ways to reference this section! For the first method, we use the standard title text by calling the identifier as follows:
|
||||
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:
|
||||
|
||||
```md
|
||||
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:
|
||||
|
||||
```md
|
||||
|
|
@ -46,6 +47,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>`.
|
||||
|
||||
|
||||
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:
|
||||
|
||||
|
||||
|
|
@ -58,23 +60,32 @@ These three referencing methods can also be used for referencing equations, tabl
|
|||
|
||||
## 2. Referencing an Equation
|
||||
|
||||
To reference an equation, you need to define a label when creating the equation and refer to it elsewhere in your text using `{eq}`:
|
||||
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.
|
||||
|
||||
|
||||
```md
|
||||
|
||||
$$ F = m \cdot a$$ (eq:Newton)
|
||||
|
||||
```
|
||||
|
||||
This will display as follows:
|
||||
|
||||
$$ 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:
|
||||
|
||||
|
||||
```md
|
||||
|
||||
```{math}
|
||||
:label: eq-example
|
||||
E = mc^2
|
||||
```
|
||||
|
||||
```
|
||||
|
||||
You can then reference this equation using:
|
||||
|
||||
```md
|
||||
Equation {eq}`eq-example`
|
||||
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
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue