pnglatex
is a small script that turns
formulas into png images.
$ pnglatex -f "E=mc^2"
Download or clone the repository, then make pnglatex
an executable and add it to your path, e.g.
# chmod +x pnglatex
# cp pnglatex /usr/bin/pnglatex
pnglatex
depends on dvipng
, imagemagick
, latex
, and optipng
packages. Optional dependencies include xclip
to copy image to clipboard, and notify-send
to show a preview of the image through a notification.
You can pipe into pnglatex
:
$ cat formula.tex | pnglatex
You can generate and open your image with a one-liner:
$ pnglatex -f "E=mc^2" | xargs eog
Omitting -f
option will start interactive mode.
$ pnglatex
E=mc^2
<Ctrl-D>
Logs can give you a good idea of what went wrong.
$ pnglatex -f "E=mc^2" -l out.log
-b <color>
Set the background color-B <color>
Set the border color-d <dpi>
Set the output resolution to the specified dpi-e <environment>
Set the environment for the formula (i.e.displaymath
oreqnarray
)-f <formula>
The formula-F <color>
Set the foreground color-h
Print the help message-H <file>
Insert the content of the specified file in the preamble-l <file>
Log file-m <margin>
Set the margin-o <file>
Specify the output file name-O
Optimize the image-p <packages>
A colon separated list of package names-P <padding>
Set the padding-s <size>
Set the font size-S
Don't print image file name-v
Show version
You can set default options by creating a properties file named .pnglatex
in your home directory. The
following is an example content:
BACKGROUND=White
BORDER=
DPI=180
ENVIRONMENT=displaymath
FOREGROUND=Black
HEADER=
MARGIN=
OPTIMIZE=1
PACKAGES=amsmath:amssymb
PADDING=3
SIZE=11
Command line provided options override the default options in the ~/.pnglatex
file.
cliptex
is a small script that creates
formulas using the system clipboard.
$ cliptex
The above command uses the content of the system clipboard to generate a formula. The clipboard is then replaced by the generated image.
Bind the script to the Ctrl + Alt + C key combination. Write your formula directly in the GMail editor, select it and strike the key combination. Then, press Ctrl + V to replace the formula with the generated image.
cliptex
uses the default options set in the ~/.pnglatex
file.
Download or clone the repository, then type
# chmod +x cliptex
# cp cliptex /usr/bin/cliptex
cliptex
depends on pnglatex
, wl-clipboard
and xclip
.
-h
Print this help message.-s <session>
Force a session (wayland or x11).-S
Don't show system notifications.-v
Show version.