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

joeraut/latex2image-web: LaTeX to image converter with web UI using Node.js / Do ...

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

开源软件名称(OpenSource Name):

joeraut/latex2image-web

开源软件地址(OpenSource Url):

https://github.com/joeraut/latex2image-web

开源编程语言(OpenSource Language):

JavaScript 60.8%

开源软件介绍(OpenSource Introduction):

LaTeX2Image

Image

A Node.js web application that allows LaTeX math equations to be entered and converted to PNG/JPG/SVG images.

For each conversion, an isolated Docker container with a LaTeX installation is started; it compiles the generated .tex file and converts it to an SVG vector image. If required, the SVG file is then converted to a raster image format for PNG/JPG using sharp.

Bootstrap and jQuery are used in the web interface, with AJAX calls made to the conversion API endpoint.

Live Demo

The application is accessible at https://latex2image.joeraut.com

Requirements

Operating system

I made use of Ubuntu 18.04. Other Linux distributions should work without problems.

Docker

Docker CE with non-root user support.

latex-docker

Docker image containing the required LaTeX packages preinstalled.

Pull the image:

docker pull blang/latex:ubuntu

Node.js

I made use of v10.14.2, anything newer should be fine.

After cloning or downloading this project, run the following to install local dependencies from npm:

cd latex2image-web/
npm install

Usage

To run:

node app.js

The web interface will be accessible at http://localhost:3001 by default. The port and HTTP URL can be modified inside app.js.

Enter a LaTeX equation, for example \frac{a}{b}, and press Convert. The result will be displayed below the button.

Security

LaTeX is powerful, with the reading and writing of external files and execution of terminal commands possible. It was decided that a new isolated Docker container be launched for every conversion.

The container is only able to access the local temp/<id>/ directory and has no network access.

Additionally, the compilation process will be killed after 5 seconds if not complete; this is to safeguard against infinite loops and other troublesome LaTeX quirks.

Internals

Commands used:

  • latex - Converts .tex source file to .dvi intermediate
  • dvisvgm - Converts .dvi file to .svg vector image

We use sharp to convert the SVG file to PNG and JPG images where required.

Notes

  • The directories temp/ and output/ will be generated automatically inside the latex2image-web/ directory upon first launch.
  • temp/ stores temporary .tex, .dvi, and .svg files during compilation in an inner temp/<id>/ directory, which is deleted upon completion of the conversion.
  • Final output images are stored in output/, and are never deleted.

Authors

Issues

For any issues or bugs, please submit an issue or pull request.

License

This project is licensed under the MIT License - see the LICENSE file for details.




鲜花

握手

雷人

路过

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

请发表评论

全部评论

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

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

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

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

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