Notebook Markdown Tutorial#

This notebook provides a variety of demonstrations for using Markdown in Jupyter Notebooks, including formatting text, creating tables, displaying mathematical formulas, and inserting images.

Table of Contents#

Working with Images #

Option 1: Linking an Image#

How to LINK an image, resize, and align within a markdown cell (suppose the name of the image file is “Banner_MATH2319.png” in the same directory as in this Jupyter notebook):

<img src="./Banner_MATH2319.png" width=400 align="left"/>

Option 2: Inserting an Image#

How to INSERT an image within a markdown cell (suppose the name of the image file is “Banner_MATH2319.png” in the same directory as in this Jupyter notebook):

![Banner_MATH2319.png](attachment:Banner_MATH2319.png)

Alternatively, within Jupyter Notebook environment, go to Edit menu option and then choose “Insert Image”.

For the actual embedding to take place, you will also need to run your markdown cell!

The Difference#

When an image is linked, the image just displays within your notebook but does not become a part of your notebook. This keeps the notebook size small. This is the preferred option when you would like to share your notebook in PDF or HTML format.

When an image is inserted (that is, embedded), the image becomes part of your notebook. Consequently, notebook size becomes larger. However, this is the preferred option when you would like to share your notebook in Jupyter Notebook format.

Banner_MATH2319.png

Prep for Plotting #

import numpy as np
import matplotlib.pyplot as plt

%matplotlib inline 
%config InlineBackend.figure_format = 'retina'

plt.style.use("seaborn-v0_8")

How to Plot the Sine Function #

x = np.arange(0, 4 * np.pi, 0.1)
y = np.sin(x)
plt.plot(x, y)
plt.title("sine of x")
plt.show()
../_images/8efa0e3ab57080a8a578d997f8333bd9b8a247dbe9641a0cd0b10865fb66c48c.png

Working with Markdown Commands #

Header 3#

Header 4#

This is a block quote.

This is a line break:


This is code section example:

a = 23
b = 15
print(a+b)

Here is a line break
that looks nice.

Emphasis: Everybody likes machine learning.

This is italic.

This is bold.

This is bold and italic.

Here is an unordered list using “-” prefix for each list item:

  • Item 1

  • Item 2

  • Item 3

Here is an unordered list with a highlighed sub-list:

  • Item 1

  • Item 1.a

  • Item 1.b

  • Item 2

  • Item 3

Here is an ordered list - pay attention that we use the prefix “1.” for each list item so that the actual numbering is done automatically for us upon running this markdown cell:

  1. Item 1

  2. Item 2

  3. Item 3

Here is an ordered list with sublists using tabs:

  1. Item 1

    • Item 1A

    • Item 1B

      1. Item 1B.1

      2. Item 1B.2

    • Item 1C

    • Item 1D

  2. Item 2

  3. Item 3

How to create a table:

Raw code:

|Course Name | Code | Level|
|---|---|---|
|Machine Learning | 2319 | PG |
|Intro to Analytics | 2350 | UG |

Upon running the cell:

Course Name

Code

Level

Machine Learning

2319

PG

Intro to Analytics

2350

UG

This is a famous formula as a Latex example: \(E=mc^2\)

Here is a centered math formula: $\(\sum_i^{j+k} x^3= \frac{\alpha}{\beta}\)$

External webpage links: Our uni website is here.