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.
<to be read again> 
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, 2013 at 15:30
  • I updated the error code. I hope this is what you ask for.
    – Joost
    Jun 12, 2013 at 15:37
  • Welcome to TeX.SX! You can have a look on our starter guide to familiarize yourself further with our format.
    – cmhughes
    Jun 12, 2013 at 15:47

2 Answers 2


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.

  • 1
    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.
    – Joost
    Jun 12, 2013 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:


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.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .