The cursor prompt changes to show that all further changes will affect the virtual environment. (jupenv) root@ # You can exit the virtual environment by entering the following command. Here's how to format Markdown cells in Jupyter notebooks: Headings Use the number sign (#) followed by a blank space for notebook titles and section headings: # for titles ## for major headings ### for subheadings #### for 4th level subheadings; Emphasis Use the following code to emphasize text: Bold text: string or.string. Italic text. Not identical to the desired, but jupyter stopped renumbering when I wrote 1) 2) 3) etc. The ')' seems to disable the renumbering done by Jupyter's markdown. At lease for jupyter version 5.0.0 running python 3.5.2.

Newer version available (1.4.6)

Released:

Jupyter notebook extension which supports (some) LaTeX environments within markdown cells. Also provides support for labels and crossreferences, document wide numbering, bibliography, and more..

Project description

(some) LaTeX environments for Jupyter notebook
This extension for IPython 3.x or Jupyter enables to use some LaTeX
commands and environments in the notebook's markdown cells.
1. **LaTeX commands and environments**
- support for some LaTeX commands within markdown cells, *e.g.*
``textit``, ``textbf``, ``underline``
- support for **theorems-like environments**, support for labels and
cross references
- support for **lists**: *enumerate, itemize*,
- limited support for a **figure environment**,
- support for an environment *listing*,
- additional *textboxa* environment
2. **Citations and bibliography**
- support for ``cite`` with creation of a References section
3. **Document-wide numbering of equations and environments, support for
``label`` and ``ref``**
4. **Configuration toolbar**
5. **LaTeX_envs dropdown menu for a quick insertion of environments**
6. **Export to HTML and LaTeX with a customized exporter**
7. Styles can be customized in the ``latex_env.css`` stylesheet
More environments can be simply added in the source file
(``thmsInNb4.js``).
It is possible to export the notebooks to plain :math:`LaTeX` and html
while keeping all the features of the ``latex_envs`` notebook extension
in the converted version. We provide specialized exporters, pre and post
processors, templates. We also added entry-points to simplify the
conversion process. It is now as simple asIt is now as simple as
. code:: bash
jupyter nbconvert --to html_with_lenvs FILE.ipynb
or
. code:: bash
jupyter nbconvert --to latex_with_lenvs FILE.ipynb
to convert ``FILE.ipynb`` into html/latex while keeping all the features
of the ``latex_envs`` notebook extension in the converted version. The
LaTeX converter also expose several conversion options (read the
`docs <https://rawgit.com/jfbercher/jupyter_latex_envs/master/src/latex_envs/static/doc/latex_envs_doc.html>`__.
Demo/documentation
The ``doc`` subdirectory that constains an example notebook and its html
and pdf versions. This serves as the documentation. A demo notebook
``latex_env_doc.ipynb`` is provided. Its html version is
`latex_env_doc.html <https://rawgit.com/jfbercher/jupyter_latex_envs/master/src/latex_envs/static/doc/latex_env_doc.html>`__
and a pdf resulting from conversion to LaTeX is available as
`documentation <https://rawgit.com/jfbercher/jupyter_latex_envs/master/src/latex_envs/static/doc/documentation.pdf>`__.
Installation
The extension consists in a package that includes a javascript notebook
extension. Since Jupyter 4.2, this is the recommended way to distribute
nbextensions. The extension can be installed
- from the master version on the github repo (this will be always the
most recent version)
- via pip for the version hosted on Pypi
- as part of the great
`Jupyter-notebook-extensions <https://github.com/ipython-contrib/Jupyter-notebook-extensions>`__
collection. Follow the instructions there for installing. Once this
is done, you can open a tab at ``http://localhost:8888/nbextensions``
to enable and configure the various extensions.
From the github repo or from Pypi,
- **step 1**: install the package
- ``pip3 install https://github.com/jfbercher/jupyter_latex_envs/archive/master.zip [--user][--upgrade]``
- or ``pip3 install jupyter_latex_envs [--user][--upgrade]``
- or clone the repo and install ``git clone https://github.com/jfbercher/jupyter_latex_envs.git python3 setup.py install``
With Jupyter >= 4.2,
- **step 2**: install the notebook extension
::
jupyter nbextension install --py latex_envs [--user]
- **step 3**: and enable it
::
jupyter nbextension enable latex_envs [--user] --py
For Jupyter versions before 4.2, the situation is more tricky since you
will have to find the location of the source files (instructions from
@jcb91 found
`here <https://github.com/jcb91/jupyter_highlight_selected_word>`__):
execute
::
python -c 'import os.path as p; from jupyter_highlight_selected_word import __file__ as f, _jupyter_nbextension_paths as n; print(p.normpath(p.join(p.dirname(f), n()[0]['src'])))'
Then, issue
::
jupyter nbextension install <output source directory>
jupyter nbextension enable latex_envs/latex_envs
where ``<output source directory>`` is the output of the python command.
Disclaimer, sources and acknowledgments
Originally, I used a piece of code from the nice online markdown editor
``stackedit`` https://github.com/benweet/stackedit/issues/187, where the
authors also considered the problem of incorporating LaTeX markup in
their markdown.
I also studied and used examples and code from
https://github.com/ipython-contrib/IPython-notebook-extensions.
- This is done in the hope it can be useful. However there are many
impovements possible, in the code and in the documentation.
**Contributions will be welcome and deeply appreciated.**
- If you have issues, please post an issue at
``https://github.com/jfbercher/jupyter_latex_envs/issues``
`here <https://github.com/jfbercher/jupyter_latex_envs/issues>`__.
**Self-Promotion --** Like ``latex_envs``? Please star and follow the
`repository <https://github.com/jfbercher/jupyter_latex_envs>`__ on
GitHub.

Release historyRelease notifications | RSS feed

1.4.6

1.4.5

1.4.4

1.4.3

1.4.2

1.4.1

1.4.0

1.3.8.4

1.3.8.3

1.3.8.2

1.3.8.1

1.3.8

1.3.7.2

1.3.7.1

1.3.7

1.3.6

1.3.5.11

1.3.5.10

1.3.5.9

1.3.5.8

1.3.5.7

1.3.5.6

1.3.5.5

1.3.5.4

1.3.5.3

1.3.5.2

1.3.5.1

1.3.5

1.3.4

1.3.3

1.3.2

1.3.1

1.3.0.2

1.3.0.1

1.2.95

1.2.14

1.2.13

1.2.11

Free suara burung kenari isian ciblek. 1.2.10

1.2.8

1.2.7

1.2.6

1.2.5

1.2.4

1.2.3

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for jupyter_latex_envs, version 1.2.7
Filename, sizeFile typePython versionUpload dateHashes
Filename, size jupyter_latex_envs-1.2.7.tar.gz (574.5 kB) File type Source Python version None Upload dateHashes
Close

Hashes for jupyter_latex_envs-1.2.7.tar.gz

Hashes for jupyter_latex_envs-1.2.7.tar.gz
AlgorithmHash digest
SHA256e706ec8f720cf28d1254874383b830a02e2bf3d52ebc278c8cc50188d902f01e
MD5b726877f3122c87ab344e01ce3e7251a
BLAKE2-25653f718f555661d2615900cc79a0d79cb3093b5b4bb15f42df4909d75f4b9ed94

The Jupyter Notebook is an interactive computing environment that enables users to author notebook documents that include:

  • Live code

  • Interactive widgets

  • Plots

  • Narrative text

  • Equations

  • Images

  • Video

These documents provide a complete and self-contained record of a computation that can be converted to various formats and shared with others using email, Dropbox, version control systems (like git/GitHub) or nbviewer.ipython.org.

Additional resources

This material is adapted from the ICESat2 Hackweek intro-jupyter-git session by @fperez.

Components¶

The Jupyter Notebook combines three components:

  • The notebook web application

  • Kernels

  • Notebook documents

Notebook web application¶

The notebook web application enables users to:

  • Edit code in the browser, with automatic syntax highlighting, indentation, and tab completion/introspection.

  • Run code from the browser, with the results of computations attached to the code which generated them.

  • See the results of computations with rich media representations, such as HTML, LaTeX, PNG, SVG, PDF, etc.

  • Create and use interactive JavaScript wigets, which bind interactive user interface controls and visualizations to reactive kernel side computations.

  • Author narrative text using the Markdown markup language.

  • Build hierarchical documents that are organized into sections with different levels of headings.

  • Include mathematical equations using LaTeX syntax in Markdown, which are rendered in-browser by MathJax.

Kernels¶

Simply put, the kernel is the engine that runs the code. Each kernel is capable of running code in a single programming language and there are kernels available in over 100 programming languages.

IPython is the default kernel, it runs Python code.

Notebook documents¶

Notebook documents contain the inputs and outputs of an interactive session as well as narrative text that accompanies the code but is not meant for execution. Rich output generated by running code, including HTML, images, video, and plots, is embeddeed in the notebook, which makes it a complete and self-contained record of a computation.

When you run the notebook web application on your computer, notebook documents are just files on your local filesystem with a .ipynb extension. This allows you to use familiar workflows for organizing your notebooks into folders and sharing them with others using email, Dropbox and version control systems.

Notebooks consist of a linear sequence of cells. There are three basic cell types:

  • Code cells: Input and output of live code that is run in the kernel

  • Markdown cells: Narrative text with embedded LaTeX equations

  • Raw cells: Unformatted text that is included, without modification, when notebooks are converted to different formats using nbconvert

Notebooks can be exported to different static formats including HTML, reStructeredText, LaTeX, PDF, and slide shows using Jupyter’s nbconvert utility.

Furthermore, any notebook document available from a public URL on or GitHub can be shared via http://nbviewer.jupyter.org. This service loads the notebook document from the URL and renders it as a static web page. The resulting web page may thus be shared with others without their needing to install Jupyter.

Body¶

The body of a notebook is composed of cells. Each cell contains either markdown, code input, code output, or raw text. Cells can be included in any order and edited at-will, allowing for a large ammount of flexibility for constructing a narrative.

  • Markdown cells - These are used to build a nicely formatted narrative around the code in the document. The majority of this lesson is composed of markdown cells.

  • Code cells - These are used to define the computational code in the document. They come in two forms: the input cell where the user types the code to be executed, and the output cell which is the representation of the executed code. Depending on the code, this representation may be a simple scalar value, or something more complex like a plot or an interactive widget.

  • Raw cells - These are used when text needs to be included in raw form, without execution or transformation.

Modality¶

The notebook user interface is modal. This means that the keyboard behaves differently depending upon the current mode of the notebook. A notebook has two modes: edit and command.

Edit mode is indicated by a blue cell border and a prompt showing in the editor area. When a cell is in edit mode, you can type into the cell, like a normal text editor.

Command mode is indicated by a grey cell background. When in command mode, the structure of the notebook can be modified as a whole, but the text in individual cells cannot be changed. Most importantly, the keyboard is mapped to a set of shortcuts for efficiently performing notebook and cell actions. For example, pressing c when in command mode, will copy the current cell; no modifier is needed.

Enter edit mode by pressing Enter or using the mouse to click on a cell’s editor area.

Enter command mode by pressing Esc or using the mouse to click outside a cell’s editor area.

Do not attempt to type into a cell when in command mode; unexpected things will happen!

Mouse navigation¶

The first concept to understand in mouse-based navigation is that cells can be selected by clicking on them. The currently selected cell is indicated with a blue outline or gray background depending on whether the notebook is in edit or command mode. Clicking inside a cell’s editor area will enter edit mode. Clicking on the prompt or the output area of a cell will enter command mode.

The second concept to understand in mouse-based navigation is that cell actions usually apply to the currently selected cell. For example, to run the code in a cell, select it and then click the button in the toolbar or the Run->RunSelectedCells menu item. Similarly, to copy a cell, select it and then click the button in the toolbar or the Edit->Copy menu item. With this simple pattern, it should be possible to perform nearly every action with the mouse.

Markdown cells have one other state which can be modified with the mouse. These cells can either be rendered or unrendered. When they are rendered, a nice formatted representation of the cell’s contents will be presented. When they are unrendered, the raw text source of the cell will be presented. To render the selected cell with the mouse, click the button in the toolbar or the Run->RunSelectedCells menu item. To unrender the selected cell, double click on the cell.

Keyboard Navigation¶

The modal user interface of the Jupyter Notebook has been optimized for efficient keyboard usage. This is made possible by having two different sets of keyboard shortcuts: one set that is active in edit mode and another in command mode.

The most important keyboard shortcuts are Enter, which enters edit mode, and Esc, which enters command mode.

In edit mode, most of the keyboard is dedicated to typing into the cell’s editor. Thus, in edit mode there are relatively few shortcuts. In command mode, the entire keyboard is available for shortcuts, so there are many more possibilities.

The following shortcuts have been found to be the most useful in day-to-day tasks:

  • Basic navigation:

  • enter: Enter edit mode

  • shift-enter: run cell

  • up/k, down/j: Move to cell above/below

Jupyter
  • Saving the notebook: s

  • Cell types:

  • y: code

  • m: markdown

  • r: raw

  • Cell creation:

  • a: create new cell above current cell

  • b: create new cell below current cell

  • Cell editing:

  • x: cut

  • c: copy

  • v: paste

  • d: delete (press twice)

  • z: redo

  • Kernel operations (press twice):

  • i: interrupt kernel

  • 0: restart kernel

You can fully customize JupyterLab’s keybindings by accessing the Settings->AdvancedSettingsEditor menu item.

Running Code¶

First and foremost, the Jupyter Notebook is an interactive environment for writing and running code. Jupyter is capable of running code in a wide range of languages. However, this notebook, and the default kernel in Jupyter, runs Python code.

Code cells allow you to enter and run Python code¶

Run a code cell using Shift-Enter or pressing the button in the toolbar above:

Note the difference between the above printing statement and the operation below:

When a value is returned by a computation, it is displayed with a number, that tells you this is the output value of a given cell. You can later refere to any of these values (should you need one that you forgot to assign to a named variable). The last three are available respectively as auto-generated variables called _, __ and ___ (one, two and three underscores). In addition to these three convenience ones for recent results, you can use _N, where N is the number in [N], to access any numbered output.

There are two other keyboard shortcuts for running code:

  • Alt-Enter runs the current cell and inserts a new one below.

  • Note that Alt refers to the Option key on Macs. Make sure your browser settings do not intefere with the use of the Option key when using this shortcut.

  • Ctrl-Enter run the current cell and enters command mode.

  • Notice Shift-Enter runs the current cell and selects the cell below, while Ctrl-Enter stays on the executed cell in command mode.

Managing the IPython Kernel¶

Code is run in a separate process called the IPython Kernel. The Kernel can be interrupted or restarted. Try running the following cell and then hit the button in the toolbar above.

If the Kernel dies you will be prompted to restart it. Here we call the low-level system libc.time routine with the wrong argument viactypes to segfault the Python interpreter. To test it out, uncomment the next cell.

Run menu¶

The “Run” menu has a number of items for running code in different ways, including

  • Run Selected Cells

  • Run All Cells

  • Run Selected Cell or Current Line in Console Paddy power twitter.

  • Run All Above Selected Cell

  • Run Selected Cell and All Below

  • Restart Kernel and Run All Cells

Restarting the kernels¶

The kernel maintains the state of a notebook’s computations. You can reset this state by restarting the kernel. This is done by clicking on the in the toolbar above.

sys.stdout and sys.stderr¶

The stdout (standard output) and stderr (standard error) streams are displayed as text in the output area.

Output is asynchronous¶

All output is displayed as it is generated in the Kernel: instead of blocking on the execution of the entire cell, output is made available to the Notebook immediately as it is generated by the kernel (even though the whole cell is submitted for execution as a single unit).

If you execute the next cell, you will see the output one piece at a time, not all at the end:

Large outputs¶

To better handle large outputs, the output area can be collapsed. Run the following cell and then click on the vertical blue bar to the left of the output:

Markdown Cells¶

Text can be added to IPython Notebooks using Markdown cells. Markdown is a popular markup language that is a superset of HTML. Its specification can be found here:

You can view the source of a cell by double clicking on it, or while the cell is selected in command mode, press Enter to edit it. One A cell has been editted, use Shift-Enter to re-render it.

Local files¶

If you have local files in your Notebook directory, you can refer to these files in Markdown cells directly:

For example, in the images folder, we have the Python logo:

Itemize Jupiter Notebook 2018

and a video with the HTML5 video tag:

These do not embed the data into the notebook file, and require that the files exist when you are viewing the notebook.

Security of local files¶

Note that this means that the IPython notebook server also acts as a generic file serverfor files inside the same tree as your notebooks. Access is not granted outside thenotebook folder so you have strict control over what files are visible, but for thisreason it is highly recommended that you do not run the notebook server with a notebookdirectory at a high level in your filesystem (e.g. your home directory).

When you run the notebook in a password-protected manner, local file access is restrictedto authenticated users unless read-only views are active.

Extra Content¶

The following overview of Markdown is beyond the scope of this short tutorial, but it is included for your reference as you build your own Jupyter Notebooks during the Hackweek and beyond.

Markdown basics¶

You can make text italic or bold.

You can build nested itemized or enumerated lists:

  • One

    • Sublist

      • This

    • Sublist- That- The other thing

  • Two

    • Sublist

  • Three

    • Sublist

Now another list:

  1. Here we go

    1. Sublist

    2. Sublist

  2. There we go

  3. Now this

You can add horizontal rules: ---

Here is a blockquote:

Beautiful is better than ugly.Explicit is better than implicit.Simple is better than complex.Complex is better than complicated.Flat is better than nested.Sparse is better than dense.Readability counts.Special cases aren’t special enough to break the rules.Although practicality beats purity.Errors should never pass silently.Unless explicitly silenced.In the face of ambiguity, refuse the temptation to guess.There should be one– and preferably only one –obvious way to do it.Although that way may not be obvious at first unless you’re Dutch.Now is better than never.Although never is often better than right now.If the implementation is hard to explain, it’s a bad idea.If the implementation is easy to explain, it may be a good idea.Namespaces are one honking great idea – let’s do more of those!

And shorthand for links:

You can add headings using Markdown’s syntax:

Embedded code¶

You can embed code meant for illustration instead of execution in Python:

or other languages:

LaTeX equations¶

Courtesy of MathJax, you can include mathematical expressions both inline:(e^{ipi} + 1 = 0) and displayed:

Use single dolars delimiter for inline math, so $thisisinlineintmath$ will give (this is inlineint math), for example to refer to variable within text.

Double dollars $$int_0^{2pi}f(r,phi)partialphi$$ is used for standalone formulas:

[int_0^{2pi} f(r, phi) partial phi ]

Github flavored markdown (GFM)¶

The Notebook webapp support Github flavored markdown meaning that you can use triple backticks for code blocks

Gives

And a table like this :

A nice HTML Table

This

is

a

table

Itemize Jupiter Notebook 2019

General HTML¶

Because Markdown is a superset of HTML you can even add things like HTML tables:

Header 1Header 2
row 1, cell 1row 1, cell 2
row 2, cell 1row 2, cell 2

Try Jupyter Org

Typesetting Equations¶

The Markdown parser included in IPython is MathJax-aware. This means that you can freely mix in mathematical expressions using the MathJax subset of Tex and LaTeX.

You can use single-dollar signs to include inline math, e.g. $e^{ipi}=-1$ will render as (e^{i pi} = -1), and double-dollars for displayed math:

renders as:

Use Jupyter Notebook Online

[e^x=sum_{i=0}^infty frac{1}{i!}x^i]

You can also use more complex LaTeX constructs for displaying math, such as:

to produce the Lorenz equations:

begin{align}dot{x} & = sigma(y-x) dot{y} & = rho x - y - xz dot{z} & = -beta z + xyend{align}

Please refer to the MathJax documentation for a comprehensive description of which parts of LaTeX are supported, but note that Jupyter’s support for LaTeX is limited to mathematics. You can not use LaTeX typesetting constrcuts for text or document structure, for text formatting you should restrict yourself to Markdown syntax.