Wednesday, December 30, 2009

How to include sub-floats in a list-of-floats in LaTeX

Been pottering around with LaTeX lately, after a long while, and came across this handy nugget I couldn't find adequately documented anywhere else.

I was trying to combine 2 images into a single float using the subfig package, but couldn't see them in the "List of Figures", despite adding individual captions. It turned out to be a simple fix. All you need to do is add the following line just before the \listoffigures command.

\setcounter{lofdepth}{2}

As you might have guessed looking at the command, it sets the depth for list-of-figures to 2, which meant that the captions of the sub-figures were displayed.

If you've combined 2 tables into a single float, you need to add the following line just before the \listoftables command.

\setcounter{lotdepth}{2}

You can find the full documentation for subfig as a PDF, here.

And, finally, I publish a post on this blog after ages!

No comments: