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.

Related Posts:

  • LaTex: Fixing Wrong Figure Numbers
  • LaTex: Making Floatng Text Boxes
  • Convert PNG to EPS
  • LaTex Annoyances
  • Installing LaTex on Windows
  • Latex: Squeezing the Vertical White Space
  • Latex: Rotate Inserted Images
  • Latex: Numbered Subsubsections
  • Code Segments in Latex
  • Convert JPG and PNG to EPS on Windows

  • 2 Responses to “Latex: Citations in Figures”

    1. Gravatar Michael Shell UNITED STATES Says: Reply to this comment

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

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

      ;)

      Posted using Mozilla Firefox Mozilla Firefox 2.0.0.1 on Linux Linux
    2. Gravatar Luke UNITED STATES Says: Reply to this comment

      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.

      Posted using Mozilla Firefox Mozilla Firefox 2.0 on Ubuntu Linux Ubuntu Linux

    Leave a Reply

    XHTML: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <code> <pre lang=""> <em> <i> <strike> <strong>

    [Quote selected]