• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

jfbercher/jupyter_latex_envs: (Some) LaTeX environments for Jupyter

原作者: [db:作者] 来自: 网络 收藏 邀请

开源软件名称(OpenSource Name):

jfbercher/jupyter_latex_envs

开源软件地址(OpenSource Url):

https://github.com/jfbercher/jupyter_latex_envs

开源编程语言(OpenSource Language):

HTML 54.9%

开源软件介绍(OpenSource Introduction):

Maintainer(s) wanted... Unfortunately, I, @jfbercher, don't have the time to continue the development of this extension, which I still use very often. Are there any volunteers to maintain it or continue the development? A big project would be to port it to jupyter-lab.


(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 $\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

jupyter nbconvert --to html_with_lenvs FILE.ipynb

or

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).

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 serves as documentation.

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 channel
  • as part of the great 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). 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, 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.

  • 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.

Self-Promotion -- Like latex_envs? Please star and follow the repository on GitHub.




鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap