html 和 Latex 中的图像格式
我想选择一个图像格式来包含 html 和 Latex 中的图像。
我发现 jpeg 和 png 格式在 Latex 中并不总是能很好地工作。 eps 格式是乳胶的最佳格式吗? html 好像不支持 eps ?
还有什么其他格式也不错?
谢谢和问候!
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!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
这取决于您使用的 LaTeX 的“口味”。
如果您使用“标准”LaTeX,则几乎必须使用 EPS。正如您所注意到的,由于 EPS 图像不能包含在 HTML 中,因此您必须在 HTML 中使用 JPEG 或 PNG 并将这些图像转换为 EPS 以便包含在 LaTeX 文档中(这可以使用 ImageMagick 自动执行)。
或者,这是我推荐的选项,您可以使用 pdfLaTeX,它可以本地处理 JPEG 和 PNG,允许您在 HTML 和 LaTeX 文档中使用相同的图像。
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.
标准 LaTeX 确实“喜欢”EPS,但这是有原因的——它是一种矢量格式。在 EPS 中正确创建图形将确保打印输出的质量仅受打印机质量的限制,而不受图像文件分辨率的限制(JPEG 和 PNG 等光栅化格式的情况就是如此)。
因此,如果您包含线条图、条形图等,您几乎必须以 EPS(或 PDF)格式进行,然后转换为用于网络的 PNG。如果您的图形本质上是光栅化的(例如您想要包含照片),您可以选择高质量的 JPEG,然后使用 jpeg2ps 为 LaTeX 创建 EPS 文件(或直接将它们包含在 pdfLaTeX 中)。
回顾一下:决定正确图像格式的是您的图像,而不是您的程序。
PS 像 TeX4ht 这样的工具通常会在需要时处理图像转换。
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.
TeX 和 LaTeX 的内在宏不支持任何图像。为了获得这些优势,Donald Knuth 添加了命令
\special
。事实上,要在文档中包含一些图像,LaTeX 包会插入类似于TeX 创建的 dvi 文件,包含此命令不变。例如,现在您想要将 dvi 文件转换为 ps。您调用 dvips-programm,该程序将您的图像插入最终的 ps 文件中。
因此,eps 格式最适合不用于 Latex,eps 格式最适合 dvips,因为 PS 是 PostScript,EPS 是 Encapsulated PostScript。
PS 有
jpeg2ps.exe
程序可以将jpeg转换为eps。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 thatdvi-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.