# Lists of Figures and Tables is not generated: error

Finishing my twosided article, I want to generate the LOF and LOT.

The following error occurs over and over for a lot of figures (the first being: "Undefined control sequence" and the second being: "Missing number treated as zero":

! Undefined control sequence.
\l@figure #1#2->\ifnum \c@lofdepth
>\z@ \vskip \cftbeforefigskip {\leftskip ...
l.10 ...DPJIP2009}\relax }}{11}{figure.caption.14}

The control sequence at the end of the top line
of your error message was never \def'ed. If you have
misspelled it (e.g., \hobx'), type I' and the correct
spelling (e.g., I\hbox'). Otherwise just continue,
and I'll forget about whatever was undefined.

! Missing number, treated as zero.
>
l.10 ...DPJIP2009}\relax }}{11}{figure.caption.14}

A number should have been here; I inserted 0'.
(If you can't figure out why I needed to see a number,
look up weird error' in the index to The TeXbook.)


I use PDFLATEX via texstudio (MAC OSX) and \documentclass[11pt,a4paper,twoside,openany]{book}. I also just updated all packages, no difference (did not reboot computer).

I hope someone can help.

• Please show the exact full error message, the undefined control sequence message for example shows which command was undefined. Jun 12 '13 at 15:30
• I updated the error code. I hope this is what you ask for. Jun 12 '13 at 15:37
• Welcome to TeX.SX! You can have a look on our starter guide to familiarize yourself further with our format. Jun 12 '13 at 15:47

The standard classes have a tocdepth counter but do not a lofdepth counter (the internal name of which would be \c@lofdepth) so most likely you at one point used a package for extended list of figures handling and that package is no longer loaded leaving the temporary files in an inconsistent state.

Delete the .lof .toc .lot and .aux files and re-latex and things should get back in sync.

• Your answer helped me to fix it. In the preamble I had: \usepackage[titles,figures]{tocloft}. I do not know why 'figures' was in there (as a starter you sometimes just copy codes). Deleting it solved the problem. Jun 12 '13 at 16:18

As Joost mentioned in a comment, this can happen when using a specific option for the tocloft package.

In my case, I had the following code in the preamble:

\usepackage[subfigure]{tocloft}


The subfigure option caused the problem. The manual says it best, emphasis mine:

This option is required if, and only if, the tocloft and subfigure packages are being used together. The two packages can be specified in any order.

-- (From Section 2.1 of the tocloft manual)

Since I'm not using the subfigure` package, removing the option got rid of the errors.