I'm trying to use tocloft
to create a list of equations in the contents table of my thesis, but it's erroring when I compile the document. I've used \newcounter
to define a new list of R scripts for the appendices, and it seems that this new counter is not compatible with tocloft
.
\documentclass[12pt,a4paper]{book}
\usepackage{anysize,array,multirow,graphicx,epstopdf,natbib,caption,color,hhline,symlist,amsmath,acronym,subfig,listings,placeins,hyperref,wrapfig,rotating,tocloft}
\usepackage[svgnames]{xcolor}
\marginsize{3cm}{3cm}{2cm}{2cm}
\captionsetup[table]{skip=4pt,font=footnotesize} %works with package{caption} to skip the height from the table, and to select 10pt as the text size
\captionsetup[figure]{skip=4pt,font=footnotesize} %works with package{caption} to skip the height from the table, and to select 10pt as the text size
\DeclareCaptionType{equationme}[][List of Equations] %this is a work-around to get a list of equations with page numbers in my contents page, however it adds a caption to my equations (not ideal!!)
\captionsetup[equationme]{skip=4pt,font=footnotesize}
\newlength{\Oldarrayrulewidth}
\newcommand{\Cline}[2]{%
\noalign{\global\setlength{\Oldarrayrulewidth}{\arrayrulewidth}}%
\noalign{\global\setlength{\arrayrulewidth}{#1}}\cline{#2}%
\noalign{\global\setlength{\arrayrulewidth}{\Oldarrayrulewidth}}}
%this is the R bit............
\newcounter{Script}[section]
\newenvironment{Script}[1][]{\refstepcounter{Script}\par\medskip
\textbf{Script~\theScript. #1} \rmfamily}{\medskip}
\begin{document}
\listofequationme
\addcontentsline{toc}{chapter}{List of Equations}
\begin{equationme}[!ht]
\caption[Earthquake magnitude affect on landsliding]{Relationship between earthquake magnitude and the potential area affected by landsliding as defined by \hilight{Keefer}, where A' is the potential area affected.}
\begin{equation}
\label{eq:EQMagnitudelsArea}
log_{10} \newsym{Potential area affected}{A'} = \newsym{Earthquake magnitude}{M}-3.46(\pm0.47)
\end{equation}
\end{equationme}
\end{document}
While the list works fine for the equations, I don't want to have to have a caption above it… So can someone either tell me how to edit \captionsetup
or how to get tocloft
to work alongside the \newcounter{Script}[section]
command as this is where I seem to be getting an error…
Error is:
Command \c@lotdepth already defined. \newcounter{lotdepth}
I really hope this makes sense as I'm going a little loopy right now!
Best Answer
The main problem is the loading order of
subfig
andtocloft
.subfig
definesc@lotdepth
by a\@nameuse
statement - as such it's already defined at the time whentocloft
tries to setup this new counter.The same is true for
c@lofdepth
, leading to a similar error.The other way round, using
tocloft
first before loadingsubfig
poses no problem.Another solution is to remove the loading of
subfig
-- it's apparently not used in the 'MWE'(I also cleaned up the document, slightly)