%% test4.tex
%%
%% This is file `test4.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[config]{subfig}
% option for use with pdflatex
%\usepackage{hyperref}
%\usepackage[draft]{hyperref}
\usepackage[pdftex]{hyperref}
\usepackage{makeidx}

% reset the index environment to print the index section in the TOC.
\makeatletter
\renewenvironment{theindex}{%
    \if@twocolumn
      \@restonecolfalse
    \else
      \@restonecoltrue
    \fi
    \columnseprule \z@
    \columnsep 35\p@
    \twocolumn[\section{\indexname}]%
    \@mkboth{\MakeUppercase\indexname}{\MakeUppercase\indexname}%
    \thispagestyle{plain}%
    \parindent\z@
    \parskip\z@ \@plus .3\p@\relax
    \let\item\@idxitem
  }{%
    \if@restonecol
      \onecolumn
    \else
      \clearpage
    \fi
  }
  \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

\makeindex

\begin{document}

\title{Subfig Package Test Program Four}
\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 the interaction with the {\bf hyperref} package.}
\maketitle
\clearpage

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

\section{Test of subfigure}

There is a \index{test}test \index{figure}figure \ref{fig:test} with
\index{subfigure}subfigures \ref{fig:testsub1} and \ref{fig:testsub2}.

Also referenced with \ref{fig:test}\subref{fig:testsub1} and
\ref{fig:test}\subref{fig:testsub2}.

The chief purpose of this test is to check and verify the interaction
between the subfigure package and the hyperref package.


\begin{figure}[!ht]
    \centering
    \unitlength .5cm
    \subfigure[SubFig1]
    { \label(SubFig1){fig:testsub1}
        \begin{picture}(10,10)
            \put(0,0){\line(1,1){10}}
        \end{picture}
    } \qquad
    \subfigure[SubFig2]
    { \label{fig:testsub2}
        \begin{picture}(10,10)
            \put(0,10){\line(1,-1){10}}
        \end{picture}
    } \\
    \caption{Testfigures}
    \label{fig:test}
\end{figure}

\clearpage

\printindex

\end{document}

