noTeXbook is a Jupyter notebook theme for Latex lovers ❤
Project description
The Jupyter notebook theme for lovers
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 defaultmonospace
for the Code editor (with ligatures support);Hack
(open source) font as the defaultmonospace
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
andpandas.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
The theme is available in three different flavours:
-
pip
-installable package to embed the theme into notebooks via custom IPython magic (%texify
) (here ); -
Full-fledged custom Jupyter notebook theme (HTML/CSS): (Link )
-
(Experimental) theme integration for Google Colaboratory Notebooks (via the Stylus browser extension) (Link ).
⚠️ Jupyter Lab is supported, but still in progress ! ⚠️
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:
-
easy-to-use: the theme is enabled only on demand in each selected notebook, without having to change the default style;
-
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. -
customisable (via
magic
line arguments). All supported customisations are listed in the next section
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 (defaultHack
)--code-fontsize
(-cdfs
): the font size used in Code and Markdown editor (default16px
)--md-fontsize
(-mdfs
): the font size of rendered Markdown monospace (default16px
)--fontsize
(-nbfs
): (LaTeX
legacy) font size of rendered Markdown text (default:19px
)--linespread
(-lh
): (LaTeX
legacy) line height of rendered Markdown text (default1.4
)--code-theme
(-cdth
): colour theme for Code editor (default:Material Design
)- Other available theme choices:
github
,crisp
- Other available theme choices:
--md-theme
(-mdth
): colour theme for Markdown editor (defaultMaterial Design
)- Other available theme choices:
typora
- Other available theme choices:
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):
- Computer Modern on the Web
setuptools
: Specify Dependencies- How to Add Custom
setup.py
commands pyproject.toml
- What the heck is
pyproject.toml
- Jupyter Server Extension (Particularly useful in earlier version of this project in which fonts where handled as local resources)
Acknowledgments
Special thanks to cdesio, ninadicara, and alanderex for testing earlier versions of the theme!
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
Hashes for notexbook_theme-1.1.1-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | fcebd2680d31ee3cd460f9331d7829464f0f6e729a0812caea868d5729ad46d8 |
|
MD5 | 350664393e8eb54ad835469d52372ad8 |
|
BLAKE2b-256 | 829df4ff53f20c66c6bedb5383ef613e1887a1989d2a88b0c97b22bd1be803ff |