Question

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!

Was it helpful?

Solution

Standard LaTeX "loves" EPS, indeed, but there is a reason — it is a vector format. Properly creating your graphics in EPS will ensure that the quality of your printed output is limited only by the quality of your printer, not by the resolution of your image file (as will be the case with rasterized formats like JPEG and PNG).

So, if you include e.g. line drawings, bar charts, etc, you pretty much have to do it in EPS (or PDF), and then convert to PNG for the web. If you graphics is inherently rasterized (e.g. you want to include a photo), you can settle for a high-quality JPEG and then use jpeg2ps to create EPS file for LaTeX (or inlude them directly in pdfLaTeX).

To recap: it's your image, not your program, that determines the proper image format.

P.S. Tools like TeX4ht will usually handle image conversion if needed.

OTHER TIPS

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.

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.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top