JupyterLab extension for running LaTeX
Project description
JupyterLab LaTeX
build | stable | latest |
---|---|---|
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
:
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 >= 3.0
- older versions are supported in previous releases available on PyPI and npm, check releases
- Python >= 3.6
- An application that can compile
.tex
files to PDF (e.g.,pdflatex
,xelatex
; usepdflatex.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...
jupyterlab_latex 3.1.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>'
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"
Changes
For information on the changes with different versions of the jupyterlab-latex
library, see our changelog
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file jupyterlab_latex-3.1.0.tar.gz
.
File metadata
- Download URL: jupyterlab_latex-3.1.0.tar.gz
- Upload date:
- Size: 457.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/0.0.0 importlib_metadata/3.10.0 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.62.0 CPython/3.8.8
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | f44df285405b5b552b70d10f1f0573d61ca3a4d2ca50bd3097a63a27cdcde16e |
|
MD5 | 8fa93314b39f6eaf9ca46dc388a703fd |
|
BLAKE2b-256 | cd704fbb559553ab2f62631cd98179b4b3a506deec1263eace96196f1a3278e4 |
File details
Details for the file jupyterlab_latex-3.1.0-py3-none-any.whl
.
File metadata
- Download URL: jupyterlab_latex-3.1.0-py3-none-any.whl
- Upload date:
- Size: 900.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/0.0.0 importlib_metadata/3.10.0 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.62.0 CPython/3.8.8
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | ccfbb85599d0cb72bd07905c8a3ecfce5f777b395ee512338d5c6f32fbe7343b |
|
MD5 | 1b704cb2e88103593a3ed9c223f4d256 |
|
BLAKE2b-256 | f7ffe0457e0f70f28b9db71cfe033eca569a70e193e0e68b28f53eddd9437128 |