For a book project with lots of figures, I need to generate a list of the filenames of all figures included via includegraphics{} and their figure numbers. Something like:
1.1 ch01-intro/fig/lascaux.jpg
1.2 ch01-intro/fig/plot-weather-new.png
1.3 ch01-intro/fig/huygens1669.png
1.4 ch01-intro/fig/priestley-chart-biography-edit.png
There is a perl script on CTAN, texdepend, that will find the filenames, but it doesn't necessarily list them in order and doesn't grok the figure numbers. (It was designed for generating a Makefile, or preparing a ZIP file for a LaTeX project.)
> texdepend -format=1 -print=f TOGS.tex |head
# C:\batchfiles\texdepend.pl, v0.96 (Michael Friendly (friendly@yorku.ca))
# commandline: C:\batchfiles\texdepend.pl -format=1 -print=f TOGS.tex
# FIGS =
ch05-playfair/fig/playfair1805-inquiry-crop.jpg
ch01-intro/fig/lascaux.jpg
ch01-intro/fig/plot-weather-new.png
ch01-intro/fig/huygens1669.png
ch01-intro/fig/priestley-chart-biography-edit.png
ch01-intro/fig/marey-trains.png
ch01-intro/fig/Minard-cotton3.png
Similar questions have be asked here and there but none have the requirement of including the figure numbers.
Wanted: A way to modify includegraphics itself so that it also writes lines to an external file, of the form
fignum filename
One small complication is that a given begin{figure} environment can contain two or more \includegraphics commands, for example:
\begin{figure}[htb]
\centering
\includegraphics[width=.49\textwidth]{\theChapter/fig/galton-interp2}
\includegraphics[width=.49\textwidth]{\theChapter/fig/galton-interp3}
\caption{A reconstruction of Galton's method for finding contours of
approximately equal frequency in the relationship between heights of parents
and their children.
}%
\label{fig:galton-interp2}
\end{figure}
If this generates Fig. 6.16, the result should look like
6.16 ch06-scat/fig/galton-interp2.png
6.16 ch06-scat/fig/galton-interp3.png
\includegraphicsmacro is not the real problem concerning the writing of the figure number and the file name, but determination of the figure number itself which is increased by\captionwhich is done later than\includegraphicshere, unless you use it before... – Sep 20 '17 at 20:04includegraphics()by itself, doesn't have access to the filename extensions-- they could be.png,.jpgorpdffor pdflatex. – user101089 Sep 21 '17 at 02:20