A short shell script to compile LaTeX sources to cropped PNG images.
# one-shot mode:
latex2png foo.tex
# or continuously regenerate the PNG images upon any changes to any .tex file
# in directory foo/
latex2png foo
The LaTeX source files can either be normal source files containing a proper header, or alternatively just contain a single block of commands (which are then rendered in a math environment).
pdflatex
,pdfcrop
, andpdftoppm
. These programs are usually contained in packages with names liketexlive-latex-base
,texlive-extra-utils
, andpoppler-utils
, respectively.- Optionally
inotifywait
from a package likeinotify-tools
.
Don't run latex2png
on untrusted files.
Some filesystems don't generate inotify events. In this case you should manually specify the checking interval when using latex2png in continuous mode:
LATEX2PNG_INTERVAL=60 latex2png foo # check every 60 seconds
To the extent that this shell script exceeds a basic threshold of originality, it is dual-licensed, meaning that you can (and are invited to) use, redistribute and modify it under the terms of either:
- The GNU General Public License (GPL), version 3 or (at your option) any later version published by the Free Software Foundation.
- The LaTeX Project Public License (LPPL), version 1.3c or (at your option) any later version published by the LaTeX3 project.