对 Latex 文档进行单独编译
编译 Latex 文档时,编译器会生成大量“目标”文件。这使得我正在处理的目录变得混乱,并且很难使用 SVN 等 VCS。当我使用 C++ 代码时,我有单独的代码和对象目录,我可以在源目录上运行 make,但 .o 文件会转到构建目录。
有没有正确的方法来对 Latex 文档执行这个单独的编译?可以通过使用 Makefile 或将选项传递给 Latex 编译器来完成吗?
谢谢
When compiling latex documents the compiler emits a lot of "object" files. This clutters the directories I'm working on and it difficults the use of VCS like SVN. When I work with C++ code I have separate directories for the code and the objects, I can run make on the source directory but the .o files go to the build directory.
Is there a proper way to perform this separate compilation with Latex documents? Can it be done by using Makefiles or by passing options to the latex compiler?
Thanks
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
您可以使用:
并且所有文件将存储在文件夹
tmp
中(包括pdf)。因为这不是最佳解决方案,所以我制作了自己的工具,pydlatex ,通过隐藏辅助文件(使用上面的技巧)来编译 LaTeX 源,并将 pdf 带回当前目录,因此编译后只有
file.tex
和file .pdf
在您的目录中。这与版本控制配合得很好。You can use:
and all the files will be stored in the folder
tmp
(pdf included).Because this is not an optimal solution, I made my own tool, pydflatex, that compiles the LaTeX source by stashing away the auxilliary files (using the trick above), and brings the pdf back to the current directory, so after compiling you only have
file.tex
andfile.pdf
in your directory. This plays very well with version control.我对 LaTeX 帮不了什么忙(20 年前才认真使用它;-),但对于 Subversion,你应该阅读 svn:ignore 属性 - 它可以轻松忽略带有您不扩展名的文件想要版本(对象文件、字节码文件(如 Python)通常可以放在与源相同的目录中、某些文本编辑器使用的备份文件,&c)。
I can't help much with LaTeX (having last user it seriously 20 years ago;-), but for Subversion, you should read up on the svn:ignore property -- it makes it easy to ignore files with extensions you do not want to version (object files, bytecode files as Python can often put in the same directory as the sources, backup files some text editors use, &c).
Latex 在主文档所在目录中生成临时文件。如果您希望将内容放置在不同的位置,请尝试使用如下所示的主文件。
使用这种方法,您可以维护如下所示的目录结构
Latex generates the temporary files in the directory where the main document is located. If you want the contents to be placed in a different location, try with a main file like below.
Using this method, you could maintain a directory structure like below
除了上述之外还有两种选择。
make clean
。Two options, besides the above.
make clean
.