|
6 | 6 | "metadata": {},
|
7 | 7 | "source": [
|
8 | 8 | "---\n",
|
9 |
| - "title: \"Minimal Example of Tutorial in Jupyter Notebook with Python\"\n", |
| 9 | + "title: \"Minimal Example of Tutorial in Jupyter Notebook (using Quarto Markdown) with Python\"\n", |
10 | 10 | "author: Raniere Silva\n",
|
11 | 11 | "image: img/cover.jpg\n",
|
12 | 12 | "image-alt: Green snake.\n",
|
|
19 | 19 | "id": "be35f2aa-c8e8-4c9a-9375-8ab72b5e33a4",
|
20 | 20 | "metadata": {},
|
21 | 21 | "source": [
|
22 |
| - "This example illustrates the **required** metadata by [`methodshub`](https://github.com/GESIS-Methods-Hub/methodshub)." |
| 22 | + "This example illustrates all the **required** metadata used by [`andrew`](https://github.com/GESIS-Methods-Hub/andrew) for a tutorial written as a Jupyter Notebook [@jupyter2021]." |
| 23 | + ] |
| 24 | + }, |
| 25 | + { |
| 26 | + "attachments": {}, |
| 27 | + "cell_type": "markdown", |
| 28 | + "id": "80ff7c64", |
| 29 | + "metadata": {}, |
| 30 | + "source": [ |
| 31 | + "Although footnotes are supported, the use of footnotes is discouraged[^1].\n", |
| 32 | + "\n", |
| 33 | + "[^1]: Because of it makes navigation harder." |
| 34 | + ] |
| 35 | + }, |
| 36 | + { |
| 37 | + "attachments": {}, |
| 38 | + "cell_type": "markdown", |
| 39 | + "id": "d37f15e2", |
| 40 | + "metadata": {}, |
| 41 | + "source": [ |
| 42 | + "Math can be written using [LaTeX](https://www.latex-project.org/) and is render by [MathJax](https://www.mathjax.org/). Both inline, for example $x$, and standalone, for example $$x = \\sqrt{a^2 + b^2}\\text{,}$$ is supported." |
| 43 | + ] |
| 44 | + }, |
| 45 | + { |
| 46 | + "attachments": {}, |
| 47 | + "cell_type": "markdown", |
| 48 | + "id": "23d37c50", |
| 49 | + "metadata": {}, |
| 50 | + "source": [ |
| 51 | + "::: {.callout-important}\n", |
| 52 | + "\n", |
| 53 | + "We recommend to install and use [Quarto JupyterLab Extension](https://quarto.org/docs/tools/jupyter-lab-extension.html) for a preview of the content closer to the final output.\n", |
| 54 | + "\n", |
| 55 | + ":::" |
| 56 | + ] |
| 57 | + }, |
| 58 | + { |
| 59 | + "attachments": {}, |
| 60 | + "cell_type": "markdown", |
| 61 | + "id": "fd3444f7", |
| 62 | + "metadata": {}, |
| 63 | + "source": [ |
| 64 | + "Cross reference of figures, tables, equations, ... is also supported. For example, see @fig-north.\n", |
| 65 | + "\n", |
| 66 | + "{#fig-north}" |
23 | 67 | ]
|
24 | 68 | },
|
25 | 69 | {
|
|
32 | 76 | ]
|
33 | 77 | },
|
34 | 78 | {
|
35 |
| - "cell_type": "raw", |
| 79 | + "cell_type": "markdown", |
36 | 80 | "id": "d9295b92",
|
| 81 | + "metadata": { |
| 82 | + "user_expressions": [ |
| 83 | + { |
| 84 | + "expression": "1 + 1", |
| 85 | + "result": { |
| 86 | + "data": { |
| 87 | + "text/plain": "2" |
| 88 | + }, |
| 89 | + "metadata": {}, |
| 90 | + "status": "ok" |
| 91 | + } |
| 92 | + } |
| 93 | + ] |
| 94 | + }, |
| 95 | + "source": [ |
| 96 | + "Python code can be executed and the output can be included inline, for example `1 + 1` is equal to `{python} 1 + 1`, and standalone, for example" |
| 97 | + ] |
| 98 | + }, |
| 99 | + { |
| 100 | + "cell_type": "code", |
| 101 | + "execution_count": null, |
| 102 | + "id": "ef50c824-f91a-4986-a87b-af213d24b23b", |
| 103 | + "metadata": {}, |
| 104 | + "outputs": [], |
| 105 | + "source": [ |
| 106 | + "a = 1\n", |
| 107 | + "b = 1\n", |
| 108 | + "\n", |
| 109 | + "a + b" |
| 110 | + ] |
| 111 | + }, |
| 112 | + { |
| 113 | + "attachments": {}, |
| 114 | + "cell_type": "markdown", |
| 115 | + "id": "bedf15e4", |
| 116 | + "metadata": {}, |
| 117 | + "source": [ |
| 118 | + "Annotation of code blocks is also supported. For example,\n", |
| 119 | + "\n", |
| 120 | + "```python\n", |
| 121 | + "(3 // 2) != (3 % 2) # <1>\n", |
| 122 | + "```\n", |
| 123 | + "1. `%` calculates the remainder on integer division." |
| 124 | + ] |
| 125 | + }, |
| 126 | + { |
| 127 | + "attachments": {}, |
| 128 | + "cell_type": "markdown", |
| 129 | + "id": "d407a703", |
37 | 130 | "metadata": {},
|
38 | 131 | "source": [
|
39 |
| - "1 + 1" |
| 132 | + "## Creation of figure with Python" |
| 133 | + ] |
| 134 | + }, |
| 135 | + { |
| 136 | + "cell_type": "code", |
| 137 | + "execution_count": null, |
| 138 | + "id": "f2c34406", |
| 139 | + "metadata": {}, |
| 140 | + "outputs": [], |
| 141 | + "source": [ |
| 142 | + "import random\n", |
| 143 | + "import matplotlib.pyplot as plt\n", |
| 144 | + "\n", |
| 145 | + "plt.plot([random.randint(0, 9) for x in range(10)])" |
40 | 146 | ]
|
41 | 147 | },
|
42 | 148 | {
|
|
47 | 153 | "source": [
|
48 | 154 | "## Binder\n",
|
49 | 155 | "\n",
|
50 |
| - "The link to Binder will launch Jupyter Lab." |
| 156 | + "The link to Binder will launch the default [JupyterLab IDE](https://jupyterlab.readthedocs.io/)." |
| 157 | + ] |
| 158 | + }, |
| 159 | + { |
| 160 | + "cell_type": "raw", |
| 161 | + "id": "1f3e25cd", |
| 162 | + "metadata": {}, |
| 163 | + "source": [ |
| 164 | + "## References\n", |
| 165 | + "\n", |
| 166 | + "::: {#refs}\n", |
| 167 | + ":::" |
51 | 168 | ]
|
52 | 169 | }
|
53 | 170 | ],
|
|
67 | 184 | "name": "python",
|
68 | 185 | "nbconvert_exporter": "python",
|
69 | 186 | "pygments_lexer": "ipython3",
|
70 |
| - "version": "3.9.10" |
| 187 | + "version": "3.11.4" |
71 | 188 | }
|
72 | 189 | },
|
73 | 190 | "nbformat": 4,
|
|
0 commit comments