使用 pdflatex 时避免创建 .aux、.log 和 .synctex.gz 文件
我只想有一个 .tex
文件,我用 pdflatex
编译它并最终得到一个 .pdf
文件。我不需要所有其他 .aux
、.log
和 .synctex.gz
文件。 pdflatex
似乎没有对此的论据。
I just want to have a .tex
file which I compile with pdflatex
and end up with a .pdf
file. I don't want all the other .aux
, .log
and .synctex.gz
files. pdflatex
doesn't seem to have arguments for this.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(10)
latexmk -c
将删除不必要的文件。latexmk
也是管理编译的好方法!latexmk -c
will remove the unnecessary files.latexmk
is a great way to manage the compile too!我总是这样构建我的 PDF 文件:
这样,我就不必太查看所有附加文件。不应删除这些文件,因为它们对于交叉引用、参考书目、目录等很重要。运行 pdflatex 多次然后删除文件会花费太多时间。
不幸的是,linux 版本的 pdflatex 中不存在
-aux-directory
。在 Ubuntu Lucid 上测试。I always build my PDF files like this:
That way, I don't have too see all the additional files. Those files should not be removed, as they are important for cross referencing, bibliographies, table of contents etc. To run
pdflatex
several times and then remove the files takes too much time.The
-aux-directory
unfortunately does not exist in the linux version of pdflatex. Tested on Ubuntu Lucid.对于 Linux 上的用户来说,与
-aux-directory
等效的似乎是-output-directory
,不幸的是它与\include{... }
(包含文件的.aux
文件仍会转储到当前目录中)。另请参阅:手册页。
For people on Linux the equivalent to
-aux-directory
appears to be-output-directory
, unfortunately it doesn't play nicely with\include{...}
(included files'.aux
files still get dumped in the current directory).See also: the man page.
如果使用 TeXnicCenter 的任何人都有同样的愿望,只获取给定 *.tex 文件的 *.pdf 文件(没有 *.aux、*.bbl、*.blg 和 *.log 文件),这是一个快速解决方案:
从菜单中选择:构建|定义输出配置文件,将“LaTeX => PDF”配置文件复制到新配置文件“LaTeX => PDF ONLY”,然后在“后处理器”选项卡上创建四个新的后处理器:
分别将 XXX 替换为 aux、bbl、blg、log。
If anyone using TeXnicCenter has the same desire to only get a *.pdf file for the given *.tex file (no *.aux, *.bbl, *.blg and *.log files), here is a quick solution:
Choose from the menu: Build | Define Output Profiles, copy the "LaTeX => PDF" profile to a new profile "LaTeX => PDF ONLY", then on the Postprocessor tab create four new postprocessors:
Replace XXX with aux, bbl, blg, log, respectively.
对于 MikTeX:
它将根据需要多次运行 pdflatex,并随后清理临时文件。非常有用。
For MikTeX:
It will run pdflatex as many times as necessairy and clean temp files afterwards. Very useful.
精心设计的包装脚本似乎是最好的答案。我在 Ubuntu 上使用 texlive-latex (pdftex 1.40.10) 进行了测试:
A well crafted wrapper script seems to be the best answer. Something along these lines, which I've tested on Ubuntu using texlive-latex (pdftex 1.40.10) :
文件中的 IIRC
\nofiles
会抑制.aux
输出。IIRC
\nofiles
in your file suppresses the.aux
output.编写一个删除文件的 shell 脚本包装器:
额外分配:修改脚本以仅删除 pdflatex 实际创建的文件。
Write a shell-script wrapper which removes the files:
Bonus-assignment: modifying the script to only remove the files actually created by pdflatex.
您如何创建/编辑 LaTex 文档?如果您使用的是 Sublime Text 2,您可以编辑项目文件以禁止打开您选择的文件类型。它们仍然会在编译时创建,但不会加载到您的项目中,从而使它们不可见。
How are you creating/editing your LaTex document? If you are using Sublime Text 2, you can edit the project file to suppress opening the file types of your choosing. They will still be created upon compile but won't be loaded into your project, keeping them invisible.
将
pdflatex
与-enable-write18
选项一起使用,并在 LaTeX 文件末尾写入,或者更高的价格
del
是一个 DOS 功能。对于 UNIX,使用rm
。Use
pdflatex
with-enable-write18
option and write at the end of your LaTeX fileor more pricise
del
is a DOS-function. Userm
for UNIX.