summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/source/latex/caption/subcaption.dtx
diff options
context:
space:
mode:
authorNorbert Preining <preining@logic.at>2007-12-25 09:56:00 +0000
committerNorbert Preining <preining@logic.at>2007-12-25 09:56:00 +0000
commit49de519af20c652c3b3cfe9ba1dd4df1de06bde8 (patch)
treee97133a8a2f4e7b1924d35a76d87837d23d918c9 /Master/texmf-dist/source/latex/caption/subcaption.dtx
parent9d2ebf24951017e4a930651f26e118128d9003a1 (diff)
caption update 07-12-25
git-svn-id: svn://tug.org/texlive/trunk@5898 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/source/latex/caption/subcaption.dtx')
-rw-r--r--Master/texmf-dist/source/latex/caption/subcaption.dtx868
1 files changed, 868 insertions, 0 deletions
diff --git a/Master/texmf-dist/source/latex/caption/subcaption.dtx b/Master/texmf-dist/source/latex/caption/subcaption.dtx
new file mode 100644
index 00000000000..0aa97c2b03b
--- /dev/null
+++ b/Master/texmf-dist/source/latex/caption/subcaption.dtx
@@ -0,0 +1,868 @@
+% \iffalse meta-comment
+%
+% This is file `subcaption.dtx'.
+%
+% Copyright (C) 2007 Axel Sommerfeldt (caption@sommerfee.de)
+%
+% --------------------------------------------------------------------------
+%
+% This work 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 "maintained".
+%
+% This Current Maintainer of this work is Axel Sommerfeldt.
+%
+% This work consists of the files caption.ins, caption.dtx, caption2.dtx,
+% ltcaption.dtx, and subcaption.dtx, the derived files caption.sty,
+% caption2.sty, caption3.sty, ltcaption.sty, and subcaption.sty, and the
+% user manuals caption-deu.tex, caption-eng.tex, and caption-rus.tex.
+%
+% \fi
+% \CheckSum{144}
+%
+% \iffalse
+%<*driver>
+\NeedsTeXFormat{LaTeX2e}[1994/12/01]
+\ProvidesFile{subcaption.drv}[2007/12/06 v0.3 Adds a sub-caption feature to the caption package]
+\hbadness=9999 \newcount\hbadness \hfuzz=74pt % Make TeX shut up.
+%\errorcontextlines=3
+%
+\documentclass{ltxdoc}
+\setlength\parindent{0pt}
+\setlength\parskip{\smallskipamount}
+%
+\usepackage{ifpdf}
+\ifpdf
+ \usepackage{mathptmx,courier}
+ \usepackage[scaled=0.90]{helvet}
+ \addtolength\marginparwidth{15pt}
+\fi
+%
+\usepackage{array,slashbox}
+\IfFileExists{cat.eps}%
+ {\usepackage{graphicx}}%
+ {\IfFileExists{test/tlc2/cat.eps}%
+ {\usepackage{graphicx}\graphicspath{{test/tlc2/}}}%
+ {\usepackage[demo]{graphicx}}}
+%
+\usepackage{hypdoc}
+\ifpdf\usepackage{hypdestopt}\fi
+\hypersetup{pdfkeywords={LaTeX, package, subcaption},pdfstartpage={},pdfstartview={}}
+%
+\usepackage{caption}[2007/12/06] % needs v3.1f or newer
+\usepackage{subcaption}[2007/12/06]
+\DeclareCaptionSubType*[arabic]{table}
+\captionsetup[subtable]{labelformat=simple,labelsep=colon}
+%
+\newcommand*\purerm[1]{{\upshape\mdseries\rmfamily #1}}
+\newcommand*\puresf[1]{{\upshape\mdseries\sffamily #1}}
+\newcommand*\purett[1]{{\upshape\mdseries\ttfamily #1}}
+\let\package\puresf
+\let\env\purett \let\opt\purett
+%
+\newcommand*\csmarg[1]{\texttt{\char`\{#1\char`\}}}
+\newcommand*\csoarg[1]{\texttt{\char`\[#1\char`\]}}
+\newcommand*\version[2][]{$v#2$}
+\newcommand*\x{\discretionary{-}{}{}}
+\newcommand*\xx{\discretionary{}{}{}}
+%
+\usepackage{marvosym}
+\newcommand*\MARGINSYM[1]{\hskip 1sp \marginpar{\raggedleft\textcolor{blue}{{#1}}}}
+\newenvironment{info}{\par\bigskip\csname info*\endcsname}{\csname endinfo*\endcsname}
+\newenvironment{info*}%
+ {\small
+ \MARGINSYM{\vbox to \ht\strutbox{\LARGE\Info}}%
+ \ignorespaces}%
+ {\par}
+%
+\begin{document}
+ \DocInput{subcaption.dtx}
+\end{document}
+%</driver>
+% \fi
+%
+% \let\subsectionautorefname\sectionautorefname
+% \let\subsubsectionautorefname\sectionautorefname
+%
+% \def\thispackage{the \package{subcaption} package}
+% \def\Thispackage{The \package{subcaption} package}
+%
+% \newcommand\NEWfeature{\NEW{New feature}}
+% \newcommand\NEWdescription{\NEW{New description}}
+%
+% \makeatletter
+% \newcommand*\Ref{\@ifstar{\@Ref\ref}{\@Ref\autoref}}
+% \newcommand*\@Ref[2]{#1{#2}: \textit{\nameref{#2}}}
+% \makeatother
+% \newcommand*\See[1]{\nopagebreak{\small (See #1)}}
+%
+% \GetFileInfo{subcaption.drv}
+% \let\docdate\filedate
+% \GetFileInfo{subcaption.sty}
+%
+% \title{\texorpdfstring{\Thispackage\thanks{%^^A
+% This package has version number \fileversion, last revised \filedate.}}%^^A
+% {The subcaption package}}
+% \author{Axel Sommerfeldt\\
+% \href{mailto:caption@sommerfee.de}{\texttt{caption@sommerfee.de}}}
+% \date{\docdate}
+% \maketitle
+%
+% \begin{abstract}
+% This tiny package demonstrates the sub-caption feature of the
+% \package{caption} package.
+% \end{abstract}
+%
+% \subsection*{Introduction}
+% \begin{info*}
+% Prepared with either |\Declare|\x|Caption|\x|Sub|\x|Type| (offered by the
+% \package{caption} package) or |\new|\x|sub|\x|float| (offered by the
+% \package{subfig} package), the caption package option |subtype| becames
+% available, causing |\caption| to typeset a sub-caption instead of an
+% ordinary one.\par
+% This package demonstrates the usage of |\Declare|\x|Caption|\x|Sub|\x|Type|,
+% |\caption|\x|setup{sub|\x|type}|, and the internal hook
+% |\caption@sub|\x|type|\x|hook|.
+% \end{info*}
+%
+% \setcounter{tocdepth}{2}
+% \tableofcontents
+%
+% \vfill
+% \emph{Please note:}
+% This package is incompatible with the \package{subfigure} and \package{subfig}
+% packages.
+% \medskip
+%
+% \clearpage
+% \section{The user interface}
+%
+% Just load this package after the \package{caption} package, e.g.:
+% \begin{quote}
+% |\usepackage|\oarg{options}|{caption}|\\
+% |\usepackage|\oarg{options}|{subcaption}|
+% \end{quote}
+% The options for \thispackage\ are the same ones as for the \package{caption}
+% package, but specify settings which are used for sub-captions
+% \emph{additionally}.
+% In fact
+% \begin{quote}
+% |\usepackage|\oarg{options}|{subcaption}|
+% \end{quote}
+% is identical to
+% \begin{quote}
+% |\usepackage{subcaption}|\\
+% |\captionsetup[sub]|\marg{options}
+% \end{quote}
+%
+% \bigskip
+%
+% The default settings for |sub|captions are:
+% \begin{quote}
+% |margin=0pt,font+=small,labelformat=parens,labelsep=space,|\\
+% |skip=6pt,list=false,hypcap=false|
+% \end{quote}
+%
+% Options specified with |\usepackage[|\ldots|]{subcaption}| and
+% |\captionsetup[sub]{|\ldots|}| will override the ones specified by
+% |\captionsetup{|\ldots|}| and |\captionsetup[figure]{|\ldots|}|,
+% but are again overwritten by |\captionsetup[subfigure]{|\ldots|}|
+% (same for `table'). So finally we have the following order how
+% settings for subcaptions are applied:
+% \begin{enumerate}
+% \item global settings
+% {\small(|\usepackage[|\ldots|]{caption}| and |\captionsetup{|\ldots|}|)}
+% \item environmental settings
+% {\small(|\captionsetup[figure|\emph{ -or- }|table]{|\ldots|}|)}
+% \item local settings
+% {\small(|\captionsetup{|\ldots|}| inside |figure| or |table| environment)}
+% \item default `sub' settings
+% {\small(|margin=0pt,font+=small,|\ldots, see above)}
+% \item custom `sub' settings
+% {\small(|\usepackage[|\ldots|]{subcaption}| and |\captionsetup[sub]{|\ldots|}|)}
+% \item environmental `sub' settings
+% {\small(|\captionsetup[subfigure|\emph{ -or- }|subtable]{|\ldots|}|)}
+% \item local `sub' settings
+% {\small(|\captionsetup{|\ldots|}| inside |subfigure| or |subtable|)}
+% \end{enumerate}
+% An example:
+% \begin{quote}
+% |\usepackage[labelsep=quad,indention=10pt]{caption}|\\
+% |\usepackage[labelfont=bf,list=true]{subcaption}|\\
+% |\captionsetup[table]{textfont=it,position=top}|\\
+% |\captionsetup[subtable]{textfont=sf}|
+% \end{quote}
+% causes the captions inside |subtable| environments to be typeset with
+% the settings
+% \begin{quote}
+% |indention=10pt,position=top,margin=0pt,font=small,|\\
+% |labelformat=parens,labelsep=space,skip=6pt,hypcap=false,|\\
+% |labelfont=bf,list=true,textfont=sf|\quad.
+% \end{quote}
+%
+% \vfill\clearpage
+% \subsection{The \cs{subcaption} command}
+%
+% \DescribeMacro\subcaption
+% The easiest and most flexible method to apply a sub-caption is by using the
+% |\subcaption| command. Its syntax is analogous to the one of the |\caption|
+% command and shares its features:
+% \begin{quote}
+% |\subcaption|\oarg{list entry}\marg{heading}\\
+% |\subcaption*|\marg{heading}
+% \end{quote}
+% Please note that the |\subcaption| command \emph{must} be applied inside
+% its own box or environment.
+%
+% An example:
+% \begin{quote}
+% |\begin{figure}|\\
+% | \begin{minipage}[b]{.5\linewidth}|\\
+% | \centering\large A|\\
+% | \subcaption{A subfigure}\label{fig:1a}|\\
+% | \end{minipage}%|\\
+% | \begin{minipage}[b]{.5\linewidth}|\\
+% | \centering\large B|\\
+% | \subcaption{Another subfigure}\label{fig:1b}|\\
+% | \end{minipage}|\\
+% | \caption{A figure}\label{fig:1}|\\
+% |\end{figure}|
+% \end{quote}
+% gives the result:
+% \par\bigskip
+% \noindent\begin{minipage}{\linewidth}
+% \captionsetup{type=figure}
+% \begin{minipage}[b]{.5\linewidth}
+% \centering\large A
+% \subcaption{A subfigure}\label{fig:1a}
+% \end{minipage}%^^A
+% \begin{minipage}[b]{.5\linewidth}
+% \centering\large B
+% \subcaption{Another subfigure}\label{fig:1b}
+% \end{minipage}
+% \caption{A figure}\label{fig:1}
+% \end{minipage}
+%
+% \bigskip
+%
+% \begin{info}
+% Actually the |\subcaption| command is just a simple combination of
+% |\caption|\x|setup{sub|\x|type*}| and |\caption|.
+% Analogous to the |type| option, the |subtype| option (both offered by the
+% \package{caption} package) sets the sub-type of the box or environment
+% (so |\caption| will typeset a sub-caption instead of an ordinary one),
+% places a proper hyperlink anchor (non-starred variant only),
+% executes options associated with the sub-type etc.\iffalse\footnote{\emph{Note:}
+% Since \cs{captionsetup}\csmarg{subtype} is part of the \package{caption}
+% package, it works in coorparation with the \package{subfig} package as
+% well.}\fi
+% \end{info}
+%
+% \vfill\clearpage
+% \subsection{The subfigure \& subtable environments}
+%
+% \DescribeEnv{subfigure}
+% \DescribeEnv{subtable}
+% After loading \thispackage\ the new environments |subfigure| and
+% |subtable| are available, which have the same (optional \& mandatory)
+% arguments as the |minipage| environment.
+% Inside these environments you use the ordinary |\caption| command
+% for typesetting captions. So this example is identical to the
+% last one, but uses the |subfigure| environment:
+% \begin{quote}
+% |\begin{figure}|\\
+% | \begin{|\textcolor{blue}{\texttt{subfigure}}|}[b]{.5\linewidth}|\\
+% | \centering\large A|\\
+% | |\textcolor{blue}{\cs{caption}}|{A subfigure}\label{fig:1a}|\\
+% | \end{|\textcolor{blue}{\texttt{subfigure}}|}%|\\
+% | \begin{|\textcolor{blue}{\texttt{subfigure}}|}[b]{.5\linewidth}|\\
+% | \centering\large B|\\
+% | |\textcolor{blue}{\cs{caption}}|{Another subfigure}\label{fig:1b}|\\
+% | \end{|\textcolor{blue}{\texttt{subfigure}}|}|\\
+% | \caption{A figure}\label{fig:1}|\\
+% |\end{figure}|
+% \end{quote}
+% Using the |subfigure| or |subtable| environment instead of |\subcaption|
+% has two (little) advantages:
+% \begin{itemize}
+% \item You can override the setttings for a specific subcaption
+% with a |\captionsetup| inside the |subfigure| or |subtable| environment, e.g.:
+% \begin{quote}
+% \ldots\\
+% |\begin{subfigure}[b]{.5\linewidth}|\\
+% | \centering\large A|\\
+% | |\textcolor{blue}{\cs{captionsetup}\csmarg{skip=3pt}}\\
+% | \caption{A subfigure}\label{fig:1a}|\\
+% |\end{subfigure}|\\
+% \ldots
+% \end{quote}
+% \item Hyperlinks pointing to this subfigure will jump to the beginning
+% of the subfigure, and not to the caption of the subfigure
+% (if |hypcap=true| is set for sub-captions).
+% \See{\Ref{hypcap}}
+% \end{itemize}
+%
+% \bigskip
+%
+% \begin{info}
+% The |subfigure| \& |subtable| environments are just simple minipage
+% environments with |\caption|\x|setup|\xx|{subtype}| as first contents line.
+% These environments are defined with the help of
+% |\caption@For{subtypelist}|, which executes code for every sub-type
+% declared with |\DeclareCaptionSubType|.
+% \end{info}
+%
+% \vfill\clearpage
+% \subsection{The \cs{subcaptionbox} command}
+%
+% \DescribeMacro\subcaptionbox
+% A more powerful (but less flexible) way of setting sub-figures is
+% offered by the |\subcaptionbox| command. Its syntax is:
+% \begingroup
+% \leftmargini=12pt
+% \begin{quote}
+% |\subcaptionbox|\oarg{list entry}\marg{heading}\oarg{width}\oarg{inner-pos}\marg{contents}\\
+% |\subcaptionbox*|\marg{heading}\oarg{width}\oarg{inner-pos}\marg{contents}
+% \end{quote}
+% \endgroup
+% \begin{small}
+% The arguments \meta{list entry} \& \meta{heading} will be used for
+% typesetting the |\caption|.\par
+% \meta{width} is the width of the resulting |\parbox|; the default value is
+% the width of the contents.\par
+% \meta{inner-pos} specifies how the contents will be justified inside the
+% resulting |\parbox|;
+% it can be either `c' (for |\centering|), `l' (for |\raggedright|),
+% `r' (for |\raggedleft|), or `s' (for no special justification).
+% The default is `c'.
+% (But you can use any justification defined with
+% |\DeclareCaptionJustification| as well, e.g.~`|centerlast|'.)
+% \end{small}
+%
+% \bigskip
+%
+% Using |\subcaptionbox|, the baseline of the resulting box will be placed
+% right between contents and heading, so usually you don't have to care about the
+% vertical alignment of the sub-figures for yourself.
+% Also the hyperlink anchor is placed properly with respect to the |hypcap=|
+% setting.
+%
+% One example:
+% \begin{quote}
+% |\begin{figure}|\\
+% | \centering|\\
+% | \subcaptionbox{A cat\label{cat}}|\\
+% | {\includegraphics{cat}}|\\
+% | \subcaptionbox{An elephant\label{elephant}}|\\
+% | {\includegraphics{elephant}}|\\
+% | \caption{Two animals}\label{animals}|\\
+% |\end{figure}|
+% \end{quote}
+% gives the result:\par
+% \noindent\begin{minipage}{\linewidth}
+% \captionsetup{type=figure}
+% \centering
+% \subcaptionbox{A cat\label{cat}}
+% {\includegraphics[width=30pt]{cat}}
+% \subcaptionbox{An elephant\label{elephant}}
+% {\includegraphics[width=.4\textwidth]{elephant}}
+% \caption[Two animals]{Two animals~\footnotemark}\label{animals}
+% \end{minipage}
+% \footnotetext{The pictures were taken with permission from the
+% \LaTeX\ Companion\cite{TLC2} examples.}
+%
+% \bigskip
+%
+% As you see the result is not satisfying;
+% the caption below the cat looks ugly because of the small width of the
+% graphic. This can be solved by using the optional arguments of |\captionbox|,
+% increasing the width of the resulting box:
+% \begin{quote}
+% | |\ldots\\
+% | \subcaptionbox{A cat\label{cat}}|\\
+% | [2.5cm]{\includegraphics{cat}}|\\
+% | |\ldots
+% \end{quote}
+% \noindent\begin{minipage}{\linewidth}
+% \captionsetup{type=figure}
+% \centering
+% \subcaptionbox{A cat\label{cat2}}
+% [2.5cm]{\includegraphics[width=30pt]{cat}}
+% \subcaptionbox{An elephant\label{elephant2}}
+% {\includegraphics[width=.4\textwidth]{elephant}}
+% \caption{Two animals}\label{animals2}
+% \end{minipage}
+%
+% \bigskip
+%
+% Furthermore the main caption, which is centered with respect to the
+% |\textwidth|, looks mis-aligned with respect to the sub-captions.
+% This can (again) be solved by using the optional arguments of |\captionbox|,
+% giving both boxes the same width, for example:
+% \begin{quote}
+% | |\ldots\\
+% | \subcaptionbox{A cat\label{cat}}|\\
+% | [.4\linewidth]{\includegraphics{cat}}%|\\
+% | \subcaptionbox{An elephant\label{elephant}}|\\
+% | [.4\linewidth]{\includegraphics{elephant}}|\\
+% | |\ldots
+% \end{quote}
+% \noindent\begin{minipage}{\linewidth}
+% \captionsetup{type=figure}
+% \centering
+% \subcaptionbox{A cat\label{cat3}}
+% [.4\linewidth]{\includegraphics[width=39.34724pt]{cat}}%^^A
+% \subcaptionbox{An elephant\label{elephant3}}
+% [.4\linewidth]{\includegraphics[width=.4\textwidth]{elephant}}
+% \caption{Two animals}\label{animals3}
+% \end{minipage}
+%
+% \bigskip
+%
+% \begin{info}
+% The |\subcaptionbox| is a |\parbox| with |\caption|\x|setup|\xx|{subtype}|
+% as first contents line. \iffalse See implementation for details.\fi
+% \end{info}
+%
+% \vfill\clearpage
+% \subsection{The \cs{subref} command}
+%
+% While |\ref|\marg{key} (and |\ref*|\marg{key}, if the \package{hyperref}
+% package is used) usually gives a combined result representing the main
+% caption counter and the sub-caption one, it is sometimes useful to have
+% a reference to the sub-caption only. For this purpose you can use
+% \begin{quote}
+% |\subref|\marg{key}\\
+% |\subref*|\marg{key}~\footnote{%^^A
+% Like \cs{ref*}, \cs{subref*} is only available if the \package{hyperref}
+% package\cite{hyperref} is used.}%^^A
+% \qquad.
+% \end{quote}
+% So for example |\ref{cat}| gives the result `\ref{cat}' but |\subref{cat}|
+% gives `\subref{cat}'.
+%
+% \begin{small}
+% \emph{Note:} If the sub-caption was defined with the starred variant
+% |\DeclareCaptionSubType*|, both |\ref| and |\subref| gives the same result.
+% \end{small}
+%
+% \begin{info}
+% The |\subref| command demonstrates the usage of |\caption@subtypehook|
+% which will be called during |\captionsetup{subtype}|.
+% \end{info}
+%
+% \iffalse\vfill\clearpage\fi
+% \subsection{The \cs{DeclareCaptionSubType} command}
+%
+% \DescribeMacro\DeclareCaptionSubType
+% For using the sub-caption feature of the \package{caption} package some
+% commands and counters must be prepared. This is done with~\footnote{%^^A
+% \cs{newsubfloat} offered by the \package{subfig} package\cite{subfig}
+% could be used for this purpose as well.}
+% \begin{quote}
+% |\DeclareCaptionSubType|\oarg{numbering scheme}\marg{type}\\
+% |\DeclareCaptionSubType*|\oarg{numbering scheme}\marg{type}
+% \end{quote}
+% For the environments |figure| \& |table| (and all the ones
+% defined with |\Declare|\x|Caption|\x|Type|) this will be done automatically
+% by this package, but for others (e.g.~defined with |\newfloat| offered by the
+% \package{float} package or |\Declare|\x|New|\x|Float|\x|Type| offered by the
+% \package{floatrow} package) this has to be done manually.
+%
+% \medskip
+%
+% The starred variant provides the sub-caption numbering format
+% \meta{type}|.|\meta{subtype} (e.g.~`|1.2|') while the non-starred variant
+% simply uses \meta{subtype} (e.g.~`|a|').
+%
+% \begin{small}
+% Own numbering formats can be created by redefining |\thesub|\meta{type}, e.g.
+% \begin{quote}|\DeclareCaptionSubType*{figure}|\\
+% |\renewcommand\thesubfigure{\thefigure\alph{subfigure}}|\end{quote}
+% would give you sub-caption numbers like `|1b|'.
+% \end{small}
+%
+% The default numbering scheme is |alph|, but you can use any \LaTeX\ command
+% name here which converts a counter to a text value, e.g. |arabic|, |roman|,
+% |Roman|, |alph|, |Alph|, |fnsymbol|, \ldots
+%
+% But |\DeclareCaptionSubType| is not for defining new sub-caption types only,
+% you can use this command for re-definitions as well, e.g.
+% \begingroup
+% \leftmargini=12pt
+% \begin{quote}
+% |\DeclareCaptionSubType*[arabic]{table}|\\
+% |\captionsetup[subtable]{labelformat=simple,labelsep=colon}|
+% \end{quote}
+% \endgroup
+% \pagebreak[3]
+% will give you sub-captions in |table|s like these ones:
+% \par\bigskip
+% \noindent\begin{minipage}{\linewidth}
+% \captionsetup{type=table}
+% \centering
+% \caption{Two tables}
+% \subcaptionbox{Table one}[3cm][c]{\begin{tabular}{cc}A & B\\ C & D\\ \end{tabular}}
+% \subcaptionbox{Table two}[3cm][c]{\begin{tabular}{cc}E & F\\ G & H\\ \end{tabular}}
+% \end{minipage}
+%
+% \begin{info}
+% |\DeclareCaptionSubType| is an integral part of the \package{caption}
+% package kernel.
+% \end{info}
+%
+% \iffalse\vfill\clearpage\fi
+% \subsection{Where do hyperlinks jump?}
+% \label{hypcap}
+%
+% For the |subfigure| \& |subtable| environments and |\subcaptionbox| boxes
+% (and own constructs which use |\captionsetup{subtype}|) the
+% hyperlink anchors will be placed in respect to the |hypcap=| setting.
+% While usage of this option is straight-forward ordinary captions,
+% the usage for sub-captions depends on the setting for the main captions.
+% This table gives you an overview where the hyperlinks will jump:\par
+%
+% \bigskip
+% \begin{small}
+% \centering
+% \DeleteShortVerb{\|}
+% \renewcommand\arraystretch{1.5}
+% \begin{tabular}{|l|p{3cm}p{3cm}|}
+% \hline
+% \backslashbox{subcaption}{caption} &
+% \multicolumn{1}{c}{\texttt{hypcap=false}} &
+% \multicolumn{1}{c|}{\texttt{hypcap=true}} \\
+% \hline
+% \raisebox{-1.5ex}[1.5ex]{\texttt{hypcap=false}} &
+% sub-caption & figure or table\par\hfill\textit{(default setting)}\\
+% \raisebox{-1.5ex}[1.5ex]{\texttt{hypcap=true}} &
+% sub-figure or\par sub-table & sub-figure or\par sub-table \\
+% \hline
+% \end{tabular}\par
+% \MakeShortVerb{\|}
+% \end{small}
+% \bigskip
+%
+% But if |\subcaption| is used and |hypcap=true| is set for sub-captions,
+% \thispackage\ does not know where the sub-figure or sub-table actually
+% begins, so it will jump to the sub-caption instead.
+%
+% \medskip
+% \emph{Remember:} If you use the \package{hypcap} package\cite{hypcap},
+% it controls the placement of the hyperlink anchors, making the rules
+% above invalid.
+%
+% \bigskip
+% {\small(See also the documentation of the \package{caption} package,
+% sections about \package{hyperref} \& \package{hypcap}.)}
+%
+% \iffalse
+% --------------------------------------------------------------------------- %
+% \fi
+%
+% \pagebreak[2]
+% \section{Thanks}
+%
+% I would like to thank
+% Stephen Dalton
+% who helped to make this package a better one.
+%
+% \iffalse
+% --------------------------------------------------------------------------- %
+% \fi
+%
+% \StopEventually{%^^A
+% \begin{thebibliography}{9}
+% \bibitem{TLC2}
+% Frank Mittelbach and Michel Goossens:\\
+% \newblock {\em The {\LaTeX} Companion (2nd.~Ed.)},
+% \newblock Addison-Wesley, 2004.
+% \iffalse
+% \bibitem{floatrow}
+% Olga Lapko:\\
+% \href{http://tug.ctan.org/tex-archive/macros/latex/contrib/floatrow/}%
+% {\emph{The floatrow package documentation}},
+% 2007/08/24
+% \fi
+% \bibitem{hyperref}
+% Sebastian Rahtz \& Heiko Oberdiek:\\
+% \href{http://tug.ctan.org/tex-archive/macros/latex/contrib/hyperref/}%
+% {\emph{Hypertext marks in \LaTeX}},
+% November 12, 2007
+% \bibitem{hypcap}
+% Heiko Oberdiek:\\
+% \href{http://tug.ctan.org/tex-archive/macros/latex/contrib/oberdiek/}%
+% {\emph{The hypcap package -- Adjusting anchors of captions}},
+% 2007/04/09
+% \bibitem{subfig}
+% Steven D. Cochran:\\
+% \href{http://tug.ctan.org/tex-archive/macros/latex/contrib/subfig/}%
+% {\emph{The subfig package}},
+% 2005/07/05
+% \end{thebibliography}
+% }
+%
+% \iffalse
+% --------------------------------------------------------------------------- %
+% \fi
+%
+% \DoNotIndex{\\,\_,\ ,\@@par}
+% \DoNotIndex{\@bsphack}
+% \DoNotIndex{\@car,\@cdr,\@classoptionslist,\@cons,\@currext,\@currname}
+% \DoNotIndex{\@ehc,\@ehd,\@empty,\@esphack,\@expandtwoargs}
+% \DoNotIndex{\@for,\@firstofone,\@firstoftwo}
+% \DoNotIndex{\@gobble,\@gobblefour,\@gobbletwo,\@hangfrom}
+% \DoNotIndex{\@ifnextchar,\@ifpackagelater,\@ifpackageloaded}
+% \DoNotIndex{\@ifstar,\@ifundefined,\@latex@error,\@namedef,\@nameuse}
+% \DoNotIndex{\@onlypreamble,\@parboxrestore,\@plus,\@ptionlist}
+% \DoNotIndex{\@removeelement,\@restorepar,\@secondoftwo,\@setpar}
+% \DoNotIndex{\@tempa,\@tempboxa,\@tempdima,\@tempdimb,\@tempdimc,\@tempb,\@tempc}
+% \DoNotIndex{\@testopt}
+% \DoNotIndex{\@undefined,\@unprocessedoptions,\@unusedoptionlist}
+% \DoNotIndex{\p@,\z@}
+% \DoNotIndex{\active,\addtocounter,\addtolength,\advance,\aftergroup}
+% \DoNotIndex{\baselineskip,\begin,\begingroup,\bfseries,\box}
+% \DoNotIndex{\catcode,\centering,\changes,\csname,\def,\divide,\do,\downarrow}
+% \DoNotIndex{\edef,\else,\empty,\end,\endcsname,\endgraf,\endgroup,\expandafter}
+% \DoNotIndex{\fi,\footnotesize,\global}
+% \DoNotIndex{\hangindent,\hbox,\hfil,\hsize,\hskip,\hspace,\hss}
+% \DoNotIndex{\ifcase,\ifdim,\ifnum,\ifodd,\ifvoid,\ifvmode}
+% \DoNotIndex{\ifx,\ignorespaces,\itshape}
+% \DoNotIndex{\Large,\large,\leavevmode,\leftmargini,\leftskip,\let,\linewidth}
+% \DoNotIndex{\llap,\long,\m@ne,\margin,\mdseries,\message}
+% \DoNotIndex{\newcommand,\newdimen,\newlength,\newline,\newif,\newsavebox}
+% \DoNotIndex{\next,\nobreak,\nobreakspace,\noexpand,\noindent,\numberline}
+% \DoNotIndex{\normalcolor,\normalfont,\normalsize,\or,\par,\parbox,\parfillskip}
+% \DoNotIndex{\parindent,\parskip,\prevdepth,\protect,\protected@edef,\protected@write}
+% \DoNotIndex{\providecommand,\quad}
+% \DoNotIndex{\raggedleft,\raggedright,\relax,\renewcommand,\RequirePackage}
+% \DoNotIndex{\rightskip,\rmfamily}
+% \DoNotIndex{\sbox,\scriptsize,\scshape,\setbox,\setlength,\sffamily,\slshape}
+% \DoNotIndex{\small,\string,\space,\strut}
+% \DoNotIndex{\textheight,\the,\toks@,\typeout,\ttfamily}
+% \DoNotIndex{\unvbox,\uparrow,\upshape,\usebox,\usepackage}
+% \DoNotIndex{\value,\vbox,\vsize,\vskip,\wd,\width,\z@skip}
+% \DoNotIndex{\AtBeginDocument,\AtEndOfPackage,\CurrentOption,\DeclareOption}
+% \DoNotIndex{\ExecuteOptions,\GenericWarning,\IfFileExists,\InputIfFileExists}
+% \DoNotIndex{\NeedsTeXFormat,\MessageBreak}
+% \DoNotIndex{\PackageError,\PackageInfo,\PackageWarning,\PackageWarningNoLine}
+% \DoNotIndex{\PassOptionsToPackage,\ProcessOptions,\ProvidesPackage}
+%
+% \iffalse
+% --------------------------------------------------------------------------- %
+% \fi
+%
+% \setlength{\parskip}{0pt plus 1pt}
+% \changes{v0.1}{2007/09/01}{First demo}
+% \changes{v0.2}{2007/11/11}{\cs{subcaptionbox} added}
+% \changes{v0.3}{2007/12/06}{Adapted to \package{caption} package \version{3.1f}}
+%
+% \newcommand*\Note[2][Note]{\par{\small\emph{#1:} #2}}
+%
+% \iffalse
+% --------------------------------------------------------------------------- %
+% \fi
+%
+% \vfill\clearpage
+% \section{The implementation}
+% \iffalse
+%<*package>
+% \fi
+%
+% \subsection{Identification}
+%
+% \begin{macrocode}
+\NeedsTeXFormat{LaTeX2e}[1994/12/01]
+\ProvidesPackage{subcaption}[2007/12/06 v0.3 Adding subcaptions (AR)]
+% \end{macrocode}
+%
+% \subsection{Initial code}
+%
+% We need the \package{caption} package, so we issue an error here if it's
+% not loaded yet.
+% \begin{macrocode}
+\@ifundefined{caption@subtypehook}{% we need caption v3.1f or newer
+ \PackageError{subcaption}{`caption' package not loaded\MessageBreak
+ (which is needed by this package)\@gobble}{%
+ If you do not understand this error, please take a closer look\MessageBreak
+ at the documentation of the `subcaption' package.\MessageBreak
+ \@ehc}%
+ \endinput}{}
+% \end{macrocode}
+%
+% \iffalse
+% \subsection{Declaration of options}
+% We do not have own options.
+% \fi
+%
+% \subsection{Execution of options}
+%
+% We map |\caption@setkeys| to |\captionsetup[sub]| so |\caption@ExecuteOptions|
+% \& |\caption@ProcessOptions| adds the options to the `|sub|' option list
+% instead of executing them immediately.
+% \begin{macrocode}
+\let\caption@setkeys@ORI\caption@setkeys
+\renewcommand\caption@setkeys[2]{\captionsetup[sub]{#2}}
+% \end{macrocode}
+% \begin{macrocode}
+\caption@ExecuteOptions{subcaption}{%
+ font+=small,labelformat=parens,labelsep=space,skip=6pt,list=0,hypcap=0}
+\caption@ProcessOptions*{subcaption}
+% \end{macrocode}
+% \begin{macrocode}
+\let\caption@setkeys\caption@setkeys@ORI
+\let\caption@setkeys@ORI\@undefined
+% \end{macrocode}
+%
+% \subsection{Main code}
+%
+% We call |\DeclareCaptionSubType| for |figure|, |table|,
+% and every caption type declared with |\DeclareCaptionType| here.
+% \begin{macrocode}
+\@ifundefined{c@figure}{}{\DeclareCaptionSubType{figure}}
+\@ifundefined{c@table}{}{\DeclareCaptionSubType{table}}
+\caption@For{typelist}{\DeclareCaptionSubType{#1}}
+% \end{macrocode}
+%
+% \pagebreak[3]
+% \subsubsection{The \cs{subcaption} command}
+%
+% \begin{macro}{\subcaption}
+% Without a prefacing |\captionsetup{subtype}|, \cs{subcaption} is some kind
+% of |\captionof{sub\@captype}|.
+% \Note{Like \cs{captionof}, this command is designed to be used inside an
+% own group!}
+% \begin{macrocode}
+\newcommand*\subcaption{\captionsetup{subtype*}\caption}
+% \end{macrocode}
+% But with a prefacing |\captionsetup{subtype}|, \cs{subcaption} is simply
+% |\caption|.
+% \begin{macrocode}
+\g@addto@macro\caption@subtypehook{\let\subcaption\caption}
+% \end{macrocode}
+% \end{macro}
+%
+% \pagebreak[3]
+% \subsubsection{The subfigure \& subtable environments}
+%
+% \begin{macro}{subfigure}
+% \begin{macro}{subtable}
+% This is just an ordinary \env{minipage} environment with
+% |\captionsetup{subtype}| as first contents line.
+% It will be defined using the helper macro |\caption@For{sub|\x|type|\x|list}|
+% offered by the \package{caption} kernel, so for every caption type
+% declared with |\Declare|\x|Caption|\x|Type| a corresponding `sub' environment
+% will be defined automatically.
+% \begin{macrocode}
+\caption@For{subtypelist}{%
+ \newenvironment{sub#1}%
+ {\caption@withoptargs\subcaption@minipage}%
+ {\endminipage}}%
+% \end{macrocode}
+% \begin{macrocode}
+\newcommand*\subcaption@minipage[2]{%
+ \minipage#1{#2}%
+ \captionsetup{subtype}}
+% \end{macrocode}
+% \end{macro}
+% \end{macro}
+%
+% \pagebreak[3]
+% \subsubsection{The \cs{subcaptionbox} command}
+%
+% \begin{macro}{\subcaptionbox}
+% A |\parbox| with contents and sub-caption, separated by an invisible |\hrule|.
+% \begin{macrocode}
+\newcommand*\subcaptionbox{\caption@withoptargs\subcaption@box}
+% \end{macrocode}
+% \begin{macrocode}
+\newcommand\subcaption@box[2]{%
+ \@testopt{\subcaption@ibox{#1}{#2}}{\wd\@tempboxa}}
+% \end{macrocode}
+% \begin{macrocode}
+\long\def\subcaption@ibox#1#2[#3]{%
+ \@testopt{\subcaption@iibox{#1}{#2}{#3}}\subcaptionbox@hj@default}
+% \end{macrocode}
+% \begin{macrocode}
+\long\def\subcaption@iibox#1#2#3[#4]#5{%
+ \setbox\@tempboxa\hbox{#5}%
+ \begingroup
+ \captionsetup{subtype*}% set \caption@position
+ \caption@iftop{%
+ \endgroup
+ \parbox[t]{#3}{%
+ \captionsetup{subtype,position=t}%
+ \vbox{\caption#1{#2}}%
+ \hrule\@height\z@
+ \csname caption@hj@#4\endcsname
+ \unhbox\@tempboxa}%
+ }{%
+ \endgroup
+ \parbox[b]{#3}{%
+ \captionsetup{subtype,position=b}%
+ \csname caption@hj@#4\endcsname
+ \unhbox\@tempboxa
+ \hrule\@height\z@
+ \vtop{\caption#1{#2}}}%
+ }}
+% \end{macrocode}
+% \begin{macrocode}
+\providecommand*\caption@hj@c{\centering}
+\providecommand*\caption@hj@l{\raggedright}
+\providecommand*\caption@hj@r{\raggedleft}
+\providecommand*\caption@hj@s{}
+\newcommand*\subcaptionbox@hj@default{c}
+% \end{macrocode}
+% \end{macro}
+%
+% \pagebreak[3]
+% \subsubsection{The \cs{subref} command}
+%
+% At |\captionsetup{subtype}|, we redefine |\label|.
+% \begin{macrocode}
+\g@addto@macro\caption@subtypehook{%
+ \ifx\label\subcaption@label \else
+ \let\subcaption@ORI@label\label
+ \let\label\subcaption@label
+ \fi}
+% \end{macrocode}
+%
+% \begin{macro}{\subcaption@label}
+% When a label will be placed for a sub-caption, we automatically place
+% a second one for |\subref|, too. This second label will contain
+% the sub-type counter only.
+% \begin{macrocode}
+\newcommand*\subcaption@label[1]{%
+ \@bsphack\begingroup
+ \subcaption@ORI@label{#1}%
+ \protected@edef\@currentlabel{\csname thesub\@captype\endcsname}%
+ \subcaption@ORI@label{sub@#1}%
+ \endgroup\@esphack}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\subref}
+% This simply calls |\ref| with the second label. (see |\subcaption@label|)
+% \begin{macrocode}
+\DeclareRobustCommand*\subref{\caption@withoptargs\subcaption@ref}
+\newcommand*\subcaption@ref[2]{\ref#1{sub@#2}}
+% \end{macrocode}
+% \end{macro}
+%
+% \iffalse
+%</package>
+% \fi
+%
+% \iffalse
+% --------------------------------------------------------------------------- %
+% \fi
+%
+% \Finale
+%
+\endinput