views:

122

answers:

3

Hi,

I want to choose an image formate for including images in both html and latex.

I found that jpeg and png formates are not always working well in latex. Is eps format the best for latex. It seems eps is not supported in html?

What other format is good too?

Thanks and regards!

+1  A: 

Intrinsic macros of TeX and LaTeX does not support any images. For such advantages Donald Knuth adds command \special. Indeed to include some image in your document LaTeX package inserts something like that

\special{psfile="myimage1.eps"}

dvi-file TeX created contains this command is unchanged. Now you want to convert dvi-file to ps, for example. You call dvips-programm and this programm insert your image into final ps-file.

Thus eps format is the best not for latex, eps format is the best for dvips because PS is PostScript, EPS is Encapsulated PostScript.

P.S. There is jpeg2ps.exe programm to convert jpeg to eps.

Alexey Malistov
+4  A: 

This depends on what "flavour" of LaTeX you're using.

If you're using "standard" LaTeX, you pretty much have to go with EPS. Since, as you note, EPS images cannot be included in HTML, you'll have to use JPEG or PNG in HTML and convert those images to EPS for inclusion in the LaTeX document (this can be automated using ImageMagick).

Alternatively, and this is the option I would recommend, you can use pdfLaTeX, which can process JPEG and PNG natively, allowing you to use the same images in your HTML and LaTeX documents.

Martin B
When possible it is better to keep the postscript image as the "master" and down-convert to a pixel based format for html. Why? To take full advantage of TeX's vector output on high resolution devices.
dmckee
@dmckee: Very good point -- I was working on the assumption that the images were raster images, but obviously that doesn't have to be the case.
Martin B
+1  A: 
AVB