English 中文(简体)
image format in html and latex
原标题:

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!

最佳回答

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.

问题回答

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.





相关问题
CSS working only in Firefox

I am trying to create a search text-field like on the Apple website. The HTML looks like this: <div class="frm-search"> <div> <input class="btn" type="image" src="http://www....

image changed but appears the same in browser

I m writing a php script to crop an image. The script overwrites the old image with the new one, but when I reload the page (which is supposed to pickup the new image) I still see the old one. ...

Firefox background image horizontal centering oddity

I am building some basic HTML code for a CMS. One of the page-related options in the CMS is "background image" and "stretch page width / height to background image width / height." so that with large ...

Separator line in ASP.NET

I d like to add a simple separator line in an aspx web form. Does anyone know how? It sounds easy enough, but still I can t manage to find how to do it.. 10x!

热门标签