I am working on an online web-app that incorporates LaTeX document generation.
Currently, as a beginner to LaTeX (but the most experienced developer in my team), I am trying to determine the most efficient way to generate LaTeX docs into a viewable format. Memory is a concern to us, so here are our methods to begin with.
> latex sample.tex
Outputs a dvi
which I can then convert to a png
or a pdf
> pdflatex sample.tex
Outputs a pdf
directly
Those are the main two methods I have used so far, other methods have either failed or been found to be too complex.
If anything, a .tex
file directly to a jpeg
would seem the most efficient, but I would prefer for some expert opinions;]
Best Answer
You can obtain
jpg
orpng
files from latex source with the help of imagemagic. Consider this code:Save the above code as
myfile.tex
. Compile it withpdflatex
withshell escape
option. You should get amyfile.png
file. For details consultstandalone
class documentation.The above can also be achieved by following code that doesn't use
standalone
. Heredemo.tex
is your actual file whose contents are needed as image. This makes use ofshell escape
capabilities. :You will get two files in the same directory -
demo-00.jpg
anddemo-01.jpg
with each page resulting in ajpg
file.