%% test5.tex
%%
%% This is file `test5.tex', one of a set of five test/example files
%% in the `subfig' package.
%%
%% Copyright © 2003 Steven Douglas Cochran. 
%% 
%% The subfig package may be distributed and/or modified under the
%% conditions of the LaTeX Project Public License, either version 1.2 
%% of this license or (at your option) any later version.  The latest
%% version of this license is in:
%%     http://www.latex-project.org/lppl.txt
%% and version 1.2 or later is part of all distributions of LaTeX 
%% version 1999/12/01 or later.
%%
%% This package consists of the files README, Makefile, subfig.dtx, 
%% and subfig.ins as well as the test/example files test.tex, 
%% test2.tex, test3.tex, test4.tex test5.tex and test6.tex.
%%
%% The subfig package is distributed in the hope that it will be
%% useful, but `as is', WITHOUT WARRANTY OF ANY KIND, either expressed 
%% or implied, including, but not limited to, the implied warranties of
%% MERCHANTABILITY and FITNESS FOR A PARTICULAR PURPOSE.  See the LaTeX
%% Project Public License for more details.

\documentclass{article}

%\usepackage{captcont}
%\usepackage{caption}
%\usepackage{ccaption}

\usepackage{subfig}

%\usepackage{captcont}
%\usepackage{caption}
%\usepackage{ccaption}

\makeatletter
  \renewcommand\abstract[1]{%
    \def\@abstract{%
      \centerline{{\large\bf Abstract}}
      \noindent
      #1}}
  \renewcommand\@maketitle{%
    \newpage
    \null\vfil
    \vskip 60\p@
    \begin{center}%
      {\LARGE \@title \par}%
      \vskip 3em%
      {\large
       \lineskip .75em%
       \begin{tabular}[t]{c}%
         \@author
       \end{tabular}\par}%
      \vskip 1.5em%
      {\large \@date \par}% 
    \end{center}%
    \vskip 2.5em%
    \@abstract
    \vfil\null}%
\makeatother

\newcommand{\figbox}[2][.8in]{%
  \fbox{%
    \vbox to .6in{%
    \vfil
    \hbox to #1{%
      \hfil
      #2%
      \hfil}%
    \vfil}}}

\begin{document}

\title{Subfig Package Test Program Five}
\author{Steven Douglas Cochran\\
        Digital Mapping Laboratory\\
        School of Computer Science\\
        Carnegie-Mellon University\\
        5000 Forbes Avenue\\
        Pittsburgh, PA 15213-3890\\
        USA}
\date{21 December 2003}
\abstract{%
This test checks two things:
\begin{enumerate}
  \item the use of the references within a subfloat; and,
  \item continued floats and subfloats.
\end{enumerate}}
\maketitle
\clearpage

\setcounter{lofdepth}{2}
\listoffigures
\clearpage

\setcounter{lotdepth}{2}
\listoftables
\clearpage

In this test, we verify the ability of the subfigure package to 
handle requests for continued figures and tables (with full support
of the List-of pages and subfigures in continued figures and 
subtables in continued tables).

In addition, by varying the various included packages at the top of
the source, one can check the interaction of the subfigure package 
along with other common packages, such as the \texttt{captcont}, 
\texttt{caption}, and \texttt{ccaption} packages.

First we test the regular figures.  The first figure is
Figure~\ref{fig:First} on page \pageref{fig:First}. The second is
Figure~\ref{fig:SecondA} and appears on pages~\pageref{fig:SecondA},
\pageref{fig:SecondB}, \pageref{fig:SecondC}, and \pageref{fig:SecondD}.

\begin{figure}%
  \begin{center}%
    \figbox[4in]{Regular figure \ref{fig:First}}%
  \end{center}%
  \caption{Regular figure 1}%
  \label{fig:First}%
\end{figure}

\begin{figure}%
  \begin{center}%
    \figbox[4in]{Continued figure \ref{fig:SecondA}A}%
  \end{center}%
  \caption{Continued figure \ref{fig:SecondA}}%
  \label{fig:SecondA}%
\end{figure}

\begin{figure}%
  \ContinuedFloat
  \begin{center}%
    \figbox[4in]{Continued figure \ref{fig:SecondB}B}%
  \end{center}%
  \caption[]{Continued figure \ref{fig:SecondB}}%
  \label{fig:SecondB}%
\end{figure}

\begin{figure}%
  \ContinuedFloat
  \begin{center}%
    \figbox[4in]{Continued figure \ref{fig:SecondC}C}%
  \end{center}%
  \caption[]{Continued figure \ref{fig:SecondC}}%
  \label{fig:SecondC}%
\end{figure}

\begin{figure}%
  \ContinuedFloat
  \begin{center}%
    \figbox[4in]{Continued figure \ref{fig:SecondD}D}
  \end{center}%
  \caption[]{Continued figure \ref{fig:SecondD}}
  \label{fig:SecondD}%
\end{figure}

Then we test the regular tables.  The first table is
Table~\ref{tab:First} on page \pageref{tab:First}. The second is
Table~\ref{tab:SecondA} and appears on pages~\pageref{tab:SecondA},
\pageref{tab:SecondB}, \pageref{tab:SecondC}, and \pageref{tab:SecondD}.

\begin{table}%
  \caption{Regular table 1}%
  \label{tab:First}%
  \begin{center}%
    \figbox[4in]{Regular table 1}%
  \end{center}%
\end{table}

\begin{table}%
  \caption{Continued table \ref{tab:SecondA}}%
  \label{tab:SecondA}%
  \begin{center}%
    \figbox[4in]{Continued table \ref{tab:SecondA}A}%
  \end{center}%
\end{table}

\begin{table}%
  \ContinuedFloat
  \caption[]{Continued table \ref{tab:SecondB}}%
  \label{tab:SecondB}%
  \begin{center}%
    \figbox[4in]{Continued table \ref{tab:SecondB}B}%
  \end{center}%
\end{table}

\begin{table}%
  \ContinuedFloat
  \caption[]{Continued table \ref{tab:SecondC}}%
  \label{tab:SecondC}%
  \begin{center}%
    \figbox[4in]{Continued table \ref{tab:SecondC}C}%
  \end{center}%
\end{table}

\begin{table}%
  \ContinuedFloat
  \caption[]{Continued table \ref{tab:SecondD}}
  \label{tab:SecondD}%
  \begin{center}%
    \figbox[4in]{Continued table \ref{tab:SecondD}D}
  \end{center}%
\end{table}

Next we look at the subfloats in a simple figure.  They are
Figures~\ref{fig:sub1A}, \ref{fig:sub1B}, \ref{fig:sub1C}, and
\ref{fig:sub1D}, which are part of Figure~\ref{fig:sub1} on 
page~\pageref{fig:sub1}.

The continued subfloats are contained in three parts.  The first is
Figure~\ref{fig:sub21} on page~\pageref{fig:sub21} which contains the
Subfigures~\ref{fig:sub2A}, \ref{fig:sub2B}, \ref{fig:sub2C}, and
\ref{fig:sub2D}.
The second is
Figure~\ref{fig:sub22} on page~\pageref{fig:sub22} which contains the
Subfigures~\ref{fig:sub2E}, \ref{fig:sub2F}, \ref{fig:sub2G}, and
\ref{fig:sub2H}.
The third is
Figure~\ref{fig:sub23} on page~\pageref{fig:sub23} which contains the
Subfigures~\ref{fig:sub2I}, \ref{fig:sub2J}, \ref{fig:sub2K}, and
\ref{fig:sub2L}.

\begin{figure}%
  \begin{center}%
    \subfloat[\label{fig:sub1A}]{\figbox{Subfigure \ref{fig:sub1A}}}%
    \hspace{10pt}%
    \subfloat[\label{fig:sub1B}]{\figbox{Subfigure \ref{fig:sub1B}}}\\
    \subfloat[\label{fig:sub1C}]{\figbox{Subfigure \ref{fig:sub1C}}}%
    \hspace{10pt}%
    \subfloat[\label{fig:sub1D}]{\figbox{Subfigure \ref{fig:sub1D}}}%
  \end{center}%
  \vspace{-10pt}%
  \caption{This is a simple figure.}%
  \label{fig:sub1}%
\end{figure}

\begin{figure}%
  \begin{center}%
    \subfloat[\label{fig:sub2A}]{\figbox{Subfigure \ref{fig:sub2A}}}%
    \hspace{10pt}%
    \subfloat[\label{fig:sub2B}]{\figbox{Subfigure \ref{fig:sub2B}}}\\
    \subfloat[\label{fig:sub2C}]{\figbox{Subfigure \ref{fig:sub2C}}}%
    \hspace{10pt}%
    \subfloat[\label{fig:sub2D}]{\figbox{Subfigure \ref{fig:sub2D}}}%
  \end{center}%
  \vspace{-10pt}%
  \caption{This is a continued figure.}%
  \label{fig:sub21}%
\end{figure}
  
\begin{figure}%
  \ContinuedFloat
  \begin{center}%
    \subfloat[\label{fig:sub2E}]{\figbox{Subfigure \ref{fig:sub2E}}}%
    \hspace{10pt}%
    \subfloat[\label{fig:sub2F}]{\figbox{Subfigure \ref{fig:sub2F}}}\\
    \subfloat[\label{fig:sub2G}]{\figbox{Subfigure \ref{fig:sub2G}}}%
    \hspace{10pt}%
    \subfloat[\label{fig:sub2H}]{\figbox{Subfigure \ref{fig:sub2H}}}%
  \end{center}%
  \vspace{-10pt}%
  \caption[]{This is a continued figure (cont.)}%
  \label{fig:sub22}%
\end{figure}

\begin{figure}%
  \ContinuedFloat
  \begin{center}%
    \subfloat[\label{fig:sub2I}]{\figbox{Subfigure \ref{fig:sub2I}}}%
    \hspace{10pt}%
    \subfloat[\label{fig:sub2J}]{\figbox{Subfigure \ref{fig:sub2J}}}\\
    \subfloat[\label{fig:sub2K}]{\figbox{Subfigure \ref{fig:sub2K}}}%
    \hspace{10pt}%
    \subfloat[\label{fig:sub2L}]{\figbox{Subfigure \ref{fig:sub2L}}}%
  \end{center}%
  \vspace{-10pt}%
  \caption[]{This is a continued figure (cont.)}%
  \label{fig:sub23}%
\end{figure}

Next we look at the subfloats in a simple table environment.  They are
Tables~\ref{tab:sub1A}, \ref{tab:sub1B}, \ref{tab:sub1C}, and
\ref{tab:sub1D}, which are part of Table~\ref{tab:sub1} on 
page~\pageref{tab:sub1}.

The continued subfloats are contained in three parts.  The first is
Table~\ref{tab:sub21} on page~\pageref{tab:sub21} which contains the
Subtables~\ref{tab:sub2A}, \ref{tab:sub2B}, \ref{tab:sub2C}, and
\ref{tab:sub2D}.
The second is
Table~\ref{tab:sub22} on page~\pageref{tab:sub22} which contains the
Subtables~\ref{tab:sub2E}, \ref{tab:sub2F}, \ref{tab:sub2G}, and
\ref{tab:sub2H}.
The third is
Table~\ref{tab:sub23} on page~\pageref{tab:sub23} which contains the
Subtables~\ref{tab:sub2I}, \ref{tab:sub2J}, \ref{tab:sub2K}, and
\ref{tab:sub2L}.

\begin{table}%
  \caption{This is a simple table.}%
  \label{tab:sub1}%
  \begin{center}%
    \subfloat[\label{tab:sub1A}]{\figbox{Subtable \ref{tab:sub1A}}}%
    \hspace{10pt}%
    \subfloat[\label{tab:sub1B}]{\figbox{Subtable \ref{tab:sub1B}}}\\
    \subfloat[\label{tab:sub1C}]{\figbox{Subtable \ref{tab:sub1C}}}%
    \hspace{10pt}%
    \subfloat[\label{tab:sub1D}]{\figbox{Subtable \ref{tab:sub1D}}}%
  \end{center}%
\end{table}

\begin{table}%
  \caption{This is a continued table.}%
  \label{tab:sub21}%
  \begin{center}%
    \subfloat[\label{tab:sub2A}]{\figbox{Subtable \ref{tab:sub2A}}}%
    \hspace{10pt}%
    \subfloat[\label{tab:sub2B}]{\figbox{Subtable \ref{tab:sub2B}}}\\
    \subfloat[\label{tab:sub2C}]{\figbox{Subtable \ref{tab:sub2C}}}%
    \hspace{10pt}%
    \subfloat[\label{tab:sub2D}]{\figbox{Subtable \ref{tab:sub2D}}}%
  \end{center}
\end{table}

\begin{table}%
  \ContinuedFloat
  \caption[]{This is a continued table (cont.)}%
  \label{tab:sub22}%
  \begin{center}%
    \subfloat[\label{tab:sub2E}]{\figbox{Subtable \ref{tab:sub2E}}}%
    \hspace{10pt}%
    \subfloat[\label{tab:sub2F}]{\figbox{Subtable \ref{tab:sub2F}}}\\
    \subfloat[\label{tab:sub2G}]{\figbox{Subtable \ref{tab:sub2G}}}%
    \hspace{10pt}%
    \subfloat[\label{tab:sub2H}]{\figbox{Subtable \ref{tab:sub2H}}}%
  \end{center}%
\end{table}

\begin{table}%
  \ContinuedFloat
  \caption[]{This is a continued table (cont.)}%
  \label{tab:sub23}%
  \begin{center}%
    \subfloat[\label{tab:sub2I}]{\figbox{Subtable \ref{tab:sub2I}}}%
    \hspace{10pt}%
    \subfloat[\label{tab:sub2J}]{\figbox{Subtable \ref{tab:sub2J}}}\\
    \subfloat[\label{tab:sub2K}]{\figbox{Subtable \ref{tab:sub2K}}}%
    \hspace{10pt}%
    \subfloat[\label{tab:sub2L}]{\figbox{Subtable \ref{tab:sub2L}}}%
  \end{center}%
\end{table}

\end{document}
