I have a LaTeX document with a large number of drawings included from external files with \includegraphics{bla.pdf}
. The drawings are done in Inkscape. This all works fine. However sometimes it is hard to keep track of all the drawings and their source files. Hence I'm looking for a way to include the source file name, in the example bla.pdf
, into the caption. Not being a LaTeX expert I haven't found a way to automatically access the filename string from the caption. Using Google-foo didn't yield a result either. Is there an existing way to refer to the filename and include it in the caption, like \caption{A fancy drawing of bla (\filename}
?
views:
40answers:
2
+1
A:
Prepare a \newenvironment
that sets up the \figure
, calls \includegraphics
and sets the caption.
Or one that makes a minipage and installs the graphic and a text-box for the caption if you don't want it in a float. For this you probably use \newcommand
.
dmckee
2010-09-17 14:52:29
A:
Redefine \includegraphics
. For the case of no arguments (width=3cm, scale=2 or something like this) we have
\let \saveinclude \includegraphics
\def \includegraphics#1{\def\filename{#1}\saveinclude{#1}}
The use
\includegraphics{bla.pdf}
\caption{A fancy drawing of bla (\filename)}
Alexey Malistov
2010-09-20 11:48:05