# List of included graphics with full pathname

Is there a way to get a list of all used graphics with full pathnames? The problem is that I have set the \$TEXINPUTS variable pointing to a directory containing images (which I included just using the filename), but I have also images included from the current directory and from some directories above (via ../image.png).

I tried the snapshot package but this gives me only the filenames without the complete path.

Many TeX compilers (pdfTeX, luaTeX, XeTeX) have an option -recorder, which behaves independent of the output mode (DVI, PDF). It records the input and output files in the file name <jobname>.fls.

Example:

% test.tex
\documentclass{article}
\usepackage{graphicx}
\begin{document}
\includegraphics{example-image-a}
\end{document}


Compilation: pdflatex -recorder test

Then test.fls contains the absolute path of the image (grep INPUT test.fls|sort|uniq|grep png):

INPUT /absolute-path-to/texmf-dist/tex/latex/mwe/example-image-a.png


This will output at the end of the log file the list of included graphic files, with the full path unless the image file is called with a relative path.

\documentclass{article}
\usepackage{graphicx,grffile}
\usepackage{etoolbox,xparse}

\makeatletter
\patchcmd{\Gin@setfile}
{}{\ddt}
\makeatother

\ExplSyntaxOn
{
\tl_set:Nx \l_student_ig_filename_tl { #1 }
\tl_set_from_file:Nnn \l_student_ig_filename_tl { } { "|kpsewhich~\l_student_ig_filename_tl" }
\tl_gput_right:Nx \g_student_ig_files_tl { \l_student_ig_filename_tl ^^J }
}
\AtEndDocument{\typeout{\g_student_ig_files_tl}}
\tl_new:N \l_student_ig_filename_tl
\tl_new:N \g_student_ig_files_tl
\tl_gset:Nn \g_student_ig_files_tl { ***~Graphic~files~*** ^^J }
\ExplSyntaxOff

\begin{document}

\includegraphics{../curva}

\includegraphics{example-image}

\includegraphics{brave-gnu-world-logo}

\end{document}


I ran this with

TEXINPUTS=/usr/local/texlive/2016/texmf-dist/doc/generic/pgf/images/: pdflatex mwe


so the variable TEXINPUTS is set for the specific job; it would be the same if it is set in the environment; in that case, just pdflatex mwe would suffice.

Here's the relevant part of the log file

*** Graphic files ***
../curva.jpg
/usr/local/texlive/2016/texmf-dist/tex/latex/mwe/example-image.png
/usr/local/texlive/2016/texmf-dist/doc/generic/pgf/images/brave-gnu-world-logo.jpg


Note that the last file wouldn't be found without setting TEXINPUTS.