# Latex: Citations in Figures

For some unknown, mysterious reason you can’t put a \cite command as an argument of the \caption statement. I stumbled upon this today when I was trying to attribute an image that I shamelessly snurched from the web.

Apparently, the cause is not as mysterious as I thought. If you want to know why this happens, do some research on fragile commands and moving arguments. Do you need to understand these things throughly? Probably not. You just need to remember that you may sometimes need to protect a \cite when it is an attribute of something else:

\caption{Very Stupid Image \protect\cite{source}}

So here is a new rule of thumb: if you nest a command in an attribute of another command and latex freaks out, you might be dealing with a fragile command inside of a moving attribute. Sticking a \protect in front of the command is a good place to start troubleshooting the problem.

Update 12/15/2006 04:03:46 PM

One caveat here – if you put citations in image captions, then they will show up in your list of figures. This looks a little ugly, and it can mess up your citation order. For example, if you use IEEEtran.bst for your BibTex formating, then the first cited source should be [1], second source should be [2] and etc… Unfortunately if your list of figures is on page 3, then the first citation on that page will be counted as [1] even if the actual image does not show up till page 64.

So be careful with these.

Update 01/08/2007 10:05:32 AM

I figured out the caption and the list of figures issue. It turns out that \caption can take an optional parameter which is the text for the list like so:

\caption[Stupid Image]{Stupid Image \protect\cite{source}}

If you use it this way the citation only shows up under the figure, but not in the LoF and thus the order of references is preserved.

[tags]latex, fragile commands, moving attributes, cite, caption[/tags]

This entry was posted in programming and tagged . Bookmark the permalink.

### 9 Responses to Latex: Citations in Figures

1. To fix this annoying problem, load Donald Arseneau’s notoccite.sty package:

http://tug.ctan.org/cgi-bin/ctanPackageInformation.py?id=notoccite

;)

2. Luke says:

Heh! It seems that I was not the only person annoyed by this.

For now I’ll stick with defining the list of figures captions separately using the square brace. It makes sense as I can provide a more detailed caption under the image, and use a shorter one for the list.

3. Steven says:

Thanks a lot! Fixed my referencing for my masters.

You are a hero. Thanks!
\protect\cite{source}

5. Luigi-kun says:

Thanks alot man, the IEEEtran style is full of crap with these kind of things – have been at it since 05:00 this morning…

6. Greg says:

Thanks! This was useful, especially the last update. :) Bye!

7. jose hernandez says: