Skip to main content

The Jupyter notebook theme for LaTeX lovers heart

The theme aims at combining the flexibility and interactivity of Jupyter notebooks with the unique elegance and sobriety of a LaTeX article.

noTeXbook in a Nutshell

  • Computer Modern fonts for Markdown typesetting;
  • Fira Code (open source) font for Code editor (with ligatures support);
  • Hack (open source) font for Markdown editor (slightly better for text writing, ed.);
  • Multiple Colour Syntax highlighting themes;
  • Extra CSS classes for additional LaTeX-ish formatting use cases (e.g. footnotes, dropcap);
  • Full support for Jupyter Notebooks and JupyterLab (version 2.0x).

Sneak Peek?

Here is a Preview of how [a] noTeXbook looks like!

Setup noTeXbook Theme

The noTeXbook theme is available on PyPi as a Jupyter Notebook (Python) extension:

$ pip install notexbook-theme

Once installed, just load the notexbook extension into a Jupyter notebook cell:

%load_ext notexbook

The theme can be activated via the %texify IPython magic 🔮:

%texify  # default theme settings will be used

%texify IPython magic

The %texify IPython magic embeds the noTeXbook theme directly into the current notebook. This results into the following three unique features:

  1. on-demand activation: the theme is enabled only for selected notebooks, without having to change the (global) default Jupyter notebook theme.

  2. portable: the theme is embedded directly into the notebook (as the output of a single cell). Therefore, whenever the notebook will be shared and/or exported (e.g. in HTML or PDF via webpdf), the theme will continue to be available, with no extra installation required. Similarly, disabling the theme becomes as easy as clearing the output of the %texify cell.

  3. customisable: the theme allows for an easy customisation (e.g. enabling multiple editor themes) via IPython magic line arguments.

Magic Line Arguments and Theme settings 🪄

The %texify IPython magic 🔮 supports the following arguments:

-cdth <{material,github,github2,crisp}>, --code-theme <{material,github,github2,crisp}>
	Colour Theme for Code Editor

-mdth <{material,typora}>, --md-theme <{material,typora}>
	Colour Theme for Markdown Editor

-cdfs CODE_MONO_FONT_SIZE, --code-fontsize CODE_MONO_FONT_SIZE
	Font size used in Code and Markdown Editor. Default: 16px

-mdfs MD_MONO_FONT_SIZE, --md-fontsize MD_MONO_FONT_SIZE
	Font size of Rendered Markdown monospace. Default: 17px

-nbfs NB_FONT_SIZE, --notebook-font-size NB_FONT_SIZE
	Font size of Rendered Content in Notebook. Default: 17px

-lh NB_LINE_HEIGHT, --linespread NB_LINE_HEIGHT
	Line height of Notebook Content. Default: 1.4

-v, --verbose         
	Verbose mode: Display the list of enabled Theme settings.

Examples:

%texify --code-font Monaco --linespread 1.3 -fs 18

In these settings: (1) the Monaco font will be used for code editor; (2) notebook font size will be set to 18px, and the line height will be 1.3. Note: To actually use the Monaco font for code editor, the font must be available and installed on your local machine. If that is not be the case, the default code mono font (i.e. Fira Code) will be used as a fallback.

%texify --code-theme github

In these settings, the new github Code Editor theme will be used for code syntax highlighting, substituting the default Material Design theme. This theme is inspired by the current code theme on GitHub.

To see the full list of configuration options :

%texify?

There's more...

The noTeXbook theme is also available as a full-fledged custom Jupyter notebook theme (HTML/CSS). This is useful in case you would prefer to enable the theme as the global custom default Jupyter theme.

The noTeXbook theme package is available for download, along with its corresponding documentation. The documentation also contains details on the original CSS design, and instructions on how to define your own CSS Editor Colour theme.

Last but not least, Experimental theme integration for Google Colaboratory Notebooks (via the Stylus browser extension) is also available. See here for more information.

noTeXbook shall by thy name

When I had to think to a name for this project, I aimed almost immediately at finding a single word that would convey the idea of integration between LaTeX and notebooks I had in mind. So seemed quite an obvious choice. Moreover, this name itself is also a unique portmanteau (port·man·teau | \ pȯrt-ˈman-(ˌ)tō) that blends together the words noTeXbook, and noTeXbook, that is the name of Donald E. Knuth's book on TeX.

That was the omen... 🤩.

One!... Two!... Five!

(from: The Holy Hand Grenade - Monty Python and the Holy Grail)

The project wishes to pay a tribute of gratitude (in the name, and in the content) to two of the technologies I do use (and love) the most as a researcher and as a data scientist.

Credits

  • The spinzero jupyter theme has been inspirational in the design of the early version of this theme;
  • The idea of overlay of selected cells has been inspired from this custom theme.
  • Inspiration on the choice of Monospace fonts for code and markdown has come from this article
  • Original versions of colour themes for code and markdown editors:

References

(Some links I found useful along the way):

Acknowledgments

Special thanks to cdesio, ninadicara, and alanderex for testing earlier versions of the theme!

Metadata

Release files for notexbook-theme 2.0.1

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

Source distribution (sdist)

Source distribution for notexbook-theme 2.0.1
File Size Uploaded Provenance
notexbook-theme-2.0.1.tar.gz 33.3 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for notexbook-theme 2.0.1
File Interpreter ABI Platform
notexbook_theme-2.0.1-py3-none-any.whl Python 3 none any Details

Total release size: 81.4 kB

Release files / notexbook-theme-2.0.1.tar.gz

Download URL notexbook-theme-2.0.1.tar.gz
Size 33.3 kB
Tags Source
SHA-256 checksum
How to use checksums
0a1d01507201959a55291af94d0827790af019d0268c0c9bc539f9125812eb38
BLAKE2b-256 checksum
How to use checksums
f391dde8fd3eef9f59f542fa2e54e9344d52a6303e90802fe207c13cfba61f14
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.4.1 importlib_metadata/3.7.3 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.59.0 CPython/3.9.2

Release files / notexbook_theme-2.0.1-py3-none-any.whl

Download URL notexbook_theme-2.0.1-py3-none-any.whl
Size 48.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
2cc9d5f991bc0f9ab257196b010eba5a5a3d4b36156f735e1e02bb1cd678c050
BLAKE2b-256 checksum
How to use checksums
980930148266bfe49129e8fa854618f9701ed2ad0ee18a0c6e3d7cbde2d2607f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.4.1 importlib_metadata/3.7.3 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.59.0 CPython/3.9.2

Security for notexbook-theme 2.0.1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

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