Latex:提取所有使用的包的sty文件

4

我写了一个很大的.tex文件,使用了许多包,现在我想将所有东西归档,不仅是.tex和.jpg文件,还有.sty文件。

这是因为有时候sty文件中的一些选项会被更改,然后我就无法编译文件了。

"问题"是,在Ubuntu中使用时,我已经安装了系统中的所有包。我不想手动复制它们。是否有一个程序可以自动完成这个过程?

谢谢。

2个回答

6
请参见https://texfaq.org/FAQ-filesused,引用如下:

All the files used by this document When you’re sharing a document with someone else (perhaps as part of a co-development cycle) it’s as well to arrange that both correspondents have the same set of auxiliary files, as well as the document in question. Your correspondent obviously needs the same set of files (if you use the url package, she has to have url too, for example). But suppose you have a bug-free version of the shinynew package but her copy is still the unstable original; until you both realise what is happening, such a situation can be very confusing.

The simplest solution is the LaTeX \listfiles command. This places a list of the files used and their version numbers in the log file. If you extract that list and transmit it with your file, it can be used as a check-list in case that problems arise.

Note that \listfiles only registers things that are input by the “standard” LaTeX mechanisms (\documentclass, \usepackage, \include, \includegraphics and so on). The \input command, as modified by LaTeX and used, with LaTeX syntax, as:

\input{mymacros}

records file details for mymacros.tex, but if you use TeX primitive syntax for \input, as:

\input mymacros

mymacros.tex won’t be recorded, and so won’t listed by \listfiles — you’ve bypassed the mechanism that records its use.

The snapshot package helps the owner of a LaTeX document obtain a list of the external dependencies of the document, in a form that can be embedded at the top of the document. The intended use of the package is the creation of archival copies of documents, but it has application in document exchange situations too.

The bundledoc system uses the snapshot to produce an archive (e.g., tar.gz or zip) of the files needed by your document; it comes with configuration files for use with TeX Live-Unix and MiKTeX. It’s plainly useful when you’re sending the first copy of a document.

The mkjobtexmf finds which files are used in a “job”, either via the -recorder option of TeX, or by using the (Unix) command strace to keep an eye on what TeX is doing. The files thus found are copied (or linked) to a directory which may then be saved for transmission or archiving.


2
Latex日志文件中所有加载的文件如下所示:
  1. 使用绝对路径指定的文件显示为 (\$PATH 加上空格(一个空格或一个换行符;我认为Tex禁止在路径中使用空格,确实带有空格的路径是传递给\input命令的一对参数);
  2. 本地路径相同,只不过前面多了一个点: (.\$PATH 加上空格
  3. 字体显示在 <...> 中。
您可以轻松地从.log文件中提取这些文件名。

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接