summaryrefslogtreecommitdiff
path: root/macros/latex/contrib/subfig/test3.tex
blob: 0b548d0533b737c251391126feb540889d7941bb (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
%% test3.tex
%%
%% This is file `test3.tex', one of a set of several test/example files
%% in the `subfig' package.
%%
%% Copyright © 2003, 2004, 2005 Steven Douglas Cochran.
%% 
%% This work (the subfig package) may be distributed and/or modified 
%% under the conditions of the LaTeX Project Public License, either 
%% version 1.3 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.3 or later is part of all distributions of LaTeX
%% version 2003/12/01 or later.
%%
%% This work has the LPPL maintenance status "author-maintained".
%% 
%% This Current Maintainer of this work is Steven Douglas Cochran.
%%
%% This work consists of all files listed under "MANIFEST" in the
%% README file distributed with the subfig package.

\documentclass{article}

\usepackage{fullpage}
\usepackage[config=altsf]{subfig}
\usepackage{booktabs}

\newdimen\testtemp
\newcommand{\ru}[1]{%
  \testtemp #1%
  \advance\testtemp .5pt%
  \divide\testtemp 2%
  \hbox to \testtemp{\leaders\hbox to 1mm{%
    \vrule height1mm depth0pt width.25pt\hfil}\hfil}%
  \hbox to 0pt{\hss\vrule height3mm depth0pt width.25pt\hss}%
  \hbox to \testtemp{\leaders\hbox to 1mm{%
    \hfil\vrule height1mm depth0pt width.25pt}\hfil}}

\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

\def\textfraction{.1}
\fboxsep=-\fboxrule
\newcommand{\figbox}[1]{%
  \fbox{%
    \vbox to 1in{%
      \vfil
      \hbox to 2in{%
        \parbox{2in}{%
          \centering
          #1}}%
      \vfil
      \vbox to 0pt{%
        \vss
        \hbox to 2in{%
          \hfil
          \ru{1.1in}%
          \hfil}}}}}

\begin{document}

\title{Subfig Package Test Program Three}
\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 three things:
\begin{enumerate}
  \item spacing is reduced at the start of a minipage or between
        horizontal layers of subfloats;
  \item extra blank spaces; and,
  \item together with initialization options, that the subfig.cfg
        file provides approximate compatibility with the old
        {\bf subfigure} package.
\end{enumerate}}
\maketitle
\clearpage

\setcounter{lofdepth}{2}
\listoffigures
\newpage

\section{Reference Test}

\begin{figure}%
  \centering
  \subfigure{%
    \label{fig:A}%
    \figbox{SUBFIGURE ONE:\\
            (no opt)}}
  \quad
  \subfigure[]{%
    \label{fig:B}%
    \figbox{SUBFIGURE TWO:\\
            (empty opt)}}\\
%
  \subfigure[Subfigure Three.]{%
    \label{fig:C}%
    \figbox{SUBFIGURE THREE:\\
            (opt)}}
  \quad
  \subfigure[][Subfigure Four.]{%
    \label{fig:D}%
    \figbox{SUBFIGURE FOUR:\\
            (empty opt and opt)}}
  \quad
  \subfigure[][]{%
    \label{fig:E}%
    \figbox{SUBFIGURE FIVE:\\
            (both empty opt)}}\\
%
  \subfigure[The Sixth Subfigure.][Subfigure Six.]{%
    \label{fig:F}%
    \figbox{SUBFIGURE SIX:\\
            (both opt)}}
  \quad
  \subfigure[The Seventh Subfigure][]{%
    \label{fig:G}%
    \figbox{SUBFIGURE SEVEN:\\
            (opt and empty opt)}}
%
  \caption{Optional argument test.}%
  \label{fig:main}%
\end{figure}

The figure~\ref{fig:main} on page~\pageref{fig:main} is composed
of the seven subfigures~\subref{fig:A} (aka: \ref{fig:A}),
\subref{fig:B} (aka: \ref{fig:B}), \subref{fig:C} (aka: \ref{fig:C}),
\subref{fig:D} (aka: \ref{fig:D}), \subref{fig:E} (aka: \ref{fig:E}),
\subref{fig:F} (aka: \ref{fig:F}), and \subref{fig:G} (aka:
\ref{fig:G}).

Note that the captions are correctly handled on the List-of-Figures
page and under the subfigures according to the form of the subfigure
command (see Table~\ref{tab:calling}).

\begin{table}[b]
  \centering
  \caption{{\tt ${\tt\backslash}$subfigure} calling arguments.}
  \label{tab:calling}
  \begin{tabular}{llc}                                      \\ \toprule
    {\bf Subfigure Command}
                      & {\bf LoF/LoT}
                            & \multicolumn{1}{l}{\bf Subfigure Caption}
                                                            \\ \midrule
    \verb/\subfigure/\{\dots fig\dots\}
                      &     &                               \\
    \verb/\subfigure/[~]\{\dots fig\dots\}
                      & (b)\ \ . . . . . . . . . .  
                            & (b)                           \\
    \verb/\subfigure/[Subcaption.]\{\dots fig\dots\}
                      & (c) Subcaption. . . .
                            & (c) Subcaption.               \\
    \verb/\subfigure/[\space][Subcaption.]\{\dots fig\dots\}
                      &     & (d) Subcaption.               \\
    \verb/\subfigure/[\space][\space]\{\dots fig\dots\}
                      &     & (e)                           \\
    \verb/\subfigure/[List\_entry.][Subcaption.]\{\dots fig\dots\}
                      & (f) List\_entry. . . .
                            & (f) Subcaption.               \\
    \verb/\subfigure/[List\_entry.][~]\{\dots fig\dots\}
                      & (g) List\_entry. . . .
                            & (g)                           \\ \bottomrule
  \end{tabular}
\end{table}

\enlargethispage{12pt}
\section{Centering Test}

Note that figures~\ref{fig:B}, \ref{fig:E} and \ref{fig:G} are centered.
This means that \verb|\subfigcapskip| has been set to zero and is not
offsetting the simple label to the left.  Also the remaining captioned
subfigures (figures~\ref{fig:C}, \ref{fig:D}, and \ref{fig:F}) should
have centered labels.


\end{document}