summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/source/latex/caption/subcaption.dtx
diff options
context:
space:
mode:
Diffstat (limited to 'Master/texmf-dist/source/latex/caption/subcaption.dtx')
-rw-r--r--Master/texmf-dist/source/latex/caption/subcaption.dtx215
1 files changed, 73 insertions, 142 deletions
diff --git a/Master/texmf-dist/source/latex/caption/subcaption.dtx b/Master/texmf-dist/source/latex/caption/subcaption.dtx
index 8c6781305e2..413d66da4ec 100644
--- a/Master/texmf-dist/source/latex/caption/subcaption.dtx
+++ b/Master/texmf-dist/source/latex/caption/subcaption.dtx
@@ -2,7 +2,7 @@
%
% This is file `subcaption.dtx'.
%
-% Copyright (C) 2007-2008 Axel Sommerfeldt (caption@sommerfee.de)
+% Copyright (C) 2007-2010 Axel Sommerfeldt (axel.sommerfeldt@f-m.fm)
%
% --------------------------------------------------------------------------
%
@@ -19,17 +19,18 @@
% 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.
+% caption3.dtx, bicaption.dtx, ltcaption.dtx, and subcaption.dtx,
+% the derived files caption.sty, caption2.sty, caption3.sty, bicaption.sty,
+% ltcaption.sty, and subcaption.sty, and the user manuals caption-deu.tex,
+% caption-eng.tex, and caption-rus.tex.
%
% \fi
-% \CheckSum{203}
+% \CheckSum{78}
%
% \iffalse
%<*driver>
\NeedsTeXFormat{LaTeX2e}[1994/12/01]
-\ProvidesFile{subcaption.drv}[2008/08/31 v1.0b Adds a sub-caption feature to the caption package]
+\ProvidesFile{subcaption.drv}[2010/09/04 v1.0 Adds a sub-caption feature to the caption package]
\hbadness=9999 \newcount\hbadness \hfuzz=74pt % Make TeX shut up.
%\errorcontextlines=3
%
@@ -58,8 +59,7 @@
\ifpdf\usepackage{hypdestopt}\fi
\hypersetup{pdfkeywords={LaTeX, package, subcaption},pdfstartpage={},pdfstartview={}}
%
-\usepackage{caption}[2007/12/06] % needs v3.1f or newer
-\usepackage{subcaption}[2008/08/31]
+\usepackage{subcaption}[2010/09/01]
\DeclareCaptionSubType*[arabic]{table}
\captionsetup[subtable]{labelformat=simple,labelsep=colon}
%
@@ -116,13 +116,13 @@
% 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}}}
+% \href{mailto:axel.sommerfeldt@f-m.fm}{\texttt{axel.sommerfeldt@f-m.fm}}}
% \date{\docdate}
% \maketitle
%
% \begin{abstract}
-% This tiny package demonstrates the sub-caption feature of the
-% \package{caption} package.
+% This package supports typesetting of sub-captions
+% (by using the the sub-caption feature of the \package{caption} package).
% \end{abstract}
%
% \begin{background}
@@ -153,10 +153,11 @@
% \clearpage
% \section{The user interface}
%
-% Just load this package after the \package{caption} package, e.g.:
+% \subsection{Loading the package}
+%
+% Load this package using
% \begin{quote}
-% |\usepackage|\oarg{options}|{caption}|\\
-% |\usepackage|\oarg{options}|{subcaption}|
+% |\usepackage|\oarg{options}|{subcaption}|\quad.
% \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
@@ -168,7 +169,7 @@
% is identical to
% \begin{quote}
% |\usepackage{subcaption}|\\
-% |\captionsetup[sub]|\marg{options}
+% |\captionsetup[sub]|\marg{options}\quad.
% \end{quote}
%
% \bigskip
@@ -178,30 +179,30 @@
% |margin=0pt,font+=small,labelformat=parens,labelsep=space,|\\
% |skip=6pt,list=false,hypcap=false|~\footnote{%^^A
% This means that sub-captions are not listed in the List of Figures
-% or Tables by default, but (of course) you can enable that by
+% or Tables by default, but you can enable that by
% specifying the option \texttt{list=true}.}
% \end{quote}
%
% Options specified with |\usepackage[|\ldots|]{sub|\-|caption}| and
% |\caption|\-|setup[sub]{|\ldots|}| will override the ones specified by
-% |\caption|\-|setup{|\ldots|}| and |\caption|\-|setup[figure]{|\ldots|}|,
+% |\caption|\-|setup{|\ldots|}| and |\caption|\-|setup[fig|\-|ure]{|\ldots|}|,
% but are again overwritten by |\caption|\-|setup[sub|\-|figure]{|\ldots|}|
% (same for `table'). So finally we have the following order how
% settings for sub-captions are applied:
% \begin{enumerate}
-% \item global settings
+% \item Global settings
% {\small(|\usepackage[|\ldots|]{caption}| and |\captionsetup{|\ldots|}|)}
-% \item environmental settings
+% \item Environmental settings
% {\small(|\captionsetup[figure|\emph{ -or- }|table]{|\ldots|}|)}
-% \item local settings
+% \item Local settings
% {\small(|\captionsetup{|\ldots|}| inside |figure| or |table| environment)}
-% \item default `sub' settings
+% \item Default `sub' settings
% {\small(|margin=0pt,font+=small,|\ldots, see above)}
-% \item custom `sub' settings
+% \item Custom `sub' settings
% {\small(|\usepackage[|\ldots|]{subcaption}| and |\captionsetup[sub]{|\ldots|}|)}
-% \item environmental `sub' settings
+% \item Environmental `sub' settings
% {\small(|\captionsetup[subfigure|\emph{ -or- }|subtable]{|\ldots|}|)}
-% \item local `sub' settings
+% \item Local `sub' settings
% {\small(|\captionsetup{|\ldots|}| inside |subfigure| or |subtable|)}
% \end{enumerate}
% An example:
@@ -287,8 +288,8 @@
% |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:
+% for typesetting captions. So this example is the same as the last one,
+% but uses the |subfigure| environment:
% \begin{quote}
% |\begin{figure}|\\
% | \begin{|\textcolor{blue}{\texttt{subfigure}}|}[b]{.5\linewidth}|\\
@@ -303,7 +304,7 @@
% |\end{figure}|
% \end{quote}
% Using the |subfigure| or |subtable| environment instead of |\subcaption|
-% has two (little) advantages:
+% has two advantages:
% \begin{itemize}
% \item You can override the setttings for a specific subcaption
% with a |\captionsetup| inside the |subfigure| or |subtable| environment, e.g.:
@@ -316,7 +317,7 @@
% |\end{subfigure}|\\
% \ldots
% \end{quote}
-% \item Hyperlinks pointing to this subfigure will jump to the beginning
+% \item Hyperlinks targeted 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}}
@@ -440,6 +441,21 @@
%
% \bigskip
%
+% \iffalse
+% \noindent\begin{minipage}{\linewidth}
+% \captionsetup{type=figure}
+% \centering
+% \hbox{\subcaptionbox{An elephant\label{elephant4}}
+% {\includegraphics[width=.4\textwidth]{elephant}}%^^A
+% \vbox{\subcaptionbox{Cat 1\label{cat4.1}}
+% {\includegraphics[width=30pt]{cat}}\par
+% \subcaptionbox{Cat 2\label{cat4.2}}
+% {\includegraphics[width=30pt]{cat}}}}%^^A
+% \caption{Two animals}\label{animals4}
+% \end{minipage}
+% \bigskip
+% \fi
+%
% \begin{background}
% The |\sub|\-|caption|\-|box| is a |\par|\-|box| with
% |\caption|\-|setup{sub|\-|type}| as first contents line.
@@ -691,6 +707,8 @@
% \changes{v0.2}{2007/11/11}{\cs{subcaptionbox} added}
% \changes{v0.3}{2007/12/06}{Adapted to \package{caption} package \version{3.1f}}
% \changes{v1.0}{2008/03/16}{\cs{subfloat} added}
+% \changes{v1.0c}{2010/10/27}{An error message will be issued when the subfigure or subfig package is loaded}
+% \changes{v1.0c}{2011/01/22}{Undocumented command \cs{subfloat} removed}
%
% \newcommand*\Note[2][Note]{\par{\small\emph{#1:} #2}}
%
@@ -705,24 +723,33 @@
% \fi
%
% \subsection{Identification}
-%
% \begin{macrocode}
\NeedsTeXFormat{LaTeX2e}[1994/12/01]
-\ProvidesPackage{subcaption}[2008/08/31 v1.0b Adding subcaptions (AR)]
+\ProvidesPackage{subcaption}[2011/01/22 v1.0c 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.
+% Since we are incompatible to them an error message will be issued when
+% the \package{subfigure} or \package{subfig} package is loaded.
% \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}{}
+\@ifundefined{subfigure}{}{%
+ \PackageError{subcaption}{%
+ This package can't be used in cooperation\MessageBreak
+ with the subfigure package}%
+ \endinput}
+% \end{macrocode}
+% \begin{macrocode}
+\@ifundefined{subfloat}{}{%
+ \PackageError{subcaption}{%
+ This package can't be used in cooperation\MessageBreak
+ with the subfig package}%
+ \endinput}
+% \end{macrocode}
+%
+% Since we base on the \package{caption} package we load it here.
+% \begin{macrocode}
+\RequirePackage{caption}[2010/12/01] % needs v3.2 or newer
% \end{macrocode}
%
% \iffalse
@@ -732,22 +759,14 @@
%
% \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}
+% We use |\caption@ExecuteOptions| and |\caption@ProcessOptions| here to add
+% the options to the `|sub|' option list instead of executing them immediately.
% \begin{macrocode}
+\caption@SetupOptions{subcaption}{\captionsetup[sub]{#2}}%
\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}
%
@@ -808,100 +827,12 @@
% \begin{macro}{\subcaptionbox}
% \changes{v1.0a}{2008/05/06}{Adapted to the \opt{rule} option of the \package{caption} package}
% \changes{v1.0b}{2008/08/31}{Definition and usage of \cs{subcaption@hrule} added}
+% \changes{v1.0c}{2010/12/17}{Uses \cs{caption@box} now}
% 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}}%
- \subcaption@hrule
- \csname caption@hj@#4\endcsname
- \unhbox\@tempboxa}%
- }{%
- \endgroup
- \parbox[b]{#3}{%
- \captionsetup{subtype,position=b}%
- \csname caption@hj@#4\endcsname
- \unhbox\@tempboxa
- \subcaption@hrule
- \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}
-\newcommand*\subcaption@hrule{\hrule\@height\z@}
-% \end{macrocode}
-% \end{macro}
-%
-% \pagebreak[3]
-% \subsubsection{The \cs{subfloat} command}
-%
-% \begin{macro}{\subfloat}
-% \changes{v0.4}{2008/03/01}{This macro added}
-% |\subfloat|\oarg{list\_entry}\oarg{sub-caption}\marg{body}\\
-% |\subfloat*|\marg{body}\par
-% If \meta{sub-caption} is given, we simply map this to \cs{subcaptionbox}.
-% If not, we do the same as \cs{subcaptionbox}, but increment the
-% sub-caption counter instead of typesetting a sub-caption.
-% (The star variant is neither incrementing the sub-caption counter
-% nor setting an hyperref anchor.)
-% \begin{macrocode}
-\newcommand*\subfloat{%
- \@ifnextchar[\@subfloat\subfloat@}
-% \end{macrocode}
-% \begin{macrocode}
-\long\def\@subfloat[#1]{%
- \@ifnextchar[{\@@subfloat{#1}}{\subcaptionbox{#1}}}
-% \end{macrocode}
-% \begin{macrocode}
-\long\def\@@subfloat#1[#2]{\subcaptionbox[{#1}]{#2}}
-% \end{macrocode}
-% \begin{macrocode}
-\newcommand*\subfloat@{%
- \caption@teststar\subfloat@@\@firstoftwo\@secondoftwo}
-% \end{macrocode}
-% \begin{macrocode}
-\newcommand\subfloat@@[2]{%
- \setbox\@tempboxa\hbox{#2}%
- \begingroup
- \captionsetup{subtype*}% set \caption@position
- \caption@iftop{\subfloat@@@ t}{\subfloat@@@ b}%
- {#1}\subcaptionbox@hj@default}
-% \end{macrocode}
-% \begin{macrocode}
-\newcommand\subfloat@@@[3]{%
- \endgroup
- \parbox[#1]{\wd\@tempboxa}{%
- #2% \@firstoftwo in star form, \@secondoftwo otherwise
- {\captionsetup{subtype*,position=#1}}%
- {\captionsetup{subtype,position=#1}%
- \caption@refstepcounter\@subcaptype
- \caption@prepareanchor\@subcaptype{}%
- \caption@makeanchor{}}%
- \caption@iftop\subcaption@hrule\@empty
- \csname caption@hj@#3\endcsname
- \unhbox\@tempboxa
- \caption@iftop\@empty\subcaption@hrule}}%
+\newcommand*\subcaptionbox{%
+ \def\captionbox@type{subtype}%
+ \caption@withoptargs\caption@box}
% \end{macrocode}
% \end{macro}
%