(some) LaTeX environments for Jupyter notebook
==============================================
This extension for Jupyter notebook enables the use of some LaTeX
commands and environments markdown cells.
1. **LaTeX commands and environments**
- support for some LaTeX commands within markdown cells, *e.g.*
``\textit``, ``\textbf``, ``\underline``.
- support for **theorems-like environments**, support for labels and
cross references
- support for **lists**: *enumerate, itemize*,
- limited support for a **figure environment**,
- support for an environment *listing*,
- additional *textboxa* environment
2. **Citations and bibliography**
- support for ``\cite`` with creation of a References section
3. **Document-wide numbering of equations and environments, support for
``\label`` and ``\ref``**
4. **Configuration toolbar**
5. **LaTeX\_envs dropdown menu for a quick insertion of environments**
6. **User's LaTeX definitions** file can be loaded and used
7. **Export to plain HTML, Slides and LaTeX with a customized exporter**
8. Environments title/numbering can be customized by users in
``user_envs.json`` config file.
9. Styles can be customized in the ``latex_env.css`` stylesheet
10. **Autocompletion** for \$, (, {, [, for LaTeX commands and environments
More environments can be simply added in ``user_envs.json`` or in the
source file (``thmsInNb4.js``).
It is possible to export the notebooks to plain :math:`\LaTeX` and html
while keeping all the features of the ``latex_envs`` notebook 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 as
.. code:: bash
jupyter nbconvert --to html_with_lenvs FILE.ipynb
or
.. code:: bash
jupyter nbconvert --to latex_with_lenvs FILE.ipynb
to convert ``FILE.ipynb`` into html/latex while keeping all the features
of the ``latex_envs`` notebook extension in the converted version. Other options are
``slides_with_lenvs`` for converting to reveal-js presentations, and ``html_with_toclenvs`` to include a
table of contents. The
LaTeX converter also expose several conversion options (read the
`docs <https://rawgit.com/jfbercher/jupyter_latex_envs/master/src/latex_envs/static/doc/latex_env_doc.html>`__).
Demo/documentation
------------------
The ``doc`` subdirectory that constains an example notebook and its html
and pdf versions. This serves as the documentation. A demo notebook
``latex_env_doc.ipynb`` is provided. Its html version is
`latex\_env\_doc.html <https://rawgit.com/jfbercher/jupyter_latex_envs/master/src/latex_envs/static/doc/latex_env_doc.html>`__
serves as
`documentation <https://rawgit.com/jfbercher/jupyter_latex_envs/master/src/latex_envs/static/doc/latex_env_doc.html>`__.
Installation
------------
The 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 installed
- from the master version on the github repo (this will be always the
most recent version)
- via pip for the version hosted on Pypi
- via conda, from the `conda-forge <https://conda-forge.github.io/>`__
`channel <https://anaconda.org/conda-forge>`__
- as part of the great
`jupyter\_contrib\_nbextensions <https://github.com/ipython-contrib/jupyter_contrib_nbextensions>`__
collection. Follow the instructions there for installing. Once this
is done, you can open a tab at ``http://localhost:8888/nbextensions``
to enable and configure the various extensions.
From the github repo or from Pypi,
1. install the package
- ``pip3 install https://github.com/jfbercher/jupyter_latex_envs/archive/master.zip [--user][--upgrade]``
- or ``pip3 install jupyter_latex_envs [--user][--upgrade]``
- or clone the repo and install git clone
https://github.com/jfbercher/jupyter\_latex\_envs.git python3
setup.py install
2. install the notebook extension
::
jupyter nbextension install --py latex_envs [--user|--sys-prefix|--system]
3. and enable it
::
jupyter 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 ``--py`` option 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)'s
`jupyter\_highlight\_selected\_word <https://github.com/jcb91/jupyter_highlight_selected_word>`__).
Execute
::
python -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, issue
::
jupyter nbextension install <output source directory>
jupyter nbextension enable latex_envs/latex_envs
where ``<output source directory>`` is the output of the first python
command.
Disclaimer, sources and acknowledgments
---------------------------------------
Originally, I used a piece of code from the nice online markdown editor
`stackedit <https://github.com/benweet/stackedit/issues/187>`__, where
the authors also considered the problem of incorporating LaTeX markup in
their markdown.
I also studied and used examples and code from
`ipython-contrib/jupyter\_contrib\_nbextensions <https://github.com/ipython-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 at
``https://github.com/jfbercher/jupyter_latex_envs/issues``
`here <https://github.com/jfbercher/jupyter_latex_envs/issues>`__.
**Self-Promotion** -- Like ``latex_envs``? Please star and follow the
`repository <https://github.com/jfbercher/jupyter_latex_envs>`__ on
GitHub.
Raw data
{
"_id": null,
"home_page": "https://github.com/jfbercher/jupyter_latex_envs",
"name": "jupyter_latex_envs",
"maintainer": "",
"docs_url": null,
"requires_python": "",
"maintainer_email": "",
"keywords": "",
"author": "Jean-Fran\u00e7ois Bercher",
"author_email": "jf.bercher@gmail.com",
"download_url": "https://files.pythonhosted.org/packages/0e/15/55805de080d5542f76920364635e96e64d3b37f678befdfe3b16aa154205/jupyter_latex_envs-1.4.6.tar.gz",
"platform": "",
"description": "(some) LaTeX environments for Jupyter notebook\n==============================================\n\nThis extension for Jupyter notebook enables the use of some LaTeX\ncommands and environments markdown cells.\n\n1. **LaTeX commands and environments**\n\n - support for some LaTeX commands within markdown cells, *e.g.*\n ``\\textit``, ``\\textbf``, ``\\underline``.\n - support for **theorems-like environments**, support for labels and\n cross references\n - support for **lists**: *enumerate, itemize*,\n - limited support for a **figure environment**,\n - support for an environment *listing*,\n - additional *textboxa* environment\n\n2. **Citations and bibliography**\n\n - support for ``\\cite`` with creation of a References section\n\n3. **Document-wide numbering of equations and environments, support for\n ``\\label`` and ``\\ref``**\n4. **Configuration toolbar**\n5. **LaTeX\\_envs dropdown menu for a quick insertion of environments**\n6. **User's LaTeX definitions** file can be loaded and used\n7. **Export to plain HTML, Slides and LaTeX with a customized exporter**\n8. Environments title/numbering can be customized by users in\n ``user_envs.json`` config file.\n9. Styles can be customized in the ``latex_env.css`` stylesheet\n10. **Autocompletion** for \\$, (, {, [, for LaTeX commands and environments\n\nMore environments can be simply added in ``user_envs.json`` or in the\nsource file (``thmsInNb4.js``).\n\nIt is possible to export the notebooks to plain :math:`\\LaTeX` and html\nwhile keeping all the features of the ``latex_envs`` notebook extension\nin the converted version. We provide specialized exporters, pre and post\nprocessors, templates. We also added entry-points to simplify the\nconversion process. It is now as simple as\n\n.. code:: bash\n\n jupyter nbconvert --to html_with_lenvs FILE.ipynb\n\nor\n\n.. code:: bash\n\n jupyter nbconvert --to latex_with_lenvs FILE.ipynb\n\nto convert ``FILE.ipynb`` into html/latex while keeping all the features\nof the ``latex_envs`` notebook extension in the converted version. Other options are \n``slides_with_lenvs`` for converting to reveal-js presentations, and ``html_with_toclenvs`` to include a \ntable of contents. The \nLaTeX converter also expose several conversion options (read the\n`docs <https://rawgit.com/jfbercher/jupyter_latex_envs/master/src/latex_envs/static/doc/latex_env_doc.html>`__).\n\nDemo/documentation\n------------------\n\nThe ``doc`` subdirectory that constains an example notebook and its html\nand pdf versions. This serves as the documentation. A demo notebook\n``latex_env_doc.ipynb`` is provided. Its html version is\n`latex\\_env\\_doc.html <https://rawgit.com/jfbercher/jupyter_latex_envs/master/src/latex_envs/static/doc/latex_env_doc.html>`__\nserves as \n`documentation <https://rawgit.com/jfbercher/jupyter_latex_envs/master/src/latex_envs/static/doc/latex_env_doc.html>`__.\n\nInstallation\n------------\n\nThe extension consists of a pypi package that includes a javascript\nnotebook extension, along with python code for nbconvert support. Since\nJupyter 4.2, pypi is the recommended way to distribute nbextensions. The\nextension can be installed\n\n- from the master version on the github repo (this will be always the\n most recent version)\n- via pip for the version hosted on Pypi\n- via conda, from the `conda-forge <https://conda-forge.github.io/>`__\n `channel <https://anaconda.org/conda-forge>`__\n- as part of the great\n `jupyter\\_contrib\\_nbextensions <https://github.com/ipython-contrib/jupyter_contrib_nbextensions>`__\n collection. Follow the instructions there for installing. Once this\n is done, you can open a tab at ``http://localhost:8888/nbextensions``\n to enable and configure the various extensions.\n\nFrom the github repo or from Pypi,\n\n1. install the package\n\n - ``pip3 install https://github.com/jfbercher/jupyter_latex_envs/archive/master.zip [--user][--upgrade]``\n - or ``pip3 install jupyter_latex_envs [--user][--upgrade]``\n - or clone the repo and install git clone\n https://github.com/jfbercher/jupyter\\_latex\\_envs.git python3\n setup.py install\n\n2. install the notebook extension\n\n ::\n\n jupyter nbextension install --py latex_envs [--user|--sys-prefix|--system]\n\n3. and enable it\n\n ::\n\n jupyter nbextension enable --py latex_envs [--user|--sys-prefix|--system]\n\nFor Jupyter versions before 4.2, the situation after step 1 is more\ntricky, since the ``--py`` option isn't available, so you will have to\nfind the location of the source files manually as follows (instructions\nadapted from [@jcb91](https://github.com/jcb91)'s\n`jupyter\\_highlight\\_selected\\_word <https://github.com/jcb91/jupyter_highlight_selected_word>`__).\nExecute\n\n::\n\n python -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'])))\"\n\nThen, issue\n\n::\n\n jupyter nbextension install <output source directory>\n jupyter nbextension enable latex_envs/latex_envs\n\nwhere ``<output source directory>`` is the output of the first python\ncommand.\n\nDisclaimer, sources and acknowledgments\n---------------------------------------\n\nOriginally, I used a piece of code from the nice online markdown editor\n`stackedit <https://github.com/benweet/stackedit/issues/187>`__, where\nthe authors also considered the problem of incorporating LaTeX markup in\ntheir markdown.\n\nI also studied and used examples and code from\n`ipython-contrib/jupyter\\_contrib\\_nbextensions <https://github.com/ipython-contrib/jupyter_contrib_nbextensions>`__.\n\n\n- This is done in the hope it can be useful. However there are many\n impovements possible, in the code and in the documentation.\n **Contributions will be welcome and deeply appreciated.**\n- If you have issues, please post an issue at\n ``https://github.com/jfbercher/jupyter_latex_envs/issues``\n `here <https://github.com/jfbercher/jupyter_latex_envs/issues>`__.\n\n**Self-Promotion** -- Like ``latex_envs``? Please star and follow the\n`repository <https://github.com/jfbercher/jupyter_latex_envs>`__ on\nGitHub.\n",
"bugtrack_url": null,
"license": "Modified BSD",
"summary": "Jupyter notebook extension which supports (some) LaTeX environments within markdown cells. Also provides support for labels and crossreferences, document wide numbering, bibliography, and more...",
"version": "1.4.6",
"project_urls": {
"Homepage": "https://github.com/jfbercher/jupyter_latex_envs"
},
"split_keywords": [],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "0e1555805de080d5542f76920364635e96e64d3b37f678befdfe3b16aa154205",
"md5": "62c1471a0d771a90401b7df6b18a2ee5",
"sha256": "070a31eb2dc488bba983915879a7c2939247bf5c3b669b398bdb36a9b5343872"
},
"downloads": -1,
"filename": "jupyter_latex_envs-1.4.6.tar.gz",
"has_sig": false,
"md5_digest": "62c1471a0d771a90401b7df6b18a2ee5",
"packagetype": "sdist",
"python_version": "source",
"requires_python": null,
"size": 861657,
"upload_time": "2018-12-02T22:31:10",
"upload_time_iso_8601": "2018-12-02T22:31:10.096048Z",
"url": "https://files.pythonhosted.org/packages/0e/15/55805de080d5542f76920364635e96e64d3b37f678befdfe3b16aa154205/jupyter_latex_envs-1.4.6.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2018-12-02 22:31:10",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "jfbercher",
"github_project": "jupyter_latex_envs",
"travis_ci": false,
"coveralls": false,
"github_actions": false,
"lcname": "jupyter_latex_envs"
}