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

ammsa/django-latexify: Easy LaTeX rendering for Django.

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

开源软件名称(OpenSource Name):

ammsa/django-latexify

开源软件地址(OpenSource Url):

https://github.com/ammsa/django-latexify

开源编程语言(OpenSource Language):

Python 82.6%

开源软件介绍(OpenSource Introduction):

django-latexify

Latest PyPI version Build Status - master branch coveralls quality Python 2 support Python 3 support maintain website Software license

django-latexify let’s you easily render text and math equations from your template to look like LaTeX. The app lets you render math equations written in LaTeX on your HTML, or even just regular plain text.

It uses Katex (a fast, easy-to-use JavaScript library for TeX math rendering on the web) for rending math equations and a modification of WiTex (LaTeX like CSS) for rending plain text.

installation

pip install django-latexify

Quick start

  1. Add "latexify" to your INSTALLED_APPS setting like this:

    INSTALLED_APPS = (
        ...
        'latexify',
        ...
    )
  2. In your template, load latexify by including:

    {% load latexify %}
    
  3. In the HTML header of your template, include:

    {% include 'latexify/stylesheets.html' %}
    
  4. In the bottom of your HTML body, include the following to load the JS associated with latexify:

    {% include "latexify/scripts.html" %}
    
  5. Latexify your text by including the template tag, for example

    {% latexify context_arg %}
    {% latexify context_arg parse_math=True %}
    {% latexify 'c = \pm\sqrt{a^2 + b^2}' math_inline=True %}
    {% latexify 'c = \pm\sqrt{a^2 + b^2}' math_block=True %}

Which will give you the following:

example

  1. To add line breaks, add \newline to your math equation. For example:

    {% latexify 'x = a + b \newline a = 1 \newline b = 2' math_block=True %}
  2. In your HTML, be sure to include this before the <html> tag.

    <!DOCTYPE html>

Contributing

  1. Fork it!
  2. Create your feature branch: git checkout -b my-new-feature
  3. Commit your changes: git commit -am 'Add some feature'
  4. Push to the branch: git push origin my-new-feature
  5. Submit a pull request :D

License

All parts of django-latexify are free to use and abuse under the open-source MIT license.

Change Log

Version 0.3:

  • Support line breaks (Add \newline inside your math equations)
  • Drop support for older Django versions
  • Support Django 2.0+

Version 0.2:

  • Support python3.



鲜花

握手

雷人

路过

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

请发表评论

全部评论

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

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

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

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

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