# Printing short latex snippets

Is there a way to quickly (render and) print short latex snippets like single equations?

Something similar to

echo "Some text" | lpr


like

make-latex-image "$\frac{some}{equation}$" | command-to-print-images

• there is preview-latex, which is part of auctex (in emacs) which lets you view math in an emacs latex buffer. – Faheem Mitha Mar 26 '14 at 16:16
• I can't seem to find the package, and I want a command-line solution rather than invoking emacs. – user80551 Mar 26 '14 at 17:10
• You might want to ask your question here: tex.stackexchange.com – mkc Mar 27 '14 at 3:35
• @Ketan Yes, but the command-to-print-images part concerns U&L.SE more – user80551 Mar 27 '14 at 5:26

There are several projects out there (e.g. mathtex) that facilitate converting a single LaTeX fragment into an image. However in your case it it probably worth scripting something yourself so you get more options as far as the available LaTeX packages and your output format go. You should be able to whip up a LaTeX template with your desired packages pretty easily, then compile it and use dvipng to generate an image. One you have an image, most Linux and BSD distros have apsfilter already, so passing the image to the printer is as easy as calling lpr <image_file>.