2

I'm writing a long book with many figures, and I'd like to insert figure credit code inside each figure environment and have the associated credit text collected and printed in a Listoffigurecredits (much like a Listoffigures, Listoftables, and such) at the end of the book.

I looked into this related answer but it was rather complex and did not perform quite what I needed, for instance the automatic numbering of the credit based on the typeset figure number.

As an example, I would like a figure call with associated credit line to be of the (minimal) form:

\begin{figure}
\include{...figure file here...}
\caption{Mona Lisa by Leonardo da Vinci.}
\figurecredit{Mona Lisa by Leonardo da Vinci, reproduced by permission, The Louvre, Paris.}
\end{figure}

Then, at the end of the book I'd like to have a

\listoffigurecredits

which would print a list whose items included:

Figure 2.9: Mona Lisa by Leonardo da Vinci, reproduced by permission, The Louvre, Paris.

Notice that the "Figure 2.9" should be automatically generated, based on the actual typeset figure, and that the style should match that of listoffigures, listoftables, etc.

I'm hoping for the minimal code... the simplest approach to this admittedly tricky task.

  • The code in the linked answers isn't tricky really. There is much more trickier content on this site, of course – user31729 Feb 9 at 11:03
3

enter image description here

The macro \figurecredits just writes the credit to a separate file named \jobname.fcf and \listoffigurecredits is basically nothing different than a copy of \tableofcontents, which displays the .fcf file.

\documentclass{article}

\usepackage{etoolbox}


\makeatletter
\newcommand{\figurecredit}[2][]{%
  \ifblank{#1}{%
    \addcontentsline{fcf}{figure}{\protect\numberline{\thefigure}#2}%
  }{%
    \addcontentsline{fcf}{figure}{\protect\numberline{\thefigure}#1}%
  }%
}

\newcommand{\listoffigurecredits}{%
  \begingroup
  \clearpage
  \let\old@starttoc\@starttoc
  \def\@starttoc##1{\old@starttoc{fcf}}
  \renewcommand{\contentsname}{Figure credits}
  \tableofcontents
  \endgroup
}
\makeatother

\begin{document}
\listoffigures


\begin{figure}
\caption{Mona Lisa by Leonardo da Vinci.}
\figurecredit{Mona Lisa by Leonardo da Vinci, reproduced by permission, The Louvre, Paris.}
\end{figure}

\begin{figure}
\caption{The Scream by Edvard Munch}
\figurecredit[The Scream]{The Scream by Edvard Munch}
\end{figure}


\listoffigurecredits

\end{document}
  • Thanks so very much. Let me run this later today and if (as I suspect) it works with tufte-book, I'll accept your answer. – David G. Stork Feb 9 at 18:13
  • You code almost works (+1) in the tufte-book environment. It indeed lists the \figurecredit text, but it does not insert the full figure number beforehand, e.g., Figure 2.9 (which includes the chapter). I tried adding \thechapter and \thefigure inside the figurecredit text, but of course that does not give the proper listing on the Figure credits page. How to fix this? – David G. Stork Feb 9 at 18:51
  • Ah... I see the problem: tufte-book numbers the figures sequentially, without regard to chapter. I'll have to change that style, and then presumably the numbering will appear proper in the Figure credits. – David G. Stork Feb 9 at 19:14
  • @DavidG.Stork: Things tufte screws up are not my fault. ;-) If \thefigure is define differently you have to change it, of course. – user31729 Feb 9 at 19:58
  • Well, I wouldn't say Tufte's followers "screwed up," it is just a stylistic choice. And frankly I think Tufte's original books and several by others using tufte-book are some of the most elegant and readable in any form. Bottom line: You've done your job. Thanks so much. (accept) – David G. Stork Feb 9 at 20:02
0

This may not be satisfying, but the quick and dirty solution would be to put all the text inside the caption, then use the command \listoffigures which generates a list of all figures first with figure number then the caption text (separated by a colon).

  • 3
    Welcome to TeX.SE! Sorry, the OP wants to get two lists, one list of figures as usual and a second list with the credits. I think you missunderstood the question Am I right? – Mensch Feb 9 at 3:30
  • 1
    Yeah sorry, my bad. – JoeThePhysWiz Feb 9 at 4:06

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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