Skip to main content

noTeXbook is a Jupyter notebook theme for Latex lovers ❤

Project description

⚠️ Note: ⚠️ You just hit the notebook-magic branch where the notexbook Jupyter extension, and IPython magic are developed and maintained. Jump here for instructions!

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-generated article. 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 a data scientist.

theme in a Nutshell

  • Computer Modern fonts for Markdown typesetting;
    • Computer Modern Typesetting for Markdown Mono
  • Fira Code (open source) font as the default monospace for the Code editor (with ligatures support);
  • Hack (open source) font as the default monospace font for Markdown editor (slightly better for text writing, ed.);
  • Colour Syntax highlight themes for Code and Markdown editors based on Material Design colour scheme.
    • Multiple Editor Themes supported: easy to change and customise (just a few CSS variables to do the trick!)
  • Special Output formatting for stderr and pandas.DataFrame
  • Extra ad-hoc CSS classes for extra formatting use cases (e.g. footnotes, dropcap)

Sneak Peek?

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

Install Theme

notexbook-theme and %texify 🔮

The notexbook-theme package (on PyPi) provides the noTeXbook theme as an easy-to-integrate IPython magic (i.e. %texify), activated via Jupyter notebook (Python) extension, notexbook. So, to use the noTeXbook theme in a notebook it will be just a matter of (1) loading the extension; (2) calling the %texify IPython magic.

The %texify custom IPython magic injects the noTeXbook style directly into notebooks, which results the following three unique feature:

  1. easy-to-use: the theme is enabled only on demand in each selected notebook, without having to change the default style;

  2. portable: the theme is injected directly into the notebook as the output of a single cell. Therefore, when shared, the notebook will continue to keep the noTeXbook style, without having to download nor install anything: just trust the notebook! Similarly, disabling the theme becomes as easy as deleting a cell.

  3. customisable (via magic line arguments). All supported customisations are listed in the next section arrow

To install the notexbook-theme from PyPi:

pip install notexbook-theme

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

%load_ext notexbook

and activate the custom IPython magic:

%texify  # default theme settings will be used

Customising theme settings

Current version of the theme allows to customise the following settings:

  • --code-font (-cdf): the font family used in Code editor (default: Fira Code)
  • --md-font (-mdf): the font family used in Markdown editor (default Hack)
  • --code-fontsize (-cdfs): the font size used in Code and Markdown editor (default 16px)
  • --md-fontsize (-mdfs): the font size of rendered Markdown monospace (default 16px)
  • --fontsize (-nbfs): (LaTeX legacy) font size of rendered Markdown text (default: 19px)
  • --linespread (-lh): (LaTeX legacy) line height of rendered Markdown text (default 1.4)
  • --code-theme (-cdth): colour theme for Code editor (default: Material Design)
    • Other available theme choices: github, crisp
  • --md-theme (-mdth): colour theme for Markdown editor (default Material Design)
    • Other available theme choices: typora

Example:

Let's say you do like noTeXbook theme, and you want to use it in your notebooks. However, you would prefer using the favourite monospace font you are normally using in your code editor (e.g. Monaco). In addition, you also want to slightly reduce the notebook default font-size (18px) as well as the line height (1.3):

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

To see the full list of configuration options :

%texify?

Project Links

shall by thy name

When I had to think of a name for this project, I aimed almost immediately at finding a single word that could convey the idea of integration of theLaTeX-_inspired theme for notebooks I had in mind. And so, , a unique portmanteau(1) that blends together the words noTeXbook (no further explanation needed, ed.), and noTeXbook, the name of Donald E. Knuth's book on TeX.

That was the omen... 🤩.

One!... Two!... Five! [(2)]("Monty Python and the Holy Grail")


[(1)] : port·​man·​teau | \ pȯrt-ˈman-(ˌ)tō
[(2)]: The Holy Hand Grenade - Monty Python and the Holy Grail

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!

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

notexbook-theme-1.1.3rc0.tar.gz (26.4 kB view hashes)

Uploaded Source

Built Distribution

notexbook_theme-1.1.3rc0-py3-none-any.whl (27.8 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page