views:

70

answers:

5

Hello,

I am wondering whether anyone knows a easy way to convert a latex math formula to a big jpeg file?

Here is the latex math formula:

\[
\lim_{u\rightarrow 0_+} \int_0^u \ud s \int_{-\infty}^\infty
\frac{f(u-s,x-y)}{\sqrt{2\pi
s}} \exp\left\{-\frac{y^2}{2s}\right\} \ud y
\]

Thanks!

+2  A: 

This isn’t really programming related at all, but here’s a way to do this:

  • Use the class standalone in your LaTeX source file. This will produce a document that is exactly as large as needed, and no larger.
  • Produce a PDF file using pdflatex
  • Convert to JPEG using convert (from ImageMagick).

Minimal example:

\documentclass{standalone}

\begin{document}
\[
\sum_{i=1}^n i
\]
\end{document}

convert with appropriate resolution:

convert -density 400 file.pdf -scale 2000x1000 file.jpg

Caveat: standalone has some issues determining the size of the document. I don’t actually like the results it produces. You may require loading the geometry package and setting the document dimensions manually. This requires a bit of fiddling but the results are much better.

Konrad Rudolph
Very nice! Maybe we can even create a `bash` script to handle it all!
Delan Azabani
Thank you very much! It is fantastic! :-)
Anand
Actually, I can produce a pdf file without any margin by using empty class and epstool. What makes it work is the option -density in the command convert. I have looked that for some while. Thanks a lot to Konrad.
Anand
Sorry, in previous comment, i mean I am using \documentclass{minimal}.
Anand
+1  A: 

Have a look at this eq2png, a little Perl script that converts .tex to .png.

Bart Kiers
Thanks. It is interesting. I have downloaded it and will try. :-)
Anand
+1  A: 

Or you can make your life much easier and visit the website:

http://www.codecogs.com/latex/eqneditor.php?lang=en-en

which outputs equations in many image formats.

pechisbeque
A: 

You might also use the precious WolframAlpha. try for example

http://www.wolframalpha.com/input/?i=sin+x^2++cos+x^2+%3D+0.3

that gives you

alt text

along with plots, solutions and whatnot

mico
A: 

If you are on OS X you can use LaTeXit, part of the TeX live distribution and, I believe, separately downloadable.

Rupert Nash