Package: jupyter_latex_envs
This extension for Jupyter notebook enables the use of some LaTeX
commands and environments markdown cells.LaTeX commands and environmentssupport for some LaTeX commands within markdown cells,e.g.\textit,\textbf,\underline.support fortheorems-like environments, support for labels and
cross referencessupport forlists:enumerate, itemize,limited support for afigure environment,support for an environmentlisting,additionaltextboxaenvironmentCitations and bibliographysupport for\citewith creation of a References sectionDocument-wide numbering of equations and environments, support for
``label`` and ``ref``Configuration toolbarLaTeX_envs dropdown menu for a quick insertion of environmentsUser’s LaTeX definitionsfile can be loaded and usedExport to plain HTML, Slides and LaTeX with a customized exporterEnvironments title/numbering can be customized by users inuser_envs.jsonconfig file.Styles can be customized in thelatex_env.cssstylesheetAutocompletionfor $, (, {, [, for LaTeX commands and environmentsMore environments can be simply added inuser_envs.jsonor in the
source file (thmsInNb4.js).It is possible to export the notebooks to plain\(\LaTeX\)and html
while keeping all the features of thelatex_envsnotebook extension
in the converted version. We provide specialized exporters, pre and post
processors, templates. We also added entry-points to simplify the
conversion process. It is now as simple asjupyternbconvert--tohtml_with_lenvsFILE.ipynborjupyternbconvert--tolatex_with_lenvsFILE.ipynbto convertFILE.ipynbinto html/latex while keeping all the features
of thelatex_envsnotebook extension in the converted version. Other options areslides_with_lenvsfor converting to reveal-js presentations, andhtml_with_toclenvsto include a
table of contents. The
LaTeX converter also expose several conversion options (read thedocs).Demo/documentationThedocsubdirectory that constains an example notebook and its html
and pdf versions. This serves as the documentation. A demo notebooklatex_env_doc.ipynbis provided. Its html version islatex_env_doc.htmlserves asdocumentation.InstallationThe extension consists of a pypi package that includes a javascript
notebook extension, along with python code for nbconvert support. Since
Jupyter 4.2, pypi is the recommended way to distribute nbextensions. The
extension can be installedfrom the master version on the github repo (this will be always the
most recent version)via pip for the version hosted on Pypivia conda, from theconda-forgechannelas part of the greatjupyter_contrib_nbextensionscollection. Follow the instructions there for installing. Once this
is done, you can open a tab athttp://localhost:8888/nbextensionsto enable and configure the various extensions.From the github repo or from Pypi,install the packagepip3 installhttps://github.com/jfbercher/jupyter_latex_envs/archive/master.zip[--user][--upgrade]orpip3 install jupyter_latex_envs[--user][--upgrade]or clone the repo and install git clonehttps://github.com/jfbercher/jupyter_latex_envs.gitpython3
setup.py installinstall the notebook extensionjupyter nbextension install --py latex_envs [--user|--sys-prefix|--system]and enable itjupyter nbextension enable --py latex_envs [--user|--sys-prefix|--system]For Jupyter versions before 4.2, the situation after step 1 is more
tricky, since the--pyoption isn’t available, so you will have to
find the location of the source files manually as follows (instructions
adapted from [@jcb91](https://github.com/jcb91)’sjupyter_highlight_selected_word).
Executepython -c "import os.path as p; from latex_envs import __file__ as f, _jupyter_nbextension_paths as n; print(p.normpath(p.join(p.dirname(f), n()[0]['src'])))"Then, issuejupyter nbextension install <output source directory>
jupyter nbextension enable latex_envs/latex_envswhere<output source directory>is the output of the first python
command.Disclaimer, sources and acknowledgmentsOriginally, I used a piece of code from the nice online markdown editorstackedit, where
the authors also considered the problem of incorporating LaTeX markup in
their markdown.I also studied and used examples and code fromipython-contrib/jupyter_contrib_nbextensions.This is done in the hope it can be useful. However there are many
impovements possible, in the code and in the documentation.Contributions will be welcome and deeply appreciated.If you have issues, please post an issue athttps://github.com/jfbercher/jupyter_latex_envs/issueshere.Self-Promotion– Likelatex_envs? Please star and follow therepositoryon
GitHub.