Close Navigation
Learn more about IBKR accounts
Jupyter Notebook Tutorial: Installation, Components and Magic Commands – Part III

Jupyter Notebook Tutorial: Installation, Components and Magic Commands – Part III

Posted February 14, 2023
Jay Parmar
QuantInsti

See Part I for an overview of Jupyter Notebook and Part II for the different components of Jupyter notebooks.

How to write down in Markdown in Jupyter Notebook?

It is the markdown functionality that brings interactivity to Jupyter environment. Markdown cells not only lets you write text, but it allows you to format it, add a hyperlink, and include HTML code. Additionally, it also allows you to define ordered and unordered lists, insert images and tables, add mathematical equations, write in LaTex, and so on. It even allows you to write programming code within the text without losing any syntax.

Once you have a markdown cell (you can use the shortcut M in command mode to convert a code cell to markdown cell), you can start writing the text the way you want. Below-mentioned are the functionalities supported by markdown cells.

Headings

To create headings, use the hash symbol # followed by a space and the heading. Doing so creates a title or level 1 heading. If you want to create a sub-heading, use ## followed by a space and the sub-heading. The notebook allows creating headings up to six levels. Each level will have the equivalent number of # marks, as shown below:

# Heading 1 – Title
## Heading 2 – Heading
### Heading 3 – Sub-heading
#### Heading 4 – Heading at level four
##### Heading 5 – Heading at level five
###### Heading 6 – Heading at level six

Emphasis

You can make text italic by surrounding it with * or _.

InputOutput
*This is italic text.*This is italic text.
_This is italic text._This is italic text.

You can make text bold by surrounding it with ** or __.

InputOutput
**This is italic text.**This is italic text.
__This is italic text.__This is italic text.

Monospace Fonts

If you want to refer to some code, filename, or file path within the text, you can use monospace fonts to differentiate the normal text and the monospace fonts. You can do so by surrounding the text with a single back quotation mark. (`)

This is written in monospace fonts.

Line Breaks

You can use the HTML line break tag <br> to insert the carriage-return within a line to break it.

Font Color

You can change the color of text by using the HTML font tag along with its color attribute. For example, to color the text in blue, you can use the following code:

<font color='blue'>The color of this text is blue.</font>

The output of the above code is shown below:

The color of this text is blue.

Change the color attribute of the font tag to change the text color. Remember, not all markdown text works with the font tag. Hence, review it carefully.

Blockquotes

Use a greater than sign > followed by a space to type or insert a blockquote. The output will be indented with Grey horizontal line to the left of it. For example, the output of the line > Jupyter makes life easy! will be as follows:

Jupyter makes life easy!

Unordered Lists

You can create an unordered list using the minus or dash sign - followed by an item name. The next time goes on the next line.

- Item 1
- Item 2
- Item 3

To create a sub list, the same procedure is followed; however, with an indentation. Can you create a list as shown below:

  • Item 1
    • Item 1.1
    • Item 1.2
      • Item 1.2.1
  • Item 2
    • Item 2.1
    • Item 2.2

In Jupyter, the first-level list items would generally have solid circles, the next level would have solid squares and the subsequent levels would have hollow circles.

Ordered Lists

Ordered lists can be created by manually specifying the item number such as 1 followed by a dot and space, and finally, item name. To create a sub-list, the procedure would be the same.

  1. Chapter 1
    1. Section 1.1
  2. Chapter 2
    1. Section 2.1
    2. Section 2.2

Horizontal Lines

You can create a horizontal line by using three asterisks ***.


Hyperlinks

You can convert any normal text into a hyperlink by surrounding it with square brackets followed by the actual link in parenthesis. For example,

[QuantInsti's Blog](https://blog.quantinsti.com)

will result in

QuantInsti’s Blog

Stay tuned for the next installment to learn how to handle images in Jupyter Notebook.

Originally posted on QuantInsti Blog: https://blog.quantinsti.com/jupyter-notebook-tutorial-installation-components-magic-commands/.

Share Traders Insight FacebookShare Traders Insight LinkedinShare Traders Insight TwitterShare IBKR Campus

Disclosure: Interactive Brokers

Information posted on IBKR Campus that is provided by third-parties does NOT constitute a recommendation that you should contract for the services of that third party. Third-party participants who contribute to IBKR Campus are independent of Interactive Brokers and Interactive Brokers does not make any representations or warranties concerning the services offered, their past or future performance, or the accuracy of the information provided by the third party. Past performance is no guarantee of future results.

This material is from QuantInsti and is being posted with its permission. The views expressed in this material are solely those of the author and/or QuantInsti and Interactive Brokers is not endorsing or recommending any investment or trading discussed in the material. This material is not and should not be construed as an offer to buy or sell any security. It should not be construed as research or investment advice or a recommendation to buy, sell or hold any security or commodity. This material does not and is not intended to take into account the particular financial conditions, investment objectives or requirements of individual customers. Before acting on this material, you should consider whether it is suitable for your particular circumstances and, as necessary, seek professional advice.

IBKR Campus Newsletters

This website uses cookies to collect usage information in order to offer a better browsing experience. By browsing this site or by clicking on the "ACCEPT COOKIES" button you accept our Cookie Policy.