Jupyter Magic Commands Cheat Sheet



An IPython notebook cheat sheet. A (hopefully stylish) cheat sheet containting IPython notebook commands and keyboard shortcuts to stick by your computer and show the world that you are an in-progress python guru. Jupyter stores a list of keybord shortcuts under the menu at the top: Help Keyboard Shortcuts, or by pressing H in command mode (more on that later). It’s worth checking this each time you update Jupyter, as more shortcuts are added all the time. Anaconda cheatsheet by uniqtech. Anaconda is a technical package manager, a distribution of libraries and softwares, that is especial l y useful for data scientists. It can save hours of. Cheat Sheet - Jupyter Notebook Keyboard Shortcuts. Command Mode (Blue). Shows the Command Palette enter. Goes into Edit Mode (green) for the currently selected cell.

  • Jupyter Tutorial
  • IPython
  • Jupyter
  • QtConsole
  • JupyterLab
  • Jupyter Resources
  • Selected Reading

Markdown cell displays text which can be formatted using markdown language. In order to enter a text which should not be treated as code by Notebook server, it must be first converted as markdown cell either from cell menu or by using keyboard shortcut M while in command mode. The In[] prompt before cell disappears.

Header cell

A markdown cell can display header text of 6 sizes, similar to HTML headers. Start the text in markdown cell by # symbol. Use as many # symbols corresponding to level of header you want. It means single # will render biggest header line, and six # symbols renders header of smallest font size. The rendering will take place when you run the cell either from cell menu or run button of toolbar.

Following screenshot shows markdown cells in edit mode with headers of three different levels.

When cells are run, the output is as follows −

Note that Jupyter notebook markdown doesn’t support WYSWYG feature. The effect of formatting will be rendered only after the markdown cell is run.

Ordered Lists

To render a numbered list as is done by <ol> tag of HTML, the First item in the list should be numbered as 1. Subsequent items may be given any number. It will be rendered serially when the markdown cell is run. To show an indented list, press tab key and start first item in each sublist with 1.

If you give the following data for markdown −

It will display the following list −

Bullet lists

Each item in the list will display a solid circle if it starts with – symbol where as solid square symbol will be displayed if list starts with * symbol. The following example explains this feature −

The rendered markdown shows up as below −

Hyperlinks

Markdown text starting with http or https automatically renders hyperlink. To attach link to text, place text in square brackets [] and link in parentheses () optionally including hovering text. Following screenshot will explain this.

The rendered markdown appears as shown below −

Bold and Italics

To show a text in bold face, put it in between double underscores or two asterisks. To show in italics, put it between single underscores or single asterisks.

The result is as shown below −

Images

To display image in a markdown cell, choose ‘Insert image’ option from Edit menu and browse to desired image file. The markdown cell shows its syntax as follows −

Image will be rendered on the notebook as shown below −

Cheat

Table

In a markdown cell, a table can be constructed using | (pipe symbol) and – (dash) to mark columns and rows. Note that the symbols need not be exactly aligned while typing. It should only take respective place of column borders and row border. Notebook will automatically resize according to content. A table is constructed as shown below −

The output table will be rendered as shown below −

It is possible to build a single PDF that contains all of your book’s content. Thispage describes a couple ways to do so.

Warning

PDF building is experimental, and may change or have bugs.

There are two approaches to building PDF files.

Build a PDF from your book HTML¶

It is possible to build a single PDF from your book’s HTML. This starts byconverting all of your book’s content into a single HTML file, and then rendersit as a PDF by emulating a browser from the command-line.

Installation¶

Your system will need to use pyppeteer to parse the generated HTML forconversion to PDF.

You can install it like so:

You may also need to install this bundle of packages below (on *nix systems):

Build¶

To build a single PDF from your book’s HTML, use the following command:

or

Jupyter Lab Cheat Sheet

Warning

If you get a “MaxRetryError” and see mentions of SSL in the error message when building the PDF,this could be due to a bug in pyppeteer as it downloads Chromium for the first time.See this GitHub commentfor a potential fix, and this Jupyter Book issuewhere we’re tracking the issue.

Control the look of PDF via HTML¶

Because you are using HTML as an intermediary for your book’s PDF, you can control the look and feel of the HTML via your own CSS rules. Most CSS changes that you make to your HTML website will also persist in the PDF version of that website. For information about how to define your own CSS rules, see Custom CSS or JavaScript.

To add CSS rules that only apply to the printed PDF, use the @mediaprint CSS pattern to define print-specific rules. These will only be applied when the HTML is being printed, and will not show up in your non-PDF website.

For example, to hide the right table of contents at print time, you could add this rule:

The right Table of Contents would be present in your live website, but hidden when someone printed a PDF of your website.

Build a PDF using LaTeX¶

You can also use LaTeX to build a PDF of your book.This can behave differently depending on your operating system and tex setup.This section tries to recommend a few best-practices.

The default is to build your project as a single PDF file, however it is possible to buildindividual PDF files for each page of the project by enabling the --individualpages optionwhen using the pdflatex builder.

Installation¶

For Debian-based Linux platforms it is recommended to install the following packages:

Alternatively you can install the full TeX Live distribution.

Magic

For OSX you may want to use MacTeX which is a moreuser friendly approach. Alternatively you may also use TeX Live.

For Windows users, please install TeX Live.

Build¶

jupyter-book uses the jupyterbook-latex packagewhich handles much of the customised LaTeX infrastructure. A feature list of this package can be foundhere. Itenables building pdf files with full support for the file and part/chapterstructures that are defined in the _toc.yml.

If you need to turn off this package, the following config is required:

To build a PDF of your project using LaTeX, use the following command:

or

Jupiter Magic Commands Cheat Sheet Download

Jupiter magic commands cheat sheet printable

Note

If you would just like to generate the latex file you may use:

Individual PDF Files:

Warning

Jupiter Magic Commands Cheat Sheet Pdf

The current implementation of --individualpages does not make use of the improvementsintroduced by jupyterbook-latex anduses the default latex writer included with Sphinx.We are currently working on making improvements to how --individualpages are constructed.You can track progress here

To build PDF files for each page of the project,you can specify the option --individualpages for --builder=pdflatex.

The individual PDF files will be available in the _build/latex build folder.These files will have the same name as the source file or, if nested in folders, will be named {folder}-{filename}.pdf.

Note

When specifying a page using the build command,the --individualpages will automatically be set to True.

In the future we intend for this to produce latex documents more suitable to single pages(see issue #904).

Updating the name of the Global PDF file¶

To update the name of your PDF file you can set the following in _config.yml

This will act as an automatic override when Sphinx builds thelatex_documents. It is typically inferred by Sphinx but whenusing jupyter-book naming the file in the _config.yml generally makes iteasier to find.

Using a different LaTeX engine¶

The current default is to use xelatex to build pdf files.

Warning

The --individualpages option currently uses pdflatex by default.

Some users may want to switch to using a different LaTeX engine such as pdflatex.To revert the LaTeX engine to pdflatex you can add the following to your _config.yml

Note

Jupyter Cheat Sheet Pdf

The Sphinx documentation for available builderscontains a full list of supported latex builders.

Other Sphinx LaTeX settings¶

Other LaTeX settings availableto Sphinx can be passed through using the config sectionof Sphinx in the _config.yml file for your project.

Jupyter Command Help

For example, if you would like to set the latex_toplevel_sectioning option to use part instead of chapter you would use: