PHPackages                             gregwar/tex2png - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Image &amp; Media](/categories/media)
4. /
5. gregwar/tex2png

ActiveLibrary[Image &amp; Media](/categories/media)

gregwar/tex2png
===============

LaTeX formula to PNG

v1.0.0(10y ago)7443.5k↓36.8%19[1 PRs](https://github.com/Gregwar/Tex2png/pulls)MITPHPPHP &gt;=5.3.0

Since Sep 20Pushed 7y ago6 watchersCompare

[ Source](https://github.com/Gregwar/Tex2png)[ Packagist](https://packagist.org/packages/gregwar/tex2png)[ Docs](https://github.com/Gregwar/Tex2png)[ RSS](/packages/gregwar-tex2png/feed)WikiDiscussions master Synced 1mo ago

READMEChangelogDependencies (1)Versions (2)Used By (0)

Tex2png
=======

[](#tex2png)

This class provides a way to create easily LaTeX formulas.

With it, you can convert raw formulas like:

`\sum_{i = 0}^{i = n} \frac{i}{2}`

To nice images like:

[![Sum formula](demo/sum.png)](demo/sum.png)

Requirement
-----------

[](#requirement)

To use this library you'll need :

- **latex** : to compile formulas (with math support)
- **dvipng** : to convert dvis to png
- **shell\_exec** : you need to be able to call the php `shell_exec()` function

You'll also need a temporary folder and, of courses, enough permissions to write to the target directory

Usage
-----

[](#usage)

Just include the `Tex2png.php` file or register this repository directory as the `Gregwar\Tex2png\` namespace and do the following :

```
