4

I want to include "List of Figures - Continued" on the second page of the list of figures (LOF). Following this page, How to add some text to every page of the TOC?, I am using the \afterpage command. This works well except when there is only one figure on the second page. Then, the "List of Figures - Continued" is placed on the page after the second LOF page. Below is a minimal code that reproduces the error. When the number of figures is 46, everything works well. When the number of figures is 45, the "List of Figures - Continued" text is put on page 3 instead of page 2.

\documentclass{article}

\usepackage{graphicx}
\usepackage{afterpage}

% Command to add "List of figures - Continued"
\newcommand{\contheadingadv}[3][0]{%
  \afterpage{{\normalfont\centering\uppercase{#2~-~Continued}\\[1em]#3\hfill Page\\[1.5em]}}
}

\begin{document}

% Create list of figures
\listoffigures
\addtocontents{lof}{\contheadingadv[2]{List of figures}{Figure}}
\clearpage

% Loop to create figures
\newcount\loopcount
\loopcount 46   % Works with 46, doesn't work with 45 !!!!!!!!!!
\loop 
  \begin{figure}[h!]
    \centering
    \includegraphics[width=3cm]{example-image-a}
    \caption{Figure}
  \end{figure} 
  \clearpage
\advance\loopcount-1
\ifnum\loopcount>0
\repeat 

\end{document}
MOwkes
  • 63

2 Answers2

2

For reference here is a complete minimal working example using the input from MT San:

\documentclass{article}
\usepackage{graphicx}

\makeatletter

% Define list of figures environment (sets up continued heading and calls list@of@figs)
\def\listoffigures{
  \clearpage

  % Define header for continued pages
  \def\headmark{\vbox{
      \hbox to \textwidth{\large\bfseries\hfil LIST OF FIGURES (Continued) \hfil}
      \vspace{12pt}
      \hbox to \textwidth{\normalsize\bfseries\underbar{FIGURE}\hfil\underbar{PAGE}}}}
  \pagestyle{continued}

  % Header on first page
  \thispagestyle{plain}
  \hbox to \textwidth{\large\bfseries\hfil LIST OF FIGURES \hfil}
  \vspace{12pt}
  \hbox to \textwidth{\normalsize\bfseries\underbar{FIGURE}\hfil\underbar{PAGE}}
  \vspace{0.3cm}

  % List of Figures
  \@starttoc{lof}

  \clearpage
  \pagestyle{plain}
}

% Continued headings
\def\ps@continued{
  \def\@oddhead{\headmark}
  \let\@evenhead\@oddhead
}
\makeatother


\begin{document}

\listoffigures

\newcount\loopcount
\loopcount 150

\loop
\begin{figure}[h!]
  \centering
  \includegraphics[width=3cm]{example-image-a}
  \caption{Figure}
\end{figure} 
\clearpage
\advance\loopcount-1
\ifnum\loopcount>0
\repeat 

\end{document}
MOwkes
  • 63
1

Such long list of figures are generally encountered in theses. The code snippet below is used by many universities around the globe in their .cls files. I hope this helps.

\def\listoffigures{
   \clearpage
   \typeout{LIST OF FIGURES.}
   \def\headmark{\vbox{
        \hbox to \textwidth{\large\bfseries\hfil LIST OF FIGURES
           (Continued) \hfil}
        \vspace{\innerheadskip}
        \hbox to \textwidth{\normalsize\bfseries
           \underbar{FIGURE}\hfil\underbar{PAGE}}}}
   \pagestyle{continued}
   \list@of@figs
   }
MTSan
  • 220
  • Do you have a complete .cls file that contains the code above? I'm trying to make it work with my minimal case but have not succeeded. – MOwkes Apr 04 '16 at 19:41
  • Very probably the problem is previously defined variables in the class file such as "\innerheadskip" or "\normalsize". You may rewrite those parts. I have copied this snippet from University of Chicago's class file from https://github.com/mikispag/UICThesis-Template/blob/master/uicthesis.cls Still, I'm sure if you google it, you can find many similar class files all around the world. My institution was using a similar rule a few years ago, then they dropped it. I was searching for that class file, then I encounter this one in Google. :) – MTSan Apr 04 '16 at 21:32
  • For reference here is a working minimal code – MOwkes Apr 04 '16 at 22:50