在我添加 \usepackage[subfigure]{tocloft} 之前编译是没问题的,但是一旦使用,就出现错误,如下所示:
! Missing } inserted.
<inserted text>
}
1.60 \tableofcontents
如果取消注释“\listoffigures”或“\listoftables”,也会发生同样的事情。有人知道如何修复它吗?谢谢。
------------------- 我的 Tex 文件 --------------------
\usepackage{graphicx}
\usepackage{multicol}
\usepackage{color}
\usepackage{arial}
\usepackage{fancyhdr}
\usepackage[subfigure]{tocloft}
\usepackage{subfigure}
\usepackage{multirow}
\usepackage{threeparttable}
\usepackage{array}
\usepackage{booktabs}
\usepackage{float}
\usepackage{booktabs}
\usepackage{caption}
\usepackage{setspace}
\begin{document}
\input{TitlePage.tex}
\newpage
\input{Copyright.tex}
\newpage
\frontmatter
\pagestyle{prelim}
% Redefine plain page style so that the first pages of chapters
% have desired page style.
%
\fancypagestyle{plain}{%
\fancyhf{}
\cfoot{-\thepage-}
}%
\input{Signature_Page.tex}
\newpage
\input{Dedication.tex}
\newpage
% Begin Double Spacing
%
\singlespacing
%\doublespacing
\tableofcontents
\newpage
%\listoffigures
%\cftsetindents{figure}{0em}{3.5em}
\newpage
%\listoftables
\newpage
答案1
@BigL,正如你在上面的评论中提到的那样 -
最终目的是改变图形列表中项目符号#和图形标题之间的间距。
如果这就是你正在寻找的,那么以下解决方案应该可以很好地工作。我的解决方案基于你在示例中使用的subcaption package
而不是现已弃用的subfigure package
(我真的不能称它为MWE
,因为它包含很多不必要的东西)。
下面提供的内容MWE
几乎是不言自明的,并且包含足够的内联提示。我确实意识到这个问题已经发布一年了,但是,对类似问题的简单搜索建议我应该在这里发布答案,至少为了后代。
梅威瑟:
\documentclass[a4paper,oneside]{report}
\usepackage[demo]{graphicx} %% to get demo figures
\usepackage{showframe} %% Shows the actual page layout
\usepackage[list=true]{subcaption} %% alternative for subfigure
%% To get subfloats listed in list of figures, you
%% must load the subcaption package with [list=true]
%% option!
%%\usepackage{subfigure} %% deprecated package!
\usepackage[subfigure]{tocloft} %% OP's definition
%% subfgure This option is required if, and only if,
%% the tocloft and subfgure packages are being used
%% together. The two packages can be specifed in any
%% order. - From the tocloft package documentation
%% (dated 2013/05/02)
\newcounter{lofdepth} %% Declare new LoF depth counter
\newcounter{lotdepth} %% Declare new LoT depth counter
\setcounter{lofdepth}{2} %% Set new LoF depth counter to include subfigures
%%\setcounter{lofdepth}{1} %% If subfigures are't needed in LoF
%% Adding horizontal space between LoF numbers and entry text
\renewcommand{\cftfignumwidth}{1in} %% Exaggerated width!
\renewcommand{\cftsubfignumwidth}{1in} %% Exaggerated width!
%% Indentation for LoF entry numbers
\renewcommand{\cftfigindent}{0em}
\renewcommand{\cftsubfigindent}{2.25em}
%% Vertical skips for LoF entries
\renewcommand{\cftbeforefigskip}{12pt}
\renewcommand{\cftbeforesubfigskip}{8pt}
%% Customisation of subfig numbers in the LoF entries
\renewcommand{\cftsubfigpresnum}{[\hspace*{0.5mm}}
\renewcommand{\cftsubfigaftersnum}{{}.\hspace*{0.5mm}]}
%% Figure LoF entries in bold
\renewcommand{\cftfigfont}{\bfseries}
\renewcommand{\cftfigpagefont}{\bfseries}
\renewcommand{\cftfigleader}{\bfseries\cftdotfill{\cftfigdotsep}}
%% To switch-off page numbers of subfigure LoF entries
\cftpagenumbersoff{subfigure}
\begin{document}
\tableofcontents
\cleardoublepage
\listoffigures
\cleardoublepage
\listoftables
\cleardoublepage
\chapter{CHAPTER 1}
\begin{figure}[!ht]
\vspace*{-20pt}
\centering
\begin{subfigure}{0.56\textwidth}
\includegraphics{}
\centering
\caption{First SUB-FLOAT}
%\label{fig:demo1}
\end{subfigure}
\begin{subfigure}{0.56\textwidth}
\includegraphics{}
\centering
\caption{Second SUB-FLOAT}
%\label{fig:demo2}
\end{subfigure}
\begin{subfigure}{0.56\textwidth}
\includegraphics{}
\centering
\caption{Third SUB-FLOAT}
%\label{fig:demo3}
\end{subfigure}
\caption{Demo Figure 1}
\end{figure}
\cleardoublepage
\section{Section 1}
\begin{table}[h]
\begin{center}
\vspace*{1.5in}
\scalebox{1.25}{
\begin{tabular}{|c|c|}
\hline
Mineral & Color \\
\hline
\hline
Ruby & red \\
\hline
\hline
Sapphire & blue \\
\hline
\end{tabular}
}
\end{center}
\caption{Demo Table 1}
\vspace*{50pt}
\end{table}
\subsection{Subsection 1}
\cleardoublepage
\chapter{CHAPTER 2}
\begin{figure}[!ht]
\vspace*{-20pt}
\centering
\begin{subfigure}{0.56\textwidth}
\includegraphics{}
\centering
\caption{First SUB-FLOAT}
%\label{fig:demo1}
\end{subfigure}
\begin{subfigure}{0.56\textwidth}
\includegraphics{}
\centering
\caption{Second SUB-FLOAT}
%\label{fig:demo2}
\end{subfigure}
\begin{subfigure}{0.56\textwidth}
\includegraphics{}
\centering
\caption{Third SUB-FLOAT}
%\label{fig:demo3}
\end{subfigure}
\caption{Demo Figure 2}
\end{figure}
\cleardoublepage
\cleardoublepage
\section{Section 2}
\begin{table}[h]
\begin{center}
\vspace*{1.5in}
\scalebox{1.25}{
\begin{tabular}{|c|c|}
\hline
Fruit & Color \\
\hline
\hline
Apple & red \\
\hline
\hline
Banana & Yellow \\
\hline
\end{tabular}
}
\end{center}
\caption{Demo Table 2}
\vspace*{50pt}
\end{table}
\subsection{Subsection 2}
\cleardoublepage
\end{document}
定制后的结果如下LoF
:
如果我们从代码序言中注释掉以下几行:
%% Adding horizontal space between LoF numbers and entry text
\renewcommand{\cftfignumwidth}{1in} %% Exaggerated width!
\renewcommand{\cftsubfignumwidth}{1in} %% Exaggerated width!
%% Indentation for LoF entry numbers
\renewcommand{\cftfigindent}{0em}
\renewcommand{\cftsubfigindent}{2.25em}
%% Vertical skips for LoF entries
\renewcommand{\cftbeforefigskip}{12pt}
\renewcommand{\cftbeforesubfigskip}{8pt}
%% Customisation of subfig numbers in the LoF entries
\renewcommand{\cftsubfigpresnum}{[\hspace*{0.5mm}}
\renewcommand{\cftsubfigaftersnum}{{}.\hspace*{0.5mm}]}
%% Figure LoF entries in bold
\renewcommand{\cftfigfont}{\bfseries}
\renewcommand{\cftfigpagefont}{\bfseries}
\renewcommand{\cftfigleader}{\bfseries\cftdotfill{\cftfigdotsep}}
%% To switch-off page numbers of subfigure LoF entries
\cftpagenumbersoff{subfigure}
然后LoF
默认为:
这里,特别注意图像编号和文本之间的水平间距变化,该变化在此代码中由\cftfignumwidth
(图)和\cftsubfignumwidth
(子图)控制。其余的自定义当然是可选的,取决于用户偏好。希望这能有所帮助!