Skip to content

keggsmurph21/latex2png

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

34 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

latex2png

Build Status Checked with mypy

A tiny command-line utility for generating PNG files from LaTeX snippets. The entrypoint is ./latex2png.

$ echo 'Hello! Would you like a slice of $ \pi $?' | l2p

Usage

Let's assume we have the following file:

$ cat res/example.tex-snippet
The best equation is $ e^{i\pi} = -1 $! It uses $ e^{x+iy} = e^x\left(\cos{y} + i\sin{y}\right) $.

This program uses stdin/stdout by default. For example, to write a LaTeX snippet to res/example.png, you could do

$ cat res/example.tex-snippet | ./latex2png > res/example.png

In order to generate this snippet: example.png

It's also useful to pipe this directly to your clipboard. You can do that with

$ cat res/example.tex-snippet | ./latex2png | xclip -selection c -t image/png -i  # Ubuntu
$ cat res/example.tex-snippet | ./latex2png | pbcopy                              # MacOS

To get the most out of this, we could add the following to our .bashrc (on Linux)

l2p() {
    /path/to/latex2png/latex2png "$@" | xclip -selection c -t image/png -i
}

Then we'll be able to get a snippet into our system clipboard with just

$ cat res/example.tex-snippet | l2p

To use filepaths, you can pass -i $input_file and -o $output_file, as in

$ ./latex2png -i res/example.tex-snippet -o res/example.png

For the full API, check

$ ./latex2png --help

Installation

To install on MacOS or Debian-based systems, run

./scripts/install

If you'd like to add support for another operating system, just open an issue or submit a pull request :^).

Troubleshooting

If you have any problems, feel free to file an issue!

About

convert LaTeX snippets to PNG images

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published