Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

Is there an easy way to create a list of all external files (complete path) which are used by a LaTeX document (and its "sub-documents") by

  • \input
  • \include
  • \includegraphics ?

(may I have forgotten some input sources?)

share|improve this question
You can parse the .log file (not very trivial, though). You can also use strace or similar tool (but this one counts as hardcore). –  Andrey Vihrov Jul 31 '11 at 13:19
My dateiliste package includes a list of TeX files parsed in the document, but without complete path. (And not files used by includegraphics or similar.) –  Paŭlo Ebermann Jul 31 '11 at 14:22

3 Answers 3

up vote 22 down vote accepted

The snapshot package gives you a list of the external dependencies of a LaTeX document. Use it by saying


before the \documentclass command (to have the information written to a .dep file), or by saying


before the \documentclass command (to have the information written to the .log file).

share|improve this answer
Is there any way to use this information during the LaTeX build? I am trying to include all the distributed .tex files during a build using \usepackage{embedfile} and \embedfile{<...>.tex}... –  fgysin Feb 28 '13 at 8:38

This is a modified version of the @Gonzales answer with an additional python code to copy the figures to a new folder.

After using snapshot package to generate the .dep file:


use the following python code (say copy_figs.py) to copy the figures to a separate folder (for example, figs_used):

import os
import shutil

lines = open('./My_Latex_File.dep', 'r')
for n, line in enumerate(lines):
    if '*{file}' in line:
        if ('.png' in line) or ('.pdf' in line):
            value = line.split("{")[2].split("}")
            print value[0]
            shutil.copy('./' + value[0], 'figs_used/')

To run the python code:

c:\Python27\python.exe copy_figs.py

in the folder where the Latex file is placed. It is assumed the original figures are in figs subfolder, and those figures used in the Latex file are copied to figs_used subfolder. The code copies .png and .pdf figure files.

share|improve this answer

use the perl script mkjobtexmf available with every TeX distribution and run it like

mkjobtexmf --jobname <latex file> --cmd-tex pdflatex 

it creates an file <latex file>.fls which shows all used files, e.g. for a testfile named latex6:

PWD /home/voss/Documents
INPUT /usr/local/texlive/2011/texmf.cnf
INPUT /usr/local/texlive/2011/texmf/web2c/texmf.cnf
INPUT /usr/local/texlive/2011/texmf-var/web2c/pdftex/latex.fmt
INPUT latex6.tex
OUTPUT latex6.log
INPUT /usr/local/texlive/2011/texmf-dist/tex/latex/base/article.cls
INPUT /usr/local/texlive/2011/texmf-dist/tex/latex/base/article.cls
INPUT /usr/local/texlive/2011/texmf-dist/tex/latex/base/size10.clo
INPUT /usr/local/texlive/2011/texmf-dist/tex/latex/base/size10.clo
[ ... ]
share|improve this answer
Or you can simply run pdflatex -recorder <latex-file> to get the same effect. This is what mkjobtexmf does behind the scenes. –  Lev Bishop Jul 31 '11 at 20:42
sure, what else should it do? However, you can create a texmf tree depending to the job which is more what -recorder can do. –  Herbert Jul 31 '11 at 21:00
the -recorder option is great ! –  Suresh Jul 31 '11 at 21:55

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.