4

The compiling was fine before I added \usepackage[subfigure]{tocloft}. But Once I used it, the error showed as:

! Missing } inserted.
<inserted text>
                  }
1.60     \tableofcontents

Same thing happened to "\listoffigures" or "\listoftables" if they are uncommented. Anyone knows how to fix it? Thanks.

------------------- My Tex File --------------------

\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
4
  • 3
    Welcome! Please post a complete, small example document rather than a fragment. That is, if that is really your document, then you should get errors much sooner because you have no \documentclass, no \end{document} etc. In this case, remove the line loading subfigure. It is obsolete and ought not be used.
    – cfr
    Jul 9, 2015 at 0:01
  • 1
    Instead of using the deprecated subfigure package, do consider using either the subcaption package or the subfig package. Either way, as @cfr recommends, do also omit the subfigure option when loading tocloft.
    – Mico
    Jul 9, 2015 at 0:04
  • 1
    That said, the addition of tocloft with subfigure does not cause errors when I complete your example. I do get errors due to the attempt to load arial and use the prelim pagestyle.
    – cfr
    Jul 9, 2015 at 0:07
  • 1
    I tried to remove 'subfigure', but it still did not work. The ultimate goal is to change the space between bullet # and figure caption in the list of figure. I need to use 'subfigure' or its alternatives in my tex. Also, 'subfig' did not work either.
    – BigL
    Jul 9, 2015 at 1:26

1 Answer 1

1

@BigL, as you've mentioned in your comment above -

The ultimate goal is to change the space between bullet # and figure caption in the list of figure.

If that's all you are/were looking for, then the following solution should work nicely. My solution is based on the subcaption package rather than the now deprecated subfigure package you've used in your example (I can't really call it the MWE, as it includes a lot of unnecessary stuff).

The MWE provided below is pretty much self-explanatory and includes sufficient hints inline. I do realise that it's been a year since this question was posted, however, a brief search for similar problems suggested that I should post an answer here, at least for the sake of posterity.

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}

Here's the LoF result post customization:

Customized look for List of Figures

And if we comment-out the following lines from our code's preamble:

 %% 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}

Then the LoF defaults to:

Default look for List of Figures

Here, particularly note the change in horizontal spacing between the image number and text, which is governed in this code by \cftfignumwidth (figures) & \cftsubfignumwidth (subfigures). Rest of the customization is of course optional and dependent on user preference. Hope this helps!

1
  • 1
    To the entity who down-voted this answer ... please at least have the decency to explain your down-vote via comments. Simply voting an existing answer without any alternative solution or explanation is easy; whereas posting a solution of your own isn't! Please be mindful of that.
    – Amar
    Nov 4, 2016 at 6:39

You must log in to answer this question.

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