This question stems from the same book project described in Generate a list of figure numbers and filenames from \includegraphics. The answers there provide the basic code to generate a text file of figure numbers and associated file names from LaTeX source. Now, I need to extend this method to a further task of collecting a text file of figure sources.
In this book (nearly) all figure \caption{}s have included in them a source{} command giving the figure source. It is presently defined just to print information about the figure source as text, with Source: in italics
\newcommand{\source}[1]{\emph{Source:} #1.}
Some figures require permissions, others don't, but for publication, the publisher requires a list of all figures, their sources and permission status.
My desire is to extract at least the basis for this from the LaTeX source by modifying \source{} command to also write lines to a List of Sources (los) file.
One example of a figure requiring permission is:
\begin{figure}[htb]
\centering
\includegraphics[width=.6\textwidth]{\theChapter/fig/cholera-monmonier-gilbert}
\caption[\desc{Presentation graphic} Mark Monmonier's re-vision of the Gilbert version of Snow's map, as
a presentation graphic]{\desc{Presentation graphic} Mark Monmonier's re-vision of the Gilbert version of Snow's map, as
a presentation graphic. \source{Monmonier (1996), \emph{How to Lie with
Maps}, p. 158. Image: permission required, University of Chicago Press.}
}
If this is Fig. 4.10 in the book, I'd like the re-defined \source{} command to write a line to an los file something like:
4.10 Monmonier (1996), \emph{How to Lie with Maps}, p. 158. Image: permission required, University of Chicago Press.
In other words:
Wanted: A way to modify \source{} so that it also writes lines to an external file \jobname.los, of the form
fignum source
Can someone help with this?
los, notlfn. – user101089 Jan 25 '18 at 15:21\url{}inside\source{}, e.g.,\source{Library of Congress, \url{http://hdl.loc.gov/loc.pnp/ppmsca.33913}} }. I don't know why, but these generate anundefined control sequenceerror. – user101089 Jan 25 '18 at 15:28\jobname.losfile it would be best if information for each figure was justfignum figsource, orfignum filename figsourceall on on line. The code above gives me two separate lines for each figure:1.1 ../ch06-scat/fig/galton-interp2.pngand\contentsline {section}{1.1: Foo stuff; permission required}{3}– user101089 Jan 25 '18 at 15:37.losand.lfnis not really an error. And your question is anything but clear. – Jan 25 '18 at 16:05.losand.lfn. What I want is obtained by using just\DeclareRobustCommand{\source}[1]{\emph{Source:} \addtocontents{los}{\thefigure\space #1}#1.}– user101089 Jan 26 '18 at 14:58