• Stars
    star
    626
  • Rank 71,755 (Top 2 %)
  • Language
    TypeScript
  • License
    BSD 3-Clause "New...
  • Created about 7 years ago
  • Updated about 2 months ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

JupyterLab extension for live editing of LaTeX documents

JupyterLab LaTeX

build stable latest
ci-badge binder-badge binder-badge

An extension for JupyterLab which allows for live-editing of LaTeX documents.

Usage

To use, right-click on an open .tex document within JupyterLab, and select Show LaTeX Preview: preview This will compile the .tex file and open the rendered PDF document. Subsequent saves of the file will automatically update the PDF. If the PDF fails to compile (possibly due to a syntax error), an error panel will open detailing the LaTeX error.

For more advanced usage documentation, see here.

Requirements

  • JupyterLab >= 4.0
    • older versions are supported in previous releases available on PyPI and npm, check releases
  • Python >= 3.8
  • An application that can compile .tex files to PDF (e.g., pdflatex, xelatex; use pdflatex.exe on Windows with MiKTeX). This application must be available as a command in the same environment as the notebook server.
  • An application that can process .bib files for producing bibliographies. As with the LaTeX command, this must be available in the same environment as the notebook server.

Installation

This extension includes both a notebook server extension (which interfaces with the LaTeX compiler) and a lab extension (which provides the UI for the LaTeX preview). The Python package named jupyterlab_latex provides both of them as a prebuilt extension.

To install the extension, run the following in your terminal:

pip install jupyterlab_latex

Check installation

To ensure that extension is properly installed, you could check server and lab extensions:

jupyter server extension list

and see the block like this in the output

jupyterlab_latex enabled
    - Validating jupyterlab_latex...
Package jupyterlab_latex took 0.0010s to import
      jupyterlab_latex 4.0.0 OK

then

jupyter labextension list

and see the block like this in the output

@jupyterlab/latex v3.1.0 enabled OK (python, jupyterlab-latex)

Customization

The extension defaults to running xelatex on the server. This command may be customized (e.g., to use pdflatex instead) by customizing your jupyter_notebook_config.py file:

c.LatexConfig.latex_command = 'pdflatex'

The extension defaults to running bibtex for generating a bibliography if a .bib file is found. You can also configure the bibliography command by setting

c.LatexConfig.bib_command = '<custom_bib_command>'

To render references (\ref{...}), such as equation or chapter numbers, you would need to compile in multiple passes by setting

c.LatexConfig.run_times = 2

Security and customizing shell escapes

LaTeX files have the ability to run arbitrary code by triggering external shell commands. This is a security risk, and so most LaTeX distributions restrict the commands that you can run in the shell.

You can customize the behavior by setting the LatexConfig.shell_escape value. It can take three values: "restricted" (default) to allow only commands considered safe to be executed, "allow" to allow all commands, and "disallow" to disallow all commands. For example, to force your LaTeX distribution to run any command, use:

c.LatexConfig.shell_escape = "allow"

Contributing

If you would like to contribute to the project, please read our contributor documentation.

JupyterLab follows the official Jupyter Code of Conduct.

Development install

Note: You will need NodeJS to build the extension package.

The jlpm command is JupyterLab's pinned version of yarn that is installed with JupyterLab. You may use yarn or npm in lieu of jlpm below.

To simplify the development setup, you can use the following Conda environment:

conda create -n jupyterlab-latex-env -c conda-forge python=3.10 jupyterlab=4.0.0 jupyter_packaging=0.12.3 nodejs=18
conda activate jupyterlab-latex-env
# Clone the repo to your local environment
git clone https://github.com/jupyterlab/jupyterlab-latex.git
# Change directory to the jupyterlab-latex directory
cd jupyterlab-latex
# Install package in development mode
pip install -e .

# Link your development version of the extension with JupyterLab
jupyter labextension develop . --overwrite
# Server extension must be manually installed in develop mode
jupyter server extension enable jupyterlab_latex
# Rebuild extension Typescript source after making changes
jlpm run build

You can watch the source directory and run JupyterLab at the same time in different terminals to watch for changes in the extension's source and automatically rebuild the extension.

# Watch the source directory in one terminal, automatically rebuilding when needed
jlpm run watch
# Run JupyterLab in another terminal
jupyter lab

With the watch command running, every saved change will immediately be built locally and available in your running JupyterLab. Refresh JupyterLab to load the change in your browser (you may need to wait several seconds for the extension to be rebuilt).

Changes

For information on the changes with different versions of the jupyterlab-latex library, see our changelog

More Repositories

1

jupyterlab

JupyterLab computational environment.
TypeScript
14,050
star
2

jupyterlab-desktop

JupyterLab desktop application, based on Electron.
TypeScript
3,616
star
3

jupyter-ai

A generative AI extension for JupyterLab
Python
3,132
star
4

jupyterlab-git

A Git extension for JupyterLab
TypeScript
1,453
star
5

jupyterlab-toc

Table of Contents extension for JupyterLab
TypeScript
726
star
6

lumino

Lumino is a library for building interactive web applications
TypeScript
612
star
7

debugger

A visual debugger for Jupyter notebooks, consoles, and source files
TypeScript
562
star
8

jupyter-renderers

Renderers and renderer extensions for JupyterLab
HTML
488
star
9

extension-examples

JupyterLab Extensions by Examples
TypeScript
443
star
10

jupyterlab-github

GitHub integration for JupyterLab
TypeScript
412
star
11

jupyterlab-google-drive

Cloud storage for JupyterLab using Google Drive
TypeScript
400
star
12

retrolab

JupyterLab distribution with a retro look and feel 🌅
Jupyter Notebook
282
star
13

jupyterlab-monaco

A JupyterLab extension providing the Monaco editor
TypeScript
237
star
14

jupyterlab-demo

Demonstrations of JupyterLab
Jupyter Notebook
184
star
15

extension-cookiecutter-ts

A cookiecutter recipe for JupyterLab extensions in Typescript
CSS
179
star
16

jupyterlab-data-explorer

First class datasets in JupyterLab
TypeScript
178
star
17

jupyter-collaboration

A Jupyter Server Extension Providing Support for Y Documents
Jupyter Notebook
163
star
18

jupyterlab_server

A set of server components for JupyterLab and JupyterLab like applications
Python
139
star
19

jupyterlab-hdf5

Open and explore HDF5 files in JupyterLab. Can handle very large (TB) sized files, and datasets of any dimensionality
Jupyter Notebook
115
star
20

jupyterlab-celltags

A JupyterLab extension for notebook cell tags
TypeScript
113
star
21

jupyterlab-commenting

Commenting and annotation for JupyterLab
Jupyter Notebook
101
star
22

language-packs

Language packs for JupyterLab ecosystem
Python
78
star
23

scipy2018-jupyterlab-tutorial

Tutorial material and instruction for scipy 2018 jupyterlab tutorial
Jupyter Notebook
73
star
24

frontends-team-compass

A repository for team interaction, syncing, and handling meeting notes across the JupyterLab ecosystem.
58
star
25

extension-cookiecutter-js

A cookiecutter recipe for building JupyterLab extensions.
Python
55
star
26

jupyterlab-shortcutui

A JupyterLab extension for managing keyboard shortcuts
TypeScript
54
star
27

scipy2019-jupyterlab-tutorial

Scipy 2019 JupyterLab tutorial
Jupyter Notebook
51
star
28

extension-template

A `copier` template for JupyterLab extensions
Jinja
51
star
29

jupyterlab-statusbar

A status bar for JupyterLab
TypeScript
49
star
30

theme-cookiecutter

A cookiecutter template to help you make new JupyterLab theme extensions
CSS
49
star
31

jupyterlab-plugin-playground

A dynamic extension loader for JupyterLab
TypeScript
47
star
32

jupyterlab_pygments

Pygments theme making use of JupyterLab CSS variables
Python
39
star
33

hatch-jupyter-builder

A hatch plugin to help build Jupyter packages
Python
38
star
34

pull-requests

A JupyterLab extension for reviewing GitHub pull requests
Python
37
star
35

jupyterlab_xkcd

Random xkcd comic in a JupyterLab panel
TypeScript
31
star
36

galata

JupyterLab UI Testing Framework
JavaScript
30
star
37

jupyterlab-metadata-service

Linked data exploration in JupyterLab.
TypeScript
29
star
38

jupyterlab-telemetry

A JupyterLab extension for logging and telemetry of usage data
TypeScript
29
star
39

jupyterlab_apod

JupyterLab extension tutorial answer key. Please see the tutorial at https://jupyterlab.readthedocs.io/en/stable/extension/extension_tutorial.html
TypeScript
23
star
40

jupytercon-jupyterlab-tutorial

JupyterCon 2018 JupyterLab tutorial
Jupyter Notebook
22
star
41

mimerender-cookiecutter-ts

Cookie cutter for JupyterLab mimerenderer extensions using TypeScript
Python
19
star
42

pytest-check-links

pytest plugin that checks URLs
Python
17
star
43

jupyterlab-mp4

Example mimerenderer extension for showing mp4 videos.
TypeScript
17
star
44

mimerender-cookiecutter

A cookiecutter for rendering MIME type based output
Python
15
star
45

jupyter-chat

An extension to add a chat panel to JupyterLab
TypeScript
14
star
46

ui-profiler

Extension for profiling performance of JupyterLab UI for JupyterLab core developers, extension developers, and advanced users.
TypeScript
13
star
47

benchmarks

Benchmarking tools for JupyterLab
Jupyter Notebook
12
star
48

maintainer-tools

Workflows and Actions meant to be used by other repositories to make repo maintenance easier
Python
11
star
49

runall-extension

Add a "Run All Cells" toolbar button, context menu item, and keyboard shortcut.
TypeScript
8
star
50

jupyterlab-media

Repository storing movies and other media for JupyterLab tutorials and documentation
8
star
51

vscode-config-template

A copier template for creating the IDE config needed to debug the Python and Typescript code in any Jupyter project
Dockerfile
8
star
52

jupytercon-jupyterlab-training

JupyterCon 2018 JupyterLab Training
7
star
53

jupyterlab-translate

JupyterLab Language pack helper
Python
7
star
54

richoutput-js

Experimental investigation into a rendermime for es6 modules rendering rich output
Jupyter Notebook
7
star
55

jupyterlab-module-federation

Experimental playground for a JupyterLab extension system based on Module Federation
Python
5
star
56

jupyterlab-bot

JupyterLab Bot
Python
5
star
57

jupyterlab-probot

A probot for JupyterLab development
TypeScript
3
star
58

language-pack-cookiecutter

Template for Jupyterlab Language packs
Jinja
3
star
59

ux-research

3
star
60

.github

Community health files for the @JupyterLab organization
1
star
61

jupyter-builder

Build tools for JupyterLab (and remixes)
Python
1
star