From d27b8e6f85bce8d5437dda0c16d849befd3715aa Mon Sep 17 00:00:00 2001 From: Katia Gatt Date: Thu, 20 Mar 2025 12:34:10 +0100 Subject: [PATCH 01/31] Exercise 9 --- book/syntax_exercises/009.md | 100 +++++++++++++++++++++++++++++++++++ 1 file changed, 100 insertions(+) create mode 100644 book/syntax_exercises/009.md diff --git a/book/syntax_exercises/009.md b/book/syntax_exercises/009.md new file mode 100644 index 0000000..9c12cc9 --- /dev/null +++ b/book/syntax_exercises/009.md @@ -0,0 +1,100 @@ +# 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. + +::::::{topic} Exercise objective +Can you create internal references to other sections, equations, tables, and figures? +:::::: + +```{tip} +Referencing elements properly ensures that readers can navigate your book more easily. More details can be found in the [JupyterBook documentation](https://jupyterbook.org/en/stable/content/references.html). +``` + +## 1. Referencing a Chapter or Section + +To create a reference to another chapter or section, use the following syntax: + +```md +[Text to display](path/to/file.md) +``` + +For example, if you want to link to Exercise 7, you can write: + +```md +[Go to Exercise 7](../exercises/007.md) +``` + + +## 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: + +```md +Equation {eq}`eq-example` +``` + +## 3. Referencing a Table + +To reference a table, assign a label when defining it: + +```md +```{table} Example Table +:label: tab-example +| Column 1 | Column 2 | +|----------|----------| +| A | B | +``` +``` + +And refer to it using: + +```md +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. +``` +``` + +And refer to it using: + +```md +Figure {numref}`fig-example` +``` + +## 5. Commit Your Changes + +1. Once you have added your references, commit your changes to the repository. +2. Click the green `Commit changes` button. +3. Add a commit message. +4. View your changes using the `Actions` tab and check if they appear correctly. + +```{admonition} Check your understanding +:class: note + +Before moving on to the next exercise, make sure you understand the following: +- How do you reference another chapter? +- How do you create a reference to an equation? +- How can you refer to a table or a figure in your book? + +``` \ No newline at end of file From b3fce913d0998c3b5ec49e5f42035b370f53ae2d Mon Sep 17 00:00:00 2001 From: Katia Gatt Date: Thu, 20 Mar 2025 12:35:30 +0100 Subject: [PATCH 02/31] toc exercise 9 --- book/_toc.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/book/_toc.yml b/book/_toc.yml index ad5003f..91a0b9f 100644 --- a/book/_toc.yml +++ b/book/_toc.yml @@ -20,6 +20,7 @@ parts: sections: - file: syntax_exercises/007.md - file: syntax_exercises/008.md + - file: syntax_exercises/009.md - file: references.md - file: changelog.md - file: credits.md From cddce2ffe5ed89968dfe1048ffc28487a6d56846 Mon Sep 17 00:00:00 2001 From: Katia Gatt Date: Fri, 21 Mar 2025 09:13:39 +0100 Subject: [PATCH 03/31] Update _toc.yml --- book/_toc.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/book/_toc.yml b/book/_toc.yml index 91a0b9f..373feb7 100644 --- a/book/_toc.yml +++ b/book/_toc.yml @@ -20,7 +20,7 @@ parts: sections: - file: syntax_exercises/007.md - file: syntax_exercises/008.md - - file: syntax_exercises/009.md + - file: syntax_exercises\009.md - file: references.md - file: changelog.md - file: credits.md From b0854fe677607e37d3a9b6c9c412c9ebf9ad3101 Mon Sep 17 00:00:00 2001 From: Katia Gatt Date: Fri, 21 Mar 2025 09:17:37 +0100 Subject: [PATCH 04/31] Update _toc.yml --- book/_toc.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/book/_toc.yml b/book/_toc.yml index 373feb7..91a0b9f 100644 --- a/book/_toc.yml +++ b/book/_toc.yml @@ -20,7 +20,7 @@ parts: sections: - file: syntax_exercises/007.md - file: syntax_exercises/008.md - - file: syntax_exercises\009.md + - file: syntax_exercises/009.md - file: references.md - file: changelog.md - file: credits.md From 8461fc30e3a51efe27d1631973283716b6e9dffb Mon Sep 17 00:00:00 2001 From: Katia Gatt Date: Fri, 21 Mar 2025 09:27:51 +0100 Subject: [PATCH 05/31] Update _toc.yml --- book/_toc.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/book/_toc.yml b/book/_toc.yml index 91a0b9f..f0ab122 100644 --- a/book/_toc.yml +++ b/book/_toc.yml @@ -23,4 +23,4 @@ parts: - file: syntax_exercises/009.md - file: references.md - file: changelog.md - - file: credits.md + - file: credits.md \ No newline at end of file From a1e1f6c1a66599e33b2a411a2cf7937b272876ce Mon Sep 17 00:00:00 2001 From: Katia Gatt Date: Fri, 21 Mar 2025 09:32:26 +0100 Subject: [PATCH 06/31] Update _toc.yml --- book/_toc.yml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/book/_toc.yml b/book/_toc.yml index f0ab122..ad5003f 100644 --- a/book/_toc.yml +++ b/book/_toc.yml @@ -20,7 +20,6 @@ parts: sections: - file: syntax_exercises/007.md - file: syntax_exercises/008.md - - file: syntax_exercises/009.md - file: references.md - file: changelog.md - - file: credits.md \ No newline at end of file + - file: credits.md From 66fb69a7df08621267828d0f2aec6fd989176f67 Mon Sep 17 00:00:00 2001 From: Katia Gatt Date: Fri, 21 Mar 2025 09:35:15 +0100 Subject: [PATCH 07/31] Update _toc.yml --- book/_toc.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/book/_toc.yml b/book/_toc.yml index ad5003f..91a0b9f 100644 --- a/book/_toc.yml +++ b/book/_toc.yml @@ -20,6 +20,7 @@ parts: sections: - file: syntax_exercises/007.md - file: syntax_exercises/008.md + - file: syntax_exercises/009.md - file: references.md - file: changelog.md - file: credits.md From 5f44447e7e197bdae82e565076ed95d2b7f08f1a Mon Sep 17 00:00:00 2001 From: Robert Lanzafame Date: Fri, 21 Mar 2025 10:16:23 +0100 Subject: [PATCH 08/31] bump --- book/syntax_exercises/009.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/book/syntax_exercises/009.md b/book/syntax_exercises/009.md index 9c12cc9..14111bc 100644 --- a/book/syntax_exercises/009.md +++ b/book/syntax_exercises/009.md @@ -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, equations, tables, and figures. ::::::{topic} Exercise objective Can you create internal references to other sections, equations, tables, and figures? From b33df99f2b7ce599c5717bdba72aa56bbc96cbf0 Mon Sep 17 00:00:00 2001 From: Katia Gatt Date: Sat, 22 Mar 2025 16:39:31 +0100 Subject: [PATCH 09/31] Update 009.md --- book/syntax_exercises/009.md | 36 ++++++++++++++++++++++++++++++++---- 1 file changed, 32 insertions(+), 4 deletions(-) diff --git a/book/syntax_exercises/009.md b/book/syntax_exercises/009.md index 14111bc..7b071a2 100644 --- a/book/syntax_exercises/009.md +++ b/book/syntax_exercises/009.md @@ -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 `. + ``` + 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? - -``` \ No newline at end of file From 36cd95409555d6d8c99c51a545cc1d002730a6ca Mon Sep 17 00:00:00 2001 From: Katia Gatt Date: Sat, 22 Mar 2025 17:30:17 +0100 Subject: [PATCH 10/31] updated content --- book/syntax_exercises/009.md | 34 ++++++++++++++++++++++++++++------ 1 file changed, 28 insertions(+), 6 deletions(-) diff --git a/book/syntax_exercises/009.md b/book/syntax_exercises/009.md index 7b071a2..70d37f1 100644 --- a/book/syntax_exercises/009.md +++ b/book/syntax_exercises/009.md @@ -41,19 +41,19 @@ Then, you can reference this section in three ways: ```md My favourite exercise was {ref}`exercise_1`. ``` - This will display: *My favourite exercise was Exercise 1: First file edit.* + This will display: My favourite exercise was {ref}`exercise_1`. - Specifying a custom title text: ```md My favourite exercise was {ref}`the first one `. ``` - This will display: *My favourite exercise was the first one.* + This will display: My favourite exercise was {ref}`the first one `. - Using Markdown syntax: ```md My favourite exercise was [this one](exercise_1). ``` - This will display: *My favourite exercise was this one.* + This will display: My favourite exercise was [this one](exercise_1). ## 2. Referencing an Equation @@ -72,6 +72,10 @@ You can then reference this equation using: Equation {eq}`eq-example` ``` +This will display: Equation {eq}`eq-example`. + + + ## 3. Referencing a Table To reference a table, assign a label when defining it: @@ -112,7 +116,25 @@ And refer to it using: Figure {numref}`fig-example` ``` -## 5. Commit Your Changes +## 5. Referencing a Link + +To reference a link, use the following syntax: + +```md +[Text to display](https://teachbooks.github.io/template/) +``` +For example, you can write: + +```md +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 1. Once you have added your references, commit your changes to the repository. 2. Click the green `Commit changes` button. @@ -124,5 +146,5 @@ Figure {numref}`fig-example` 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? -- How can you refer to a table or a figure in your book? +- How do you create a reference to an equation, table or figure in your book? +- How do you reference a link? From 2d74872a6e0a492ebd523a2f417b925a729c751a Mon Sep 17 00:00:00 2001 From: Katia Gatt Date: Sat, 22 Mar 2025 17:51:05 +0100 Subject: [PATCH 11/31] Update 009.md --- book/syntax_exercises/009.md | 41 ++++++++++++++++++------------------ 1 file changed, 21 insertions(+), 20 deletions(-) diff --git a/book/syntax_exercises/009.md b/book/syntax_exercises/009.md index 70d37f1..abe02a6 100644 --- a/book/syntax_exercises/009.md +++ b/book/syntax_exercises/009.md @@ -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: From cfdcfe8482e60f82b6408a83923c04577a2503dc Mon Sep 17 00:00:00 2001 From: Katia Gatt Date: Sat, 22 Mar 2025 17:59:12 +0100 Subject: [PATCH 12/31] final changes 09 --- book/syntax_exercises/009.md | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/book/syntax_exercises/009.md b/book/syntax_exercises/009.md index abe02a6..f3730e6 100644 --- a/book/syntax_exercises/009.md +++ b/book/syntax_exercises/009.md @@ -1,4 +1,6 @@ -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. +# 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, as well as links. ::::::{topic} Exercise objective Can you create internal references to other sections, equations, tables, figures, and links? @@ -57,14 +59,14 @@ 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 using `{eq}` and refer to it elsewhere in your text: +To reference an equation, you need to define a label when creating the equation and refer to it elsewhere in your text using `{eq}`: ```md -```{math} -:label: eq-example -E = mc^2 -``` + ```{math} + :label: eq-example + E = mc^2 + ``` ``` @@ -89,7 +91,7 @@ To reference a table, assign a label when defining it: ``` ``` -And refer to it using: +And refer to it using `{numref}`: ```md Table {numref}`tab-example` @@ -111,7 +113,7 @@ To reference a figure, label it when inserting it: ``` ``` -And refer to it using: +And refer to it using `{numref}`: ```md Figure {numref}`fig-example` From 8370b7e62f059ca5e6360b7aa7fcc304703178ba Mon Sep 17 00:00:00 2001 From: Katia Gatt Date: Mon, 24 Mar 2025 23:30:52 +0100 Subject: [PATCH 13/31] update 009 24/03 --- book/syntax_exercises/009.md | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/book/syntax_exercises/009.md b/book/syntax_exercises/009.md index f3730e6..8b23a46 100644 --- a/book/syntax_exercises/009.md +++ b/book/syntax_exercises/009.md @@ -12,7 +12,8 @@ Referencing elements properly ensures that readers can navigate your book more e ## 1. Referencing a Chapter or Section -To create a reference to another chapter or section, use the following syntax: +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: ```md [Text to display](path/to/file.md) @@ -23,10 +24,7 @@ For example, if you want to link to Exercise 7, you can write: ```md [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: +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. ```md (exercise_1)= @@ -34,22 +32,23 @@ First, define the section you want to reference by assigning it an identifier: 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: -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 {ref}`exercise_1`. -- Specifying a custom title text: +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 My favourite exercise was {ref}`the first one `. ``` This will display: My favourite exercise was {ref}`the first one `. -- Using Markdown syntax: +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: + + ```md My favourite exercise was [this one](exercise_1). ``` From 0b29820e46441d42e767fa6f63c17d8d2f9d184f Mon Sep 17 00:00:00 2001 From: Katia Gatt Date: Tue, 25 Mar 2025 22:44:04 +0100 Subject: [PATCH 14/31] update 9.2 --- book/syntax_exercises/009.md | 45 ++++++++++++++++++++++-------------- 1 file changed, 28 insertions(+), 17 deletions(-) diff --git a/book/syntax_exercises/009.md b/book/syntax_exercises/009.md index 8b23a46..924bacd 100644 --- a/book/syntax_exercises/009.md +++ b/book/syntax_exercises/009.md @@ -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 `. + 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 ' +Refer to [this equation](eq:Newton) ``` +These will display as: +Refer to Equation {eq}`eq:Newton` +Refer to the {eq}'above equation ' +Refer to [this equation](eq:Newton) ## 3. Referencing a Table From c574592c841ccec2ee45cede57cd7e99c6ed4767 Mon Sep 17 00:00:00 2001 From: Katia Gatt Date: Tue, 25 Mar 2025 23:27:06 +0100 Subject: [PATCH 15/31] update rest of 9 --- book/syntax_exercises/009.md | 78 ++++++++++++++++++++---------------- 1 file changed, 43 insertions(+), 35 deletions(-) diff --git a/book/syntax_exercises/009.md b/book/syntax_exercises/009.md index 924bacd..e2dc43f 100644 --- a/book/syntax_exercises/009.md +++ b/book/syntax_exercises/009.md @@ -24,7 +24,16 @@ 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. 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 (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... ``` -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 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`. -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 My favourite exercise was {ref}`the first one `. @@ -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 `. -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 @@ -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). -These three referencing methods can also be used for referencing equations, tables and figures. + ## 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 @@ -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) -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 Refer to Equation {eq}`eq:Newton` -Refer to the {eq}'above equation ' -Refer to [this equation](eq:Newton) ``` -These will display as: - -Refer to Equation {eq}`eq:Newton` -Refer to the {eq}'above equation ' -Refer to [this equation](eq:Newton) ## 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 ```{table} Example Table - :label: tab-example + :name: tab-example | Column 1 | Column 2 | |----------|----------| | 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} ` using {numref} and {number} as follows: + ```md -Table {numref}`tab-example` +{numref}`Table {number} ` ``` ## 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 ```{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} ` using `{numref}` as follows: ```md -Figure {numref}`fig-example` +{numref}`Figure {number} ` ``` ## 5. Referencing a Link -To reference a link, use the following syntax: +13. Finally, lets reference a link, using the following syntax: ```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 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 -1. Once you have added your references, commit your changes to the repository. -2. Click the green `Commit changes` button. -3. Add a commit message. -4. View your changes using the `Actions` tab and check if they appear correctly. +14. When you are ready, commit your changes to the repository by clicking on the green `Commit changes` button. + +15. Add a commit message. + +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 :class: note From d7fc0a3a70dbb6cc283c90bae3f1de600bfb7aee Mon Sep 17 00:00:00 2001 From: Katia Gatt Date: Tue, 25 Mar 2025 23:51:57 +0100 Subject: [PATCH 16/31] Update 009.md --- book/syntax_exercises/009.md | 45 ++++++++++++++++-------------------- 1 file changed, 20 insertions(+), 25 deletions(-) diff --git a/book/syntax_exercises/009.md b/book/syntax_exercises/009.md index e2dc43f..63743c6 100644 --- a/book/syntax_exercises/009.md +++ b/book/syntax_exercises/009.md @@ -10,7 +10,7 @@ Can you create internal references to other sections, equations, tables, figures Referencing elements properly ensures that readers can navigate your book more easily. More details can be found in the [JupyterBook documentation](https://jupyterbook.org/en/stable/content/references.html). ``` -## 1. Referencing a Chapter or Section +## Referencing a Chapter or Section 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: @@ -25,15 +25,14 @@ For example, if you want to link to Exercise 7, you can write: [Go to Exercise 7](../exercises/007.md) ``` -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. +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. For example: [Jump to the next section](#referencing-an-equation) ```md -[Jump to the next section](# 2. Referencing an Equation) +[Jump to the next section](#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. +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 in the same repository. ```md (exercise_1)= @@ -41,33 +40,30 @@ 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... ``` -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: +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`. ``` - This will display: 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 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 `` and calling the identifier within <>. +This will display: My favourite exercise was {ref}`the first one `. ```md My favourite exercise was {ref}`the first one `. ``` - This will display: My favourite exercise was {ref}`the first one `. -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: +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. This will display: My favourite exercise was [this one](exercise_1). ```md My favourite exercise was [this one](exercise_1). ``` - This will display: My favourite exercise was [this one](exercise_1). - -## 2. Referencing an Equation +## Referencing an Equation 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. @@ -80,25 +76,26 @@ Let's start with the most basic edit: add some text to a file and see that the w $$ F = m \cdot a$$ (eq:Newton) -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`. +8. To refer to this equation we need to use `{eq}` and call the identifier within the `` to achieve: Refer to Equation {eq}`eq:Newton`. ```md Refer to Equation {eq}`eq:Newton` ``` -## 3. Referencing a Table +## Referencing a Table -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:'. +9. 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 + ```md ```{table} Example Table :name: tab-example | Column 1 | Column 2 | |----------|----------| | A | B | ``` -``` + ``` + ```{table} Example Table name: tab-example @@ -115,11 +112,11 @@ name: tab-example ``` -## 4. Referencing a Figure +## Referencing a Figure -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:'. +11. This can also be done for a figure. Let's add a figure as we learnt to do in [Exercise 7](007.md), but this time adding an identifier using `name:`. -```md + ```md ```{figure} figures/example.png --- width: 80% @@ -128,7 +125,7 @@ name: tab-example --- Example figure. ``` -``` + ``` 12. Refer to the figure in the format {numref}`Figure {number} ` using `{numref}` as follows: @@ -136,7 +133,7 @@ name: tab-example {numref}`Figure {number} ` ``` -## 5. Referencing a Link +## Referencing a Link 13. Finally, lets reference a link, using the following syntax: @@ -151,8 +148,6 @@ Here is the [link to the template](https://teachbooks.github.io/template/). ``` -## 6. Commit Your Changes - 14. When you are ready, commit your changes to the repository by clicking on the green `Commit changes` button. 15. Add a commit message. From 222cfedacdbe21a38a0b34034f275b8209579560 Mon Sep 17 00:00:00 2001 From: Katia Gatt Date: Wed, 26 Mar 2025 00:01:22 +0100 Subject: [PATCH 17/31] Update 009.md --- book/syntax_exercises/009.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/book/syntax_exercises/009.md b/book/syntax_exercises/009.md index 63743c6..6fda948 100644 --- a/book/syntax_exercises/009.md +++ b/book/syntax_exercises/009.md @@ -25,14 +25,14 @@ For example, if you want to link to Exercise 7, you can write: [Go to Exercise 7](../exercises/007.md) ``` -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. For example: [Jump to the next section](#referencing-an-equation) +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. The code below gives: [Jump to the next section](#referencing-an-equation) ```md [Jump to the next section](#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 in the same repository. +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 within brackets as shown in the example below. This could be once again in the same markdown file, or a different file in the same repository. ```md (exercise_1)= @@ -55,7 +55,7 @@ This will display: My favourite exercise was {ref}`the first one `. ``` -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. This will display: My favourite exercise was [this 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 @@ -104,7 +104,7 @@ name: tab-example | A | B | ``` -10. Refer to the table like {numref}`Table {number} ` using {numref} and {number} as follows: +10. Refer to the table like {numref}`Table {number} ` using `{numref}` and `{number}` as follows: ```md From 8df769acf7a3b4a218d8a9fb98f2eb94b5c024e0 Mon Sep 17 00:00:00 2001 From: Katia Gatt Date: Wed, 26 Mar 2025 15:40:46 +0100 Subject: [PATCH 18/31] Update 009.md --- book/syntax_exercises/009.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/book/syntax_exercises/009.md b/book/syntax_exercises/009.md index 6fda948..3cbf0e1 100644 --- a/book/syntax_exercises/009.md +++ b/book/syntax_exercises/009.md @@ -13,7 +13,7 @@ Referencing elements properly ensures that readers can navigate your book more e ## Referencing a Chapter or Section 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: +2. Let's start with the simplest way to create a reference to another chapter. Try this out by directly linking the chapter through the file path as shown in the following syntax. ```md [Text to display](path/to/file.md) @@ -25,7 +25,7 @@ For example, if you want to link to Exercise 7, you can write: [Go to Exercise 7](../exercises/007.md) ``` -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. The code below gives: [Jump to the next section](#referencing-an-equation) +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. Use the example below to test this out. This code gives: [Jump to the next section](#referencing-an-equation) ```md [Jump to the next section](#referencing-an-equation) @@ -76,7 +76,7 @@ This will display: My favourite exercise was {ref}`the first one `. $$ F = m \cdot a$$ (eq:Newton) -8. To refer to this equation we need to use `{eq}` and call the identifier within the `` to achieve: Refer to Equation {eq}`eq:Newton`. +8. Refer to this equation by using `{eq}` and calling the identifier within the `` to achieve: Refer to Equation {eq}`eq:Newton`. ```md Refer to Equation {eq}`eq:Newton` @@ -135,7 +135,7 @@ name: tab-example ## Referencing a Link -13. Finally, lets reference a link, using the following syntax: +13. Finally, let's reference a link, using the following syntax: ```md [Text to display](url) From 3a2db9bc6f666340c3728a5abd3df5d6ee4b195f Mon Sep 17 00:00:00 2001 From: Katia Gatt Date: Wed, 26 Mar 2025 15:50:13 +0100 Subject: [PATCH 19/31] updated numbering 09 --- book/syntax_exercises/009.md | 33 +++++++++++++++++---------------- 1 file changed, 17 insertions(+), 16 deletions(-) diff --git a/book/syntax_exercises/009.md b/book/syntax_exercises/009.md index 3cbf0e1..f7c1720 100644 --- a/book/syntax_exercises/009.md +++ b/book/syntax_exercises/009.md @@ -76,7 +76,7 @@ This will display: My favourite exercise was {ref}`the first one `. $$ F = m \cdot a$$ (eq:Newton) -8. Refer to this equation by using `{eq}` and calling the identifier within the `` to achieve: Refer to Equation {eq}`eq:Newton`. +9. Refer to this equation by using `{eq}` and calling the identifier within the `` to achieve: Refer to Equation {eq}`eq:Newton`. ```md Refer to Equation {eq}`eq:Newton` @@ -85,16 +85,17 @@ Refer to Equation {eq}`eq:Newton` ## Referencing a Table -9. 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:`. +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 | - ``` + ```{table} Example Table + :name: tab-example + | Column 1 | Column 2 | + |----------|----------| + | A | B | ``` + ``` + ```{table} Example Table @@ -104,7 +105,7 @@ name: tab-example | A | B | ``` -10. Refer to the table like {numref}`Table {number} ` using `{numref}` and `{number}` as follows: +11. Refer to the table like {numref}`Table {number} ` using `{numref}` and `{number}` as follows: ```md @@ -114,7 +115,7 @@ name: tab-example ## Referencing a Figure -11. This can also be done for a figure. Let's add a figure as we learnt to do in [Exercise 7](007.md), but this time adding an identifier using `name:`. +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 @@ -127,7 +128,7 @@ name: tab-example ``` ``` -12. Refer to the figure in the format {numref}`Figure {number} ` using `{numref}` as follows: +13. Refer to the figure in the format {numref}`Figure {number} ` using `{numref}` as follows: ```md {numref}`Figure {number} ` @@ -135,7 +136,7 @@ name: tab-example ## Referencing a Link -13. Finally, let's reference a link, using the following syntax: +14. Finally, let's reference a link, using the following syntax: ```md [Text to display](url) @@ -148,13 +149,13 @@ Here is the [link to the template](https://teachbooks.github.io/template/). ``` -14. When you are ready, commit your changes to the repository by clicking on the green `Commit changes` button. +15. When you are ready, commit your changes to the repository by clicking on the green `Commit changes` button. -15. Add a commit message. +16. Add a commit message. -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. 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. +18. Do you see your change? If you don't see it click `CTRL`+`F5`/`Control`+`F5`to refresh the page. ```{admonition} Check your understanding From 278ac39643d074e04ba01a6e6175d91b9b1e60b3 Mon Sep 17 00:00:00 2001 From: Katia Gatt Date: Wed, 26 Mar 2025 15:55:38 +0100 Subject: [PATCH 20/31] updated indent --- book/syntax_exercises/009.md | 24 ++++++++---------------- 1 file changed, 8 insertions(+), 16 deletions(-) diff --git a/book/syntax_exercises/009.md b/book/syntax_exercises/009.md index f7c1720..f526538 100644 --- a/book/syntax_exercises/009.md +++ b/book/syntax_exercises/009.md @@ -97,14 +97,6 @@ Refer to Equation {eq}`eq:Newton` ``` - -```{table} Example Table -name: tab-example -| Column 1 | Column 2 | -|----------|----------| -| A | B | -``` - 11. Refer to the table like {numref}`Table {number} ` using `{numref}` and `{number}` as follows: @@ -118,14 +110,14 @@ name: tab-example 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. - ``` + ```{figure} figures/example.png + --- + width: 80% + align: center + name: fig-example + --- + Example figure. + ``` ``` 13. Refer to the figure in the format {numref}`Figure {number} ` using `{numref}` as follows: From efbfe489f6f322169a417085806c2215252b45f4 Mon Sep 17 00:00:00 2001 From: Katia Gatt Date: Wed, 26 Mar 2025 16:00:50 +0100 Subject: [PATCH 21/31] Update 009.md --- book/syntax_exercises/009.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/book/syntax_exercises/009.md b/book/syntax_exercises/009.md index f526538..cb2fdd4 100644 --- a/book/syntax_exercises/009.md +++ b/book/syntax_exercises/009.md @@ -87,14 +87,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 +```md ```{table} Example Table :name: tab-example | Column 1 | Column 2 | |----------|----------| | A | B | ``` - ``` +``` 11. Refer to the table like {numref}`Table {number} ` using `{numref}` and `{number}` as follows: @@ -109,7 +109,7 @@ 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 +```md ```{figure} figures/example.png --- width: 80% @@ -118,7 +118,7 @@ Refer to Equation {eq}`eq:Newton` --- Example figure. ``` - ``` +``` 13. Refer to the figure in the format {numref}`Figure {number} ` using `{numref}` as follows: From 99e915ad0745751ba9474ccb44192a0854907d9e Mon Sep 17 00:00:00 2001 From: Katia Gatt Date: Wed, 26 Mar 2025 16:16:16 +0100 Subject: [PATCH 22/31] indent retry --- book/syntax_exercises/009.md | 29 +++++++++++++++++++---------- 1 file changed, 19 insertions(+), 10 deletions(-) diff --git a/book/syntax_exercises/009.md b/book/syntax_exercises/009.md index cb2fdd4..e7384e9 100644 --- a/book/syntax_exercises/009.md +++ b/book/syntax_exercises/009.md @@ -87,15 +87,22 @@ 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 + ```md ```{table} Example Table :name: tab-example | Column 1 | Column 2 | |----------|----------| | A | B | ``` -``` + ``` + ``` +```{table} Example Table +:name: tab-example +| Column 1 | Column 2 | +|----------|----------| +| A | B | +``` 11. Refer to the table like {numref}`Table {number} ` using `{numref}` and `{number}` as follows: @@ -103,6 +110,7 @@ Refer to Equation {eq}`eq:Newton` ```md {numref}`Table {number} ` ``` + ## Referencing a Figure @@ -110,14 +118,15 @@ 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. - ``` +```{figure} figures/example.png +--- +width: 80% +align: center +name: fig-example +--- +Example figure. +``` +``` ``` 13. Refer to the figure in the format {numref}`Figure {number} ` using `{numref}` as follows: From 537a5794175ce0dd3756c3f1929d176c32114f47 Mon Sep 17 00:00:00 2001 From: Katia Gatt Date: Wed, 26 Mar 2025 16:19:11 +0100 Subject: [PATCH 23/31] indent retry 2 --- book/syntax_exercises/009.md | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/book/syntax_exercises/009.md b/book/syntax_exercises/009.md index e7384e9..e612a30 100644 --- a/book/syntax_exercises/009.md +++ b/book/syntax_exercises/009.md @@ -95,7 +95,7 @@ Refer to Equation {eq}`eq:Newton` | A | B | ``` ``` - ``` + ```{table} Example Table :name: tab-example @@ -117,17 +117,17 @@ 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} ` using `{numref}` as follows: From 42f6aeebefae43505cfbb95ba299cea17cf9ac37 Mon Sep 17 00:00:00 2001 From: Katia Gatt Date: Wed, 26 Mar 2025 16:29:10 +0100 Subject: [PATCH 24/31] indent retry 3 --- book/syntax_exercises/009.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/book/syntax_exercises/009.md b/book/syntax_exercises/009.md index e612a30..cbc41b4 100644 --- a/book/syntax_exercises/009.md +++ b/book/syntax_exercises/009.md @@ -87,14 +87,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 + ````md ```{table} Example Table :name: tab-example | Column 1 | Column 2 | |----------|----------| | A | B | ``` - ``` + ```` ```{table} Example Table @@ -117,7 +117,7 @@ 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 + ````md ```{figure} figures/example.png --- width: 80% @@ -126,7 +126,7 @@ Refer to Equation {eq}`eq:Newton` --- Example figure. ``` - ``` + ```` 13. Refer to the figure in the format {numref}`Figure {number} ` using `{numref}` as follows: From 09e0a7a2cee98fe2db3e94b6f500a96788ce1d0a Mon Sep 17 00:00:00 2001 From: Tom van Woudenberg Date: Thu, 27 Mar 2025 08:37:07 +0100 Subject: [PATCH 25/31] add empty text --- book/syntax_exercises/009.md | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/book/syntax_exercises/009.md b/book/syntax_exercises/009.md index 8b23a46..4fb0e8f 100644 --- a/book/syntax_exercises/009.md +++ b/book/syntax_exercises/009.md @@ -24,6 +24,12 @@ For example, if you want to link to Exercise 7, you can write: ```md [Go to Exercise 7](../exercises/007.md) ``` + +If you leave the text part empty, the title of the chapter you're referring to will be used: + +```md +[](path/to/file.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. ```md From 601c7704f01963b3ac1b6a4f9728dfb64b5f63a8 Mon Sep 17 00:00:00 2001 From: Tom van Woudenberg Date: Thu, 27 Mar 2025 08:37:21 +0100 Subject: [PATCH 26/31] update tip --- book/syntax_exercises/008.md | 4 ++-- book/syntax_exercises/009.md | 5 +++++ 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/book/syntax_exercises/008.md b/book/syntax_exercises/008.md index 59c792b..c363da7 100644 --- a/book/syntax_exercises/008.md +++ b/book/syntax_exercises/008.md @@ -35,8 +35,8 @@ align: center Make sure the file extension of your figure is correct because markdown differentiates capital letters! ``` -```{Warning} -If your figure is in a different directory than your chapter, you'll need to refer it using relative parts. If your figure is in a subdirectory of the directory of the chapter, go deeper with `subdirectory/` (e.g. `figures/
.png`). If your figure is in another directory, move upwards with `../` (e.g. `../../figure/
` ) +```{tip} +If your figure is in a different directory than your chapter, you'll need to refer it using relative parts. If your figure is in a subdirectory of the directory of the chapter, go deeper with `subdirectory/` (e.g. `/
.png`). If your figure is in another directory, move upwards with `../` (e.g. `../..//
` ) ``` 6. To link and display an online figure, you can use the same `{figure}` directive. Just past in the : diff --git a/book/syntax_exercises/009.md b/book/syntax_exercises/009.md index 4fb0e8f..6f8e9ef 100644 --- a/book/syntax_exercises/009.md +++ b/book/syntax_exercises/009.md @@ -30,6 +30,11 @@ If you leave the text part empty, the title of the chapter you're referring to w ```md [](path/to/file.md) ``` + +```{tip} +If the chapter you're referring to is in different directory than your chapter, you'll need to refer it using relative parts. If the to be referenced chapter is in a subdirectory of the directory of the chapter, go deeper with `subdirectory/` (e.g. `/.md`). If the to be referenced chapter is in another directory, move upwards with `../` (e.g. `../..//` ) +``` + 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. ```md From aee353683e6c5f741dfa045b66573594d16bd579 Mon Sep 17 00:00:00 2001 From: Tom van Woudenberg Date: Thu, 27 Mar 2025 08:41:31 +0100 Subject: [PATCH 27/31] Update book/syntax_exercises/009.md Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> --- book/syntax_exercises/009.md | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/book/syntax_exercises/009.md b/book/syntax_exercises/009.md index 64883c8..32d1ba6 100644 --- a/book/syntax_exercises/009.md +++ b/book/syntax_exercises/009.md @@ -163,8 +163,7 @@ Here is the [link to the template](https://teachbooks.github.io/template/). 16. Add a commit message. -17. 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. To see your 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). 18. Do you see your change? If you don't see it click `CTRL`+`F5`/`Control`+`F5`to refresh the page. From 551c3f0a3026151d1adb808e3566ade0884eb2b5 Mon Sep 17 00:00:00 2001 From: Tom van Woudenberg Date: Thu, 27 Mar 2025 08:41:51 +0100 Subject: [PATCH 28/31] Update 009.md --- book/syntax_exercises/009.md | 61 ++++++++++++++++++------------------ 1 file changed, 31 insertions(+), 30 deletions(-) diff --git a/book/syntax_exercises/009.md b/book/syntax_exercises/009.md index 64883c8..ee85af1 100644 --- a/book/syntax_exercises/009.md +++ b/book/syntax_exercises/009.md @@ -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 `. - ```md - My favourite exercise was {ref}`the first one `. - ``` +```md +My favourite exercise was {ref}`the first one `. +``` 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 `. 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} ` 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? +``` \ No newline at end of file From b2b5a1a20a89647e9fccb1beeff2e9d96dad15eb Mon Sep 17 00:00:00 2001 From: Tom van Woudenberg Date: Thu, 27 Mar 2025 08:50:32 +0100 Subject: [PATCH 29/31] Additions --- book/syntax_exercises/009.md | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/book/syntax_exercises/009.md b/book/syntax_exercises/009.md index d46c66e..a80e705 100644 --- a/book/syntax_exercises/009.md +++ b/book/syntax_exercises/009.md @@ -85,7 +85,7 @@ $$ F = m \cdot a$$ (eq:Newton) $$ F = m \cdot a$$ (eq:Newton) -9. Refer to this equation by using `{eq}` and calling the identifier within the `` to achieve: Refer to Equation {eq}`eq:Newton`. +9. Refer to this equation by using `{eq}` and calling the identifier within the `` to achieve: Refer to Equation {eq}`eq:Newton`. This will automatically insert the number of the equation. You can add text as you did in exercise 6. Alternatively, you can use the default `[]()`: [Newton Equation](eq:Newton). ```md Refer to Equation {eq}`eq:Newton` @@ -113,14 +113,14 @@ Refer to Equation {eq}`eq:Newton` | A | B | ``` -11. Refer to the table like {numref}`Table {number} ` using `{numref}` and `{number}` as follows: +11. Refer to the table like {numref}`Table {number} ` using `{numref}` and `{number}` as follows. You can add text as you did in exercise 6. ```md {numref}`Table {number} ` ``` - +Or use the default `[]()`: [Reference to Example Table](tab-example) ## Referencing a Figure @@ -138,12 +138,15 @@ Example figure. ```` -13. Refer to the figure in the format {numref}`Figure {number} ` using `{numref}` as follows: +13. Refer to the figure in the format {numref}`Figure {number} ` using `{numref}` as follows. You can add text as you did in exercise 6. ```md {numref}`Figure {number} ` ``` +Alternatively use `{ref}` to use the figure name instead of number, or use the default `[](
)`. + + ## Referencing a Link 14. Finally, let's reference a link, using the following syntax: From 026cd47dda2def0dcd309668a68b4bbe8cba9808 Mon Sep 17 00:00:00 2001 From: Tom van Woudenberg Date: Thu, 27 Mar 2025 08:59:58 +0100 Subject: [PATCH 30/31] hide answers --- book/syntax_exercises/009.md | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/book/syntax_exercises/009.md b/book/syntax_exercises/009.md index a80e705..76ca506 100644 --- a/book/syntax_exercises/009.md +++ b/book/syntax_exercises/009.md @@ -35,7 +35,7 @@ If you leave the text part empty, the title of the chapter you're referring to w If the chapter you're referring to is in different directory than your chapter, you'll need to refer it using relative parts. If the to be referenced chapter is in a subdirectory of the directory of the chapter, go deeper with `subdirectory/` (e.g. `/.md`). If the to be referenced chapter is in another directory, move upwards with `../` (e.g. `../..//` ) ``` -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. Use the example below to test this out. This code gives: [Jump to the next section](#referencing-an-equation) +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. Use the example below to test this out. ```md [Jump to the next section](#referencing-an-equation) @@ -49,7 +49,7 @@ If the chapter you're referring to is in different directory than your chapter, Let's start with the most basic edit: add some text to a file and see that the website is updated... ``` -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`. +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 My favourite exercise was {ref}`exercise_1`. @@ -57,14 +57,13 @@ 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 `. ```md My favourite exercise was {ref}`the first one `. ``` -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). +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. ```md @@ -85,12 +84,13 @@ $$ F = m \cdot a$$ (eq:Newton) $$ F = m \cdot a$$ (eq:Newton) -9. Refer to this equation by using `{eq}` and calling the identifier within the `` to achieve: Refer to Equation {eq}`eq:Newton`. This will automatically insert the number of the equation. You can add text as you did in exercise 6. Alternatively, you can use the default `[]()`: [Newton Equation](eq:Newton). +9. Refer to this equation by using `{eq}` and calling the identifier within the ``. This will automatically insert the number of the equation. You can add text as you did in exercise 6. ```md Refer to Equation {eq}`eq:Newton` ``` +Alternatively, you can use the default `[](). ## Referencing a Table @@ -113,14 +113,14 @@ Refer to Equation {eq}`eq:Newton` | A | B | ``` -11. Refer to the table like {numref}`Table {number} ` using `{numref}` and `{number}` as follows. You can add text as you did in exercise 6. +11. Refer to the table like with custom text 'Table' and the number using `{numref}` and `{number}` as follows. You can add text as you did in exercise 6. ```md {numref}`Table {number} ` ``` -Or use the default `[](
)`: [Reference to Example Table](tab-example) +Or use the default `[](
)`. ## Referencing a Figure @@ -138,13 +138,13 @@ Example figure. ```` -13. Refer to the figure in the format {numref}`Figure {number} ` using `{numref}` as follows. You can add text as you did in exercise 6. +13. Refer to the figure in the with custom text 'Figure' and the number using `{numref}` as follows. You can add text as you did in exercise 6. ```md {numref}`Figure {number} ` ``` -Alternatively use `{ref}` to use the figure name instead of number, or use the default `[](
)`. +Alternatively, you get an automatic text 'Fig.' and the number when using `` {numref}`` ``. Or use `{ref}` to use the figure name instead of number. Next to all of that you can use the default `[](
)`. ## Referencing a Link @@ -154,7 +154,7 @@ Alternatively use `{ref}` to use the figure name instead of number, or use the d ```md [Text to display](url) ``` -For example, you can use the code below to display: Here is the [link to the template](https://teachbooks.github.io/template/). +For example, you can use the code. ```md From 8f08bd1a82bbe7a2a9dd4ad0fb0d0903edc105ca Mon Sep 17 00:00:00 2001 From: Tom van Woudenberg Date: Thu, 27 Mar 2025 09:04:07 +0100 Subject: [PATCH 31/31] final changes --- book/syntax_exercises/009.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/book/syntax_exercises/009.md b/book/syntax_exercises/009.md index 76ca506..5a99762 100644 --- a/book/syntax_exercises/009.md +++ b/book/syntax_exercises/009.md @@ -90,7 +90,7 @@ $$ F = m \cdot a$$ (eq:Newton) Refer to Equation {eq}`eq:Newton` ``` -Alternatively, you can use the default `[](). +Alternatively, you can use the default `[]()`. ## Referencing a Table @@ -113,14 +113,14 @@ Alternatively, you can use the default `[](). | A | B | ``` -11. Refer to the table like with custom text 'Table' and the number using `{numref}` and `{number}` as follows. You can add text as you did in exercise 6. +11. Refer to the table like with custom text 'My table' and the number using `{numref}` and `{number}` as follows. You can add text as you did in exercise 6. ```md -{numref}`Table {number} ` +{numref}`My table {number} ` ``` -Or use the default `[](
)`. +Alternatively, you get an automatic text 'Table ' and the number when using `` {numref}`` ``. Or use `{ref}` to use the table name instead of number. Next to all of that you can use the default `[](
)`. ## Referencing a Figure