Skip to content

Commit 05c96a2

Browse files
committed
Improve example
1 parent 60a77be commit 05c96a2

File tree

4 files changed

+141
-14
lines changed

4 files changed

+141
-14
lines changed

README.md

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Minimal Example of Tutorial in Jupyter Notebook with Python
22

3-
[index.ipynb](index.ipynb) illustrates all the **required** metadata used by [`methodshub`](https://github.com/GESIS-Methods-Hub/methodshub).
3+
[index.ipynb](index.ipynb) illustrates all the **required** metadata used by [`andrew`](https://github.com/GESIS-Methods-Hub/andrew). **We recommend to use [Quarto JupyterLab Extension](https://quarto.org/docs/tools/jupyter-lab-extension.html)**.
44

55
## Metadata
66

@@ -14,18 +14,22 @@
1414

1515
## Supported Features
1616

17-
| Feature | [`methodshub`](https://github.com/GESIS-Methods-Hub/methodshub) | Notes |
17+
| Feature | [`andrew`](https://github.com/GESIS-Methods-Hub/andrew) | Notes |
1818
| --- | --- | --- |
19-
| Pandoc’s Markdown | 👍 | |
20-
| Callout Blocks | 👍 | |
19+
| [Pandoc’s Markdown](https://pandoc.org/MANUAL.html#pandocs-markdown) | 👍 | |
20+
| Images | 👍 | As part of Pandoc’s Markdown |
21+
| Tables | 👍 | As part of Pandoc’s Markdown |
22+
| Citations and Bibliographies | 👍 | As part of Pandoc’s Markdown |
23+
| Footnotes | 👍 | As part of Pandoc’s Markdown |
24+
| Math | 👍 | Powered by [MathJax](https://www.mathjax.org/) as part of Pandoc’s Markdown |
25+
| Callout Blocks | 😥 | See https://github.com/GESIS-Methods-Hub/andrew/issues/149 |
2126
| Cross References | 👍 | |
22-
| Citations and Bibliographies | 👍 | |
23-
| [Code Annotation](https://quarto.org/docs/authoring/code-annotation.html) | 👍 | Requires Quarto >= 1.3 |
27+
| Computation of [Inline Code](https://rmarkdown.rstudio.com/lesson-4.html) | 👍 | Requires Quarto >= 1.4 |
2428
| Computation of [Code Chunks](https://rmarkdown.rstudio.com/lesson-3.html) | 👍 | |
25-
| Computation of [Inline Code](https://rmarkdown.rstudio.com/lesson-4.html) | 👍 | |
29+
| [Code Annotation](https://quarto.org/docs/authoring/code-annotation.html) | 👍 | Requires Quarto >= 1.3 |
2630
| [Title Blocks](https://quarto.org/docs/authoring/title-blocks.html) | 👍 | Generated by Quarto based on YAML header |
2731
| How to cite in the appendix | 👍 | Generated by Quarto based on YAML header |
2832

2933
## Binder
3034

31-
The link to Binder will launch the default Jupyter Lab interface.
35+
This repository doesn't list any [configuration file](https://mybinder.readthedocs.io/en/latest/using/config_files.html) for Binder and will be launch with the default [JupyterLab IDE](https://jupyterlab.readthedocs.io/).

environment.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
name: minimal-example-ipynb-python
2+
channels:
3+
- conda-forge
4+
dependencies:
5+
- python=3.11
6+
- matplotlib

img/north.jpg

162 KB
Loading

index.ipynb

Lines changed: 123 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
"metadata": {},
77
"source": [
88
"---\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",
1010
"author: Raniere Silva\n",
1111
"image: img/cover.jpg\n",
1212
"image-alt: Green snake.\n",
@@ -19,7 +19,51 @@
1919
"id": "be35f2aa-c8e8-4c9a-9375-8ab72b5e33a4",
2020
"metadata": {},
2121
"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+
"![Photo of weathercock by Mat Brown. Available at <https://www.pexels.com/photo/silhouette-of-wind-vane-552600/>.](img/north.jpg){#fig-north}"
2367
]
2468
},
2569
{
@@ -32,11 +76,73 @@
3276
]
3377
},
3478
{
35-
"cell_type": "raw",
79+
"cell_type": "markdown",
3680
"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",
37130
"metadata": {},
38131
"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)])"
40146
]
41147
},
42148
{
@@ -47,7 +153,18 @@
47153
"source": [
48154
"## Binder\n",
49155
"\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+
":::"
51168
]
52169
}
53170
],
@@ -67,7 +184,7 @@
67184
"name": "python",
68185
"nbconvert_exporter": "python",
69186
"pygments_lexer": "ipython3",
70-
"version": "3.9.10"
187+
"version": "3.11.4"
71188
}
72189
},
73190
"nbformat": 4,

0 commit comments

Comments
 (0)