diff options
Diffstat (limited to 'tutorials/module_1/jupyter_lab_notebook.md')
| -rw-r--r-- | tutorials/module_1/jupyter_lab_notebook.md | 67 |
1 files changed, 23 insertions, 44 deletions
diff --git a/tutorials/module_1/jupyter_lab_notebook.md b/tutorials/module_1/jupyter_lab_notebook.md index f9b3393..ab52654 100644 --- a/tutorials/module_1/jupyter_lab_notebook.md +++ b/tutorials/module_1/jupyter_lab_notebook.md @@ -12,15 +12,6 @@ Jupyter Notebooks can be installed either from the Anaconda Navigator home page Terminal: `conda install conda-forge::jupyterlab` ## Notebook Basics -- Creating a new notebook (`.ipynb`) -- Types of cells: - - Code - - Markdown - - Raw -- Running a cell: `Shift + Enter` -- Adding/removing cells -- Restarting the kernel -- Saving and auto-checkpoints Jupyter Notebooks are files which allows you to combine *Code* and *Markdown* cells in one single document. The code cells, allow you to interactively run python code and print and plot data in your document. If you wish to update or change data your code you can re-run the cell to update the output. The markdown cells allows you to write text, titles and insert images in your documentation using the markup language *Markdown*. @@ -45,47 +36,35 @@ The order of running code matters. Think of the code cells as code snippets. Eve Because of this, it's best practice to; Run cells in order, restart the kernel and run all cells (`Kernel -> Restart & Run All`) to make sure everything works cleanly and predictably and lastly, initialize important variables or imports in early cells, so they are always defined before they are needed. -## Writing and Running Code -- Python syntax: - - `print("Hello, world!")` - - Variables and functions - - Loops and conditionals -- Importing libraries: - - `import numpy as np` - - `import pandas as pd` - - `import matplotlib.pyplot as plt` - -## Using Markdown -- Headers: `#`, `##`, `###` + +## Making your document look good with Markdown +Creating titles or headers is done with the hash symbol. The number of hashes determines whether it's a sub-title +`#`, `##`, `###` + +### Lists +There are two types of list in - Bullet lists: `- item` - Numbered lists: `1. item` +### Style - Emphasis: _italic_, **bold**, `monospace` -- LaTeX equations: - - Inline: `$E = mc^2$` - - Block: `$$\int_0^\infty e^{-x^2} dx = \frac{\sqrt{\pi}}{2}$$` -- Embedding links and images +### Mathematical Equation +Markdown supports LaTeX format equations. Inline equation is opened and closed with a single `$`. For a block math a double `$$` is used instead of single. +- Inline: This equation is inline `$E = mc^2$` in with the markdown text. +- Block: Whilst this is a block: `$$\int_0^\infty e^{-x^2} dx = \frac{\sqrt{\pi}}{2}$$` +### Links and images +You can insert links to a different local file or online urls like this: \[Link](file.md). I insert an image it's the same however start with an exclamation mark `!` like this: !\[Image Caption](picture.png) -## Interactive Widgets (optional) +## Exporting and Sharing +To export your notebook go to -Install `ipywidgets` from your package manager + `File` > `Download As` -```python -import ipywidgets as widgets -widgets.IntSlider() -``` -Example using interact: +You can then select these options. -```python -from ipywidgets import interact -interact(lambda x: x**2, x=5) -``` - -## Exporting and Sharing -By default, jupyter auto-saves your notebooks as you work. +- Notebook (`.ipynb`) +- HTML +- PDF (requires LaTeX) +- Markdown -- File > Download As: - - Notebook (`.ipynb`) - - HTML - - PDF (requires LaTeX) - - Markdown +For homework assignments, download an HTML version of your document, then from your browser, save or print as a PDF. Alternatively, you can install the LaTeX typesetting system and export your document directly as PDF from jupyter. |
