Latex Jupyter Notebook



From jupyter docs: The subset of latex which is supported depends on the implementation in the client. In the Jupyter Notebook, this magic only renders the subset of latex defined by MathJax here. You could use markdown to display your formula: use single $ to indicate latex, or double $$ to center it. Close Jupyter Notebooks, open Anaconda Prompt, and run the following command: pip install jupytercontribnbextensions && jupyter contrib nbextension install. Once you've done that, start up a notebook and you should seen an Nbextensions tab. Clicking this tab will show you a list of available extensions.

Latest version

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 Jupyter notebook enables the use of some LaTeX
commands and environments 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. **User's LaTeX definitions** file can be loaded and used
7. **Export to plain HTML, Slides and LaTeX with a customized exporter**
8. Environments title/numbering can be customized by users in
``user_envs.json`` config file.
9. Styles can be customized in the ``latex_env.css`` stylesheet
10. **Autocompletion** for $, (, {, [, for LaTeX commands and environments
More environments can be simply added in ``user_envs.json`` or 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 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. Other options are
``slides_with_lenvs`` for converting to reveal-js presentations, and ``html_with_toclenvs`` to include a
table of contents. 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_env_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>`__
serves as
`documentation <https://rawgit.com/jfbercher/jupyter_latex_envs/master/src/latex_envs/static/doc/latex_env_doc.html>`__.
Installation
------------
The extension consists of a pypi package that includes a javascript
notebook extension, along with python code for nbconvert support. Since
Jupyter 4.2, pypi 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
- via conda, from the `conda-forge <https://conda-forge.github.io/>`__
`channel <https://anaconda.org/conda-forge>`__
- as part of the great
`jupyter_contrib_nbextensions <https://github.com/ipython-contrib/jupyter_contrib_nbextensions>`__
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,
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
2. install the notebook extension
::
jupyter nbextension install --py latex_envs [--user|--sys-prefix|--system]
3. and enable it
::
jupyter nbextension enable --py latex_envs [--user|--sys-prefix|--system]
For Jupyter versions before 4.2, the situation after step 1 is more
tricky, since the ``--py`` option isn't available, so you will have to
find the location of the source files manually as follows (instructions
adapted from [@jcb91](https://github.com/jcb91)'s
`jupyter_highlight_selected_word <https://github.com/jcb91/jupyter_highlight_selected_word>`__).
Execute
::
python -c 'import os.path as p; from latex_envs 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 first 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
`ipython-contrib/jupyter_contrib_nbextensions <https://github.com/ipython-contrib/jupyter_contrib_nbextensions>`__.
- 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

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.4.6
Filename, sizeFile typePython versionUpload dateHashes
Filename, size jupyter_latex_envs-1.4.6.tar.gz (861.7 kB) File type Source Python version None Upload dateHashes
Close

Hashes for jupyter_latex_envs-1.4.6.tar.gz

Hashes for jupyter_latex_envs-1.4.6.tar.gz
AlgorithmHash digest
SHA256070a31eb2dc488bba983915879a7c2939247bf5c3b669b398bdb36a9b5343872
MD562c1471a0d771a90401b7df6b18a2ee5
BLAKE2-2560e1555805de080d5542f76920364635e96e64d3b37f678befdfe3b16aa154205
-->

Learn how to run your Jupyter notebooks directly in your workspace in Azure Machine Learning studio. While you can launch Jupyter or JupyterLab, you can also edit and run your notebooks without leaving the workspace.

For information on how to create and manage files, including notebooks, see Create and manage files in your workspace.

Important

Features marked as (preview) are provided without a service level agreement, and it's not recommended for production workloads. Certain features might not be supported or might have constrained capabilities.For more information, see Supplemental Terms of Use for Microsoft Azure Previews.

Prerequisites

  • An Azure subscription. If you don't have an Azure subscription, create a free account before you begin.
  • A Machine Learning workspace. See Create an Azure Machine Learning workspace.

Edit a notebook

To edit a notebook, open any notebook located in the User files section of your workspace. Click on the cell you wish to edit. If you don't have any notebooks in this section, see Create and manage files in your workspace.

You can edit the notebook without connecting to a compute instance. When you want to run the cells in the notebook, select or create a compute instance. If you select a stopped compute instance, it will automatically start when you run the first cell.

When a compute instance is running, you can also use code completion, powered by Intellisense, in any Python notebook.

You can also launch Jupyter or JupyterLab from the notebook toolbar. Azure Machine Learning does not provide updates and fix bugs from Jupyter or JupyterLab as they are Open Source products outside of the boundary of Microsoft Support.

Focus mode

Use focus mode to expand your current view so you can focus on your active tabs. Focus mode hides the Notebooks file explorer.

  1. In the terminal window toolbar, select Focus mode to turn on focus mode. Depending on your window width, the tool may be located under the ... menu item in your toolbar.

  2. While in focus mode, return to the standard view by selecting Standard view.

Code completion (IntelliSense)

IntelliSense is a code-completion aid that includes many features: List Members, Parameter Info, Quick Info, and Complete Word. With only a few keystrokes, you can:

  • Learn more about the code you're using
  • Keep track of the parameters you're typing
  • Add calls to properties and methods

Insert code snippets (preview)

Use Ctrl+Space to trigger IntelliSense code snippets. Scroll through the suggestions or start typing to find the code you want to insert. Once you insert code, tab through the arguments to customize the code for your own use.

These same snippets are available when you open your notebook in VS Code. For a complete list of available snippets, see Azure Machine Learning VS Code Snippets.

You can browse and search the list of snippets by using the notebook toolbar to open the snippet panel.

From the snippets panel, you can also submit a request to add new snippets.

Clean your notebook (preview)

Over the course of creating a notebook, you typically end up with cells you used for data exploration or debugging. The gather feature will help you produce a clean notebook without these extraneous cells.

See Full List On Math.ubc.ca

  1. Run all of your notebook cells.
  2. Select the cell containing the code you wish the new notebook to run. For example, the code that submits an experiment, or perhaps the code that registers a model.
  3. Select the Gather icon that appears on the cell toolbar.
  4. Enter the name for your new 'gathered' notebook.

The new notebook contains only code cells, with all cells required to produce the same results as the cell you selected for gathering.

Save and checkpoint a notebook

Azure Machine Learning creates a checkpoint file when you create an ipynb file.

In the notebook toolbar, select the menu and then File>Save and checkpoint to manually save the notebook and it will add a checkpoint file associated with the notebook.

Every notebook is autosaved every 30 seconds. AutoSave updates only the initial ipynb file, not the checkpoint file.

Select Checkpoints in the notebook menu to create a named checkpoint and to revert the notebook to a saved checkpoint.

Export a notebook

In the notebook toolbar, select the menu and then Export As to export the notebook as any of the supported types:

  • Notebook
  • Python
  • HTML
  • LaTeX

The exported file is saved on your computer.

Run a notebook or Python script

To run a notebook or a Python script, you first connect to a running compute instance.

  • If you don't have a compute instance, use these steps to create one:

    1. In the notebook or script toolbar, to the right of the Compute dropdown, select + New Compute. Depending on your screen size, this may be located under a ... menu.
    2. Name the Compute and choose a Virtual Machine Size.
    3. Select Create.
    4. The compute instance is connected to the file automatically. You can now run the notebook cells or the Python script using the tool to the left of the compute instance.
  • If you have a stopped compute instance, select Start compute to the right of the Compute dropdown. Depending on your screen size, this may be located under a ... menu.

Only you can see and use the compute instances you create. Your User files are stored separately from the VM and are shared among all compute instances in the workspace.

View logs and output

Use notebook widgets to view the progress of the run and logs. A widget is asynchronous and provides updates until training finishes. Azure Machine Learning widgets are also supported in Jupyter and JupterLab.

Explore variables in the notebook

On the notebook toolbar, use the Variable explorer tool to show the name, type, length, and sample values for all variables that have been created in your notebook.

Select the tool to show the variable explorer window.

Navigate with a TOC

On the notebook toolbar, use the Table of contents tool to display or hide the table of contents. Start a markdown cell with a heading to add it to the table of contents. Click on an entry in the table to scroll to that cell in the notebook.

Jupyter

Change the notebook environment

The notebook toolbar allows you to change the environment on which your notebook runs.

These actions will not change the notebook state or the values of any variables in the notebook:

Latex Jupyter Notebook
ActionResult
Stop the kernelStops any running cell. Running a cell will automatically restart the kernel.
Navigate to another workspace sectionRunning cells are stopped.

These actions will reset the notebook state and will reset all variables in the notebook.

ActionResult
Change the kernelNotebook uses new kernel
Switch computeNotebook automatically uses the new compute.
Reset computeStarts again when you try to run a cell
Stop computeNo cells will run
Open notebook in Jupyter or JupyterLabNotebook opened in a new tab.

Add new kernels

Use the terminal to create and add new kernels to your compute instance. The notebook will automatically find all Jupyter kernels installed on the connected compute instance.

Use the kernel dropdown on the right to change to any of the installed kernels.

Status indicators

An indicator next to the Compute dropdown shows its status. The status is also shown in the dropdown itself.

ColorCompute status
GreenCompute running
RedCompute failed
BlackCompute stopped
Light BlueCompute creating, starting, restarting, setting Up
GrayCompute deleting, stopping

An indicator next to the Kernel dropdown shows its status.

ColorKernel status
GreenKernel connected, idle, busy
GrayKernel not connected
Latex Jupyter Notebook

Find compute details

Find details about your compute instances on the Compute page in studio.

Useful keyboard shortcuts

Similar to Jupyter Notebooks, Azure Machine Learning Studio notebooks have a modal user interface. The keyboard does different things depending on which mode the notebook cell is in. Azure Machine Learning Studio notebooks support the following two modes for a given code cell: command mode and edit mode.

Command mode shortcuts

A cell is in command mode when there is no text cursor prompting you to type. When a cell is in Command mode, you can edit the notebook as a whole but not type into individual cells. Enter command mode by pressing ESC or using the mouse to select outside of a cell's editor area. The left border of the active cell is blue and solid, and its Run button is blue.

ShortcutDescription
EnterEnter edit mode
Shift + EnterRun cell, select below
Control/Command + EnterRun cell
Alt + EnterRun cell, insert code cell below
Control/Command + Alt + EnterRun cell, insert markdown cell below
Alt + RRun all
YConvert cell to code
MConvert cell to markdown
Up/KSelect cell above
Down/JSelect cell below
AInsert code cell above
BInsert code cell below
Control/Command + Shift + AInsert markdown cell above
Control/Command + Shift + BInsert markdown cell below
XCut selected cell
CCopy selected cell
Shift + VPaste selected cell above
VPaste selected cell below
D DDelete selected cell
OToggle output
Shift + OToggle output scrolling
I IInterrupt kernel
0 0Restart kernel
Shift + SpaceScroll up
SpaceScroll down
TabChange focus to next focusable item (when tab trap disabled)
Control/Command + SSave notebook
1Change to h1
2Change to h2
3Change to h3
4Change to h4
5Change to h5
6Change to h6

Edit mode shortcuts

Edit mode is indicated by a text cursor prompting you to type in the editor area. When a cell is in edit mode, you can type into the cell. Enter edit mode by pressing Enter or using the mouse to select on a cell's editor area. The left border of the active cell is green and hatched, and its Run button is green. You also see the cursor prompt in the cell in Edit mode.

Latex Matrix Jupyter Notebook

Using the following keystroke shortcuts, you can more easily navigate and run code in Azure Machine Learning notebooks when in Edit mode.

ShortcutDescription
EscapeEnter command mode
Control/Command + SpaceActivate IntelliSense
Shift + EnterRun cell, select below
Control/Command + EnterRun cell
Alt + EnterRun cell, insert code cell below
Control/Command + Alt + EnterRun cell, insert markdown cell below
Alt + RRun all cells
UpMove cursor up or previous cell
DownMove cursor down or next cell
Control/Command + SSave notebook
Control/Command + UpGo to cell start
Control/Command + DownGo to cell end
TabCode completion or indent (if tab trap enabled)
Control/Command + MEnable/disable tab trap
Control/Command + ]Indent
Control/Command + [Dedent
Control/Command + ASelect all
Control/Command + ZUndo
Control/Command + Shift + ZRedo
Control/Command + YRedo
Control/Command + HomeGo to cell start
Control/Command + EndGo to cell end
Control/Command + LeftGo one word left
Control/Command + RightGo one word right
Control/Command + BackspaceDelete word before
Control/Command + DeleteDelete word after
Control/Command + /Toggle comment on cell

Troubleshooting

  • If you can't connect to a notebook, ensure that web socket communication is not disabled. For compute instance Jupyter functionality to work, web socket communication must be enabled. Ensure your network allows websocket connections to *.instances.azureml.net and *.instances.azureml.ms.
  • When compute instance is deployed in a private link workspace it can be only be accessed from within virtual network. If you are using custom DNS or hosts file please add an entry for < instance-name >.< region >.instances.azureml.ms with private IP address of workspace private endpoint. For more information see the custom DNS article.

See All Results For This Question

Next steps