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
article.
noTeXbook
in a Nutshell
- Computer Modern fonts for Markdown typesetting;
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.);- Several Colour Syntax highlighting themes for Code and Markdown editors;
- 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 what [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 injects the noTeXbook
CSS theme directly into the current notebook, which results into the following three unique features:
-
easy-to-use: the theme is enabled on demand only on selected notebooks, without having to change the default Jupyter main theme.
-
portable: the theme is injected directly into the notebook as output of a single cell. Therefore, when shared or exported (e.g. in HTML or PDF via
webpdf
), the notebook will continue to keep thenoTeXbook
style. Similarly, disabling the theme becomes as easy as clearing the ouput of a single cell. -
customisable: the theme allows for extra customisation (e.g. font size or editor themes) provided as
magic
line arguments.
Theme settings
The theme supports the following customisation settings, injected via magic
line argument:
-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
--code-font
(-cdf
): Font family used in Code Editor. (Default:Fira Code
)--md-font
(-mdf
): Font family used in Markdown Editor. (Default:Hack
)--editor-fontsize
(-edfs
): Font size used in Code and Markdown Editors. (Default:16px
)--mono-fontsize
(-mofs
): Font size of rendered (Markdown) monospace. (Default:17px
)--fontsize
(-fs
): Font size of Rendered (Markdown) notebook cell content. (Default:17px
)--linespread
(-lh
): Line height. (Default:1.4
)--code-theme
(-cdth
): Colour Theme for Code Editor (default: Material Design)- Options:
material
,github
,github2
,crisp
- Options:
--md-theme
(-mdth
): Colour Theme for Markdown Editor (default Material Design)- Options:
material
,typora
- Options:
Examples:
%texify --code-font Monaco --linespread 1.3 -fs 18
In these settings: (1) the Monaco
font (if available locally) will be used for code editor; (2) notebook font size will be 18px
and the line height will be 1.3
.
%texify --code-theme github2
In these settings, the brand new github2
Code Editor theme will be used instead of the default Material Design. The github2
theme is inspired by the current code theme on GitHub.
To see the full list of configuration options :
%texify?
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, 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)
In fact, 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.
Project Links
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-2.0.0rc0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | d75d5a16d06a4cf4d814f92c3db8e6f3920b0f3dbec84260eee085cfc71f8475 |
|
MD5 | 4e68e51de91656097e4387e48a38d4fe |
|
BLAKE2b-256 | 9ffa536e5c3189017c91698781add0cd67584fe289c59c08e391454cf36663cc |