Skip to main content

JupyTeX

Provides Jupyter-backed execution of LaTeX code environments, and embeds the results. Similar in concept to PythonTex, but focuses on code execution, and avoids any language specific features.

How to use

  1. Install JupyTeX with pip install git+https://github.com/agoose77/jupytex.git#egg=jupytex
  2. Run jupytex install in LaTeX project directory (or provide an install directory with -d DIR) to create the necessary .latexmkrc and jupytex.sty files
  3. Add \usepackage{jupytex} to the document header
  4. Declare code environments with
    \begin{code}{language}[opts]
        Some source code
    \end{code}
    
    See the configuration section for valid options in opts.
  5. Run jupytex make (which is a pass-through to latexmk --shell-escape) to invoke latexmk.

Example Python Script

\begin{code}{python}[kernel=python3]
    print("$x + y = z$")
\end{code}

Uninstallation

Run jupytex uninstall in LaTeX project directory (or provide an install directory with -d DIR) to remove the installed .latexmkrc and jupytex.sty files

Cleaning

Run jupytex clean (which is a pass-through to latexmk -c or latexmk -C) to remove both LaTeX and JupyTex-related run files.

JupyTeX flow control

  1. jupytex.sty declares dependency upon \jobname.timestamp
  2. jupytex.sty macro writes code blocks to numbered .code files and attempts to include results
  3. Code 'blocks' are written to a \jobname.blocks csv file
  4. jupytex hash is invoked to calculate the md5 hash for all of the blocks, which is written to \jobname.hash. In future this should only be performed per-kernel-session.
  5. If \jobname.hash has been modified, jupytex execute is invoked for the corresponding job, the code blocks executed, and results written to .result files, and errors to .traceback files. Code blocks which do not write to stdout write an empty results file. \jobname.timestamp is updated with new timestamp.
  6. latexmk performs a new pass for the dependencies upon \jobname.timestamp

Configuration

  • Each code block must be given a language.
  • One can specify the Jupyter kernel name with a kernel key parameter, which will be used instead of the language if present. One can also access an existing kernel, by passing the name of a connection file.
  • A session key parameter may be passed to create a new kernel associated with the kernel-session pair. If the kernel parameter is set to a connection file, then this will create a new client to the same kernel.

Release files for jupytex 0.0.3

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for jupytex 0.0.3
File Size Uploaded
jupytex-0.0.3.tar.gz 8.2 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for jupytex 0.0.3
File Interpreter ABI Platform
jupytex-0.0.3-py3-none-any.whl Python 3 none any Details

Total release size: 18.7 kB

Release files / jupytex-0.0.3.tar.gz

Download URL jupytex-0.0.3.tar.gz
Size 8.2 kB
Tags Source
SHA-256 checksum
How to use checksums
9b1e64032fa1948220055126afdf114cd9fd048c7bf63be1f986defb36206af8
BLAKE2b-256 checksum
How to use checksums
6edf52c207c36e4212807f8625d97ea4e9b4d7e0da36e5821355666aa4fba6b0
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.12.1 pkginfo/1.5.0.1 requests/2.21.0 setuptools/39.0.1 requests-toolbelt/0.9.1 tqdm/4.30.0 CPython/3.7.1

Release files / jupytex-0.0.3-py3-none-any.whl

Download URL jupytex-0.0.3-py3-none-any.whl
Size 10.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
b95b333760c0bc984bb645dc161553af6f17cf4e3cd7df11e5ce82ae19913085
BLAKE2b-256 checksum
How to use checksums
f53f07efef0b0ddb78f831975ad1968447b66d989e9b9bfa3d222776a53efc46
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.12.1 pkginfo/1.5.0.1 requests/2.21.0 setuptools/39.0.1 requests-toolbelt/0.9.1 tqdm/4.30.0 CPython/3.7.1

Release history Release notifications | RSS feed

This release

0.0.3 This release

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page