Latex文件的编译
我正在服务器上编译一个 Latex 文件,并从那里下载生成的 dvi、ps 和 pdf 文件以查看它们。
\includegraphics 的乳胶文件包含一些不在我的本地计算机上的图形文件。我发现由latex命令生成的dvi文件在下载到本地后不显示数字,但由dvips -Ppdf生成的ps文件有数字,而由ps2pdf或pdflatex生成的pdf文件似乎又没有数字。是否因为这些编译命令实际上并未将图形嵌入为 dvi 和 pdf 文件的一部分?如何实际嵌入图形以便我们只能将文档文件导出到其他机器?
由 /input 包含在主 tex 文件中的单独 tex 文件中的表格的情况以及由 \usepackage 包含的样式文件的情况是否类似于上述由 \includegraphics 包含的图形文件的情况?
I am compiling a latex file on a server and download from there the generated dvi, ps and pdf files to view them.
The latex file by \includegraphics includes some figure files which are not on my local machine. I found that dvi file generated by latex command does not show the figures after dowloaded to my local, but ps file generated by dvips -Ppdf have the figures, and pdf file generated by either ps2pdf or pdflatex seem not have the figures again. Is it because the figures are not actually embeded as part of the dvi and pdf files by those compilation commands? How to actually embed figures so we can only export the document files to other machines?
Are the case for tables in separated tex files included into main tex file by /input and the case for style files included by \usepackage similar to the above case for figure files included by \includegraphics ?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
你应该看看警告。我确信有一些,因为对于 ps,你需要 eps 图片,对于 pdflatex,你需要 png 或 jpeg(首先尝试在本地计算机上编译,例如使用 kile 或 gedit 插件)
我正在使用 kile 的编译命令来生成 pdf效果总是很好(包括图片)。他们使用 pdflatex 来实现这一点。
you should look at the warnings. i am sure there some, because for ps you will need eps pictures and for pdflatex you'll need png or jpeg (try compiling at your local machine first, e.g. with kile or the gedit plugin)
I am using kile's compile commands for pdf generation which works always fine (pics incl.). they use pdflatex for that.
这在很大程度上取决于您的图片文件的格式,以及您用来转换 dvi 的各种工具如何处理这些格式 -> ps-> pdf
如果您制作 ps,最好是以 eps(封装后记)格式提供您的图形,使用 Latex 编译并使用 dvips。
如果你想生成pdf,那么提供pdf或png格式的图形,并使用pdflatex。
看
http://en.wikibooks.org/wiki/LaTeX/Importing_Graphics 和
http://amath.colorado.edu/documentation/LaTeX/reference/figures。 html
对所发生的事情有很好的解释。
Latex 命令的输出也可以为您的图形所发生的情况提供非常丰富的信息。
it depends a lot on the format of your picture files, and how those formats are handled by the various tools you use to convert dvi -> ps -> pdf
If you product ps, the best is to provide your figures in eps (encapsulated postscript) format, compile with latex and use dvips.
If you want to generate pdf, then provide your fgure in pdf or png format, and use pdflatex.
See
http://en.wikibooks.org/wiki/LaTeX/Importing_Graphics and
http://amath.colorado.edu/documentation/LaTeX/reference/figures.html
for good explanations of what happens.
The output of the latex command can be very informative about whant happens with your figures too.
背景
嵌入式图像(如 eps 文件)在 Knuth 的原始 dvi 规范中不受支持 — 这并不奇怪,因为 dvi 是比 Postscript 更旧的格式;相反,它们使用扩展功能进行编码,在 Tex 中通过 \special 命令访问,在 dvi 中通过一些保留代码访问。
dvips
设定了如何使用特殊功能的标准,这为在 Tex 中包含 Postscript 功能提供了非常灵活的方法,但并非所有 dvi 实用程序都完全支持这些功能。回答,第一部分:图形在哪里?
使用 \includegraphics 导入的所有图形都使用 \special 代码在 dvi 中编码为 Postscript,所以对于您问题的第一部分 - 是的,图像内容全部在dvi文件中。因此,您无需担心用于生成 dvi 的文件在哪里。
然而,处理 dvi 的不同程序可能会做一些不稳定的事情。 dvips 是标准,它基于 Ghostscript,多年来出现了各种不稳定的情况。其他 dvi 软件根本不支持特价产品,或者支持方式很奇怪。
答案,第二部分:修复问题
您认为为什么这些数字丢失了?您是否在屏幕查看器中查看过这些文件,或者是否将其打印出来?屏幕上的观看者通常很不稳定。打印输出很少出现这种情况。
否则,请查看您正在使用的各个软件的错误跟踪系统。我发现 pdftex 使我免受许多此类问题的困扰;多年来我发现 Ghostscript 错误处理起来特别烦人。 Adobe Acrobat 很笨重,但它是标准,并且非常适合解决 ps/pdf 问题。尝试其他软件。
Background
Embedded images, like eps files, are not supported in Knuth's original dvi specification — not surprising since dvi is an older format than Postscript; instead, they are encoded using an extension capability that is accessed in Tex through the \special command and in dvi by some reserved codes.
dvips
set a standard for how to use specials, which gave a very flexible means for including Postscript facilties in Tex, but not all dvi utilities fully support these.Answer, part one: where are the figures?
All figures imported using \includegraphics are encoded in the dvi as Postscript using the \special code, so to the first part of your questions - yes, the image content is all in the dvi file. So you don't need to worry about where the files are that were used to generate the dvi.
However, different programs that process the dvi can do flaky things. dvips is the standard, and it's based on ghostscript, which has seen various kinds of flakiness over the years. Other dvi software has simply not supported specials, or supported them oddly.
Answer, part two: fixing things
Why do you think the figures are missing? Have you looked at the files in an on-screen viewer, or have you printed them out? It can often be that an on-screen viewer is flaky; that is rarely the case with the print-out.
Otherwise, look at the bug tracking systems for the various bits of software you are using. I've found pdftex insulates me from a lot of these issues; I've found ghostscript bugs to be particularly annoying to deal with over the years. Adobe Acrobat is clunky, but it is the standard and it's good for troubleshooting ps/pdf issues. Try other software.