我尝试使用tocloft
在我的论文目录表中创建一个方程列表,但在编译文档时出错。我曾经\newcounter
为附录定义了一个新的 R 脚本列表,但似乎这个新计数器与 不兼容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}
虽然列表对于方程式来说很适用,但我不想在它上面有标题...所以有人可以告诉我如何编辑\captionsetup
或如何与命令tocloft
一起工作\newcounter{Script}[section]
因为这是我似乎收到错误的地方......
错误是:
Command \c@lotdepth already defined. \newcounter{lotdepth}
我真的希望这是有意义的,因为我现在有点疯狂!
答案1
subfig
主要问题是和的加载顺序tocloft
。
subfig
c@lotdepth
通过语句定义\@nameuse
- 因此在tocloft
尝试设置这个新计数器时它已经被定义。
也是如此c@lofdepth
,导致类似的错误。
反过来说,tocloft
在加载之前使用 firstsubfig
不会有问题。
另一个解决方案是删除加载subfig
——它显然没有在“MWE”中使用
(我还稍微清理了一下文档)
\documentclass[12pt,a4paper]{book}
\usepackage{anysize}
\usepackage{array}
\usepackage{multirow}
\usepackage{graphicx}
\usepackage{epstopdf}
\usepackage{natbib}
\usepackage{caption}
\usepackage{hhline}
\usepackage{symlist}
\usepackage{amsmath}
\usepackage{acronym}
\usepackage{tocloft}
\usepackage{subfig}
\usepackage{listings}
\usepackage{placeins}
\usepackage{wrapfig}
\usepackage{rotating}
\usepackage[svgnames]{xcolor}
\usepackage{hyperref}
\marginsize{3cm}{3cm}{2cm}{2cm}
% Unused
%\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{\setlength{\Oldarrayrulewidth}{\arrayrulewidth}}%
\noalign{\setlength{\arrayrulewidth}{#1}}\cline{#2}%
\noalign{\setlength{\arrayrulewidth}{\Oldarrayrulewidth}}}
% this is the R bit............
\newcounter{Script}[section]
\newenvironment{Script}[1][]{%
\refstepcounter{Script}\par\medskip
\textbf{Script~\theScript. #1} \rmfamily}{\medskip}
\providecommand{\hilight}[1]{%
#1%
}
\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}