- Markdown in Jupyter/Ipython notebook cheatsheet. A Quick Guide on IPython(Jupyter) Magic Commands. IPython/Jupyter notebook keyboard shortcuts. What is a.ipynb file and why do we need it? Autosave in the Jupyter Notebook. How to pretty print multiple Variables in a Jupyter Notebook? How to share variables between two different Jupyter notebooks?
- Jupyter Starting Jupyter Client-Server model: The client is the webbrowser that sends and receives from a (possibly remote) Python webserver to the kernel. Start jupyter from the command line (in the working directory where you want to work from): jupyter notebook This will start the server and spawn a browser that is used for editing.
Yes, I’m aware of such comprehensive cheat sheets like this and this, they are great but too verbal and it’s hard to print them on one page to have it easily accessible. Eventually, I decided to gather all crucial points of the markdown syntax that are actual for Jupyter notebook and combine them in a concise cheat sheet that I present to you. Matplotlib Cheat Sheet EPFL CS 328 Numerical Methods for Visual Computing (Version 1) Common magic commands for Jupyter: # Enable inline backend (plots within notebooks).% matplotlib inline # Enable interactive inline backend.% matplotlib notebook Common import statements: # Package used for state-machine usage of Matplotlib. JUPYTER NOTEBOOKS CHEATSHEET Jupyter Notebook is an open-source web application that allows you to create and share documents that contain live code, equations, visualizations, and explanatory text. See full documentation for Jupyter Notebooks Installing Anaconda Distribution installs Jupyter Notebook Windows.
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
Jupiter Magic Commands Cheat Sheet Free
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.
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/chapter
structures 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
Note
If you would just like to generate the latex file you may use:
Individual PDF Files:
Warning
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.
Jupyter Magic Time
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
The Sphinx documentation for available builderscontains a full list of supported latex
builders.
Other Sphinx LaTeX settings¶
Jupyter Notebook Cheat Sheet
Other LaTeX settings availableto Sphinx can be passed through using the config sectionof Sphinx
in the _config.yml
file for your project.
For example, if you would like to set the latex_toplevel_sectioning option to use part
instead of chapter
you would use:
Jump to: Command Mode (press Esc to enable), Edit Mode (press Enter to enable)
Enter | enter edit mode |
Shift+Enter | run cell, select below |
Ctrl+Enter | run cell |
Alt+Enter | run cell, insert below |
Y | to code |
M | to markdown |
R | to raw |
1 | to heading 1 |
2,3,4,5,6 | to heading 2,3,4,5,6 |
Up/K | select cell above |
Down/J | select cell below |
A/B | insert cell above/below |
X | cut selected cell |
C | copy selected cell |
Shift+V | paste cell above |
V | paste cell below |
Z | undo last cell deletion |
D | delete selected cell |
Shift+M | merge cell below |
Ctrl+S | Save and Checkpoint |
L | toggle line numbers |
O | toggle output |
Shift+O | toggle output scrolling |
Esc | close pager |
H | show keyboard shortcut help dialog |
I | interrupt kernel |
0 | restart kernel |
Space | scroll down |
Shift+Space | scroll up |
Shift | ignore |
Tab | code completion or indent |
Shift+Tab | tooltip |
Ctrl+] | indent |
Ctrl+[ | dedent |
Ctrl+A | select all |
Ctrl+Z | undo |
Ctrl+Shift+Z | redo |
Ctrl+Y | redo |
Ctrl+Home | go to cell start |
Ctrl+Up | go to cell start |
Ctrl+End | go to cell end |
Ctrl+Down | go to cell end |
Ctrl+Left | go one word left |
Ctrl+Right | go one word right |
Ctrl+Backspace | delete word before |
Ctrl+Delete | delete word after |
Esc | command mode |
Ctrl+M | command mode |
Ctrl+Shift+minus | split cell |
Ctrl+S | Save and Checkpoint |
Up | move cursor up or previous cell |
Down | move cursor down or next cell |
Ctrl+/ | toggle comment on current or selected lines |
Created by SarthakMenpara on 6/19/2017