% \iffalse meta-comment % % This is file `subcaption.dtx'. % % Copyright (C) 2007-2008 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{203} % % \iffalse %<*driver> \NeedsTeXFormat{LaTeX2e}[1994/12/01] \ProvidesFile{subcaption.drv}[2008/08/31 v1.0b 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} % \newcommand\LineBreak{\linebreak[3]} \newcommand\PageBreak{\pagebreak[3]} \usepackage{ifpdf} \ifpdf \usepackage{mathptmx,courier} \usepackage[scaled=0.90]{helvet} \addtolength\marginparwidth{15pt} \ifdim\paperheight=297mm % a4paper \renewcommand\LineBreak{\\} \renewcommand\PageBreak{\clearpage} \fi \fi % \usepackage[bottom]{footmisc} \usepackage{array,graphicx,pict2e,slashbox} \IfFileExists{test/tlc2/cat.eps}{\graphicspath{{test/tlc2/}}}{}% % \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}[2008/08/31] \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{}{}{}} % \usepackage{marvosym} \makeatletter \newcommand*\INFO{\@ifstar{\@INFO{}}{\@INFO{\vbox to \ht\strutbox}}} \newcommand*\@INFO[1]{\MARGINSYM{#1{\LARGE\Info}}} \makeatother % \usepackage[alpine]{ifsym} \newenvironment{background}{\par\bigskip\csname background*\endcsname}{\csname endbackground*\endcsname} \newenvironment{background*}{\small\MARGINSYM{\Mountain}\ignorespaces}{\par} % \newcommand*\MARGINSYM[1]{\hskip 1sp \marginpar{\raggedleft\textcolor{blue}{{#1}}}} %\newcommand*\NEW[2]{}%\hskip 1sp \marginpar{\footnotesize\sffamily\raggedleft#1\\#2}} % \begin{document} \DocInput{subcaption.dtx} \end{document} % % \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} % % \begin{background} % At the end of each section, text marked with the mountain symbol % will contain background knowledge on how the particular command or % environment is actually implemented. % If you just want to use this package as it is, you don't have to read or % understand them. % \end{background} % % \begin{background*} % This package demonstrates the usage of |\Declare|\-|Caption|\-|Sub|\-|Type|, % |\caption|\-|setup{sub|\-|type}|, and the internal hook % |\caption@sub|\-|type|\-|hook| (offered by the \package{caption} package). % \end{background*} % % \setcounter{tocdepth}{2} % \tableofcontents % % \iffalse % \vfill % \INFO* % \emph{Please note:} % This package is incompatible with the \package{subfigure} and \package{subfig} % packages. % \fi % % \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|~\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 % 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|}|, % 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 % {\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} % % \PageBreak % \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{background} % Prepared with either |\Declare|\-|Caption|\-|Sub|\-|Type| (offered by the % \package{caption} package) or |\new|\-|sub|\-|float| (offered by the % \package{subfig} package), the caption package option |subtype| becames % available. % Analogous to the |type| option of the \package{caption} package, % the |subtype| option 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.\par % The |\subcaption| command is just a simple combination of % |\caption|\-|setup{sub|\-|type*}| and |\caption|. % \end{background} % % \PageBreak % \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{background} % The |subfigure| \& |subtable| environments are just simple minipage % environments with |\caption|\-|setup|\x|{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{background} % % \PageBreak % \subsection{The \cs{subcaptionbox} command} % % \DescribeMacro\subcaptionbox % A more powerful (but less flexible) way of setting sub-figures is % offered by the |\sub|\-|caption|\-|box| 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 |\par|\-|box|; 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 |\ragged|\-|right|), % `r' (for |\ragged|\-|left|), or `s' (for no special justification). % The default is `c'. % (But you can use any justification defined with % |\Declare|\-|Caption|\-|Jus|\-|ti|\-|fi|\-|ca|\-|tion| as well, % e.g.~`|center|\-|last|'.) % \end{small} % % \bigskip % % Using |\sub|\-|caption|\-|box|, 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 % |\caption|\-|box|, increasing the width of the resulting box: % \begin{quote} % | |\ldots\\ % | \subcaptionbox{A cat\label{cat}}|\\ % | |\textcolor{blue}{\csoarg{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 % |\text|\-|width|, looks mis-aligned with respect to the sub-captions. % This can (again) be solved by using the optional arguments of % |\caption|\-|box|, giving both boxes the same width, for example: % \begin{quote} % | |\ldots\\ % | \subcaptionbox{A cat\label{cat}}|\\ % | |\textcolor{blue}{\csoarg{.4\cs{linewidth}}}|{\includegraphics{cat}}%|\\ % | \subcaptionbox{An elephant\label{elephant}}|\\ % | |\textcolor{blue}{\csoarg{.4\cs{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{background} % The |\sub|\-|caption|\-|box| is a |\par|\-|box| with % |\caption|\-|setup{sub|\-|type}| as first contents line. % \iffalse See implementation for details.\fi % \end{background} % % \PageBreak % \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 % |\Declare|\-|Caption|\-|Sub|\-|Type*|, both |\ref| and |\sub|\-|ref| gives % the same result. % \end{small} % % \begin{background} % The |\sub|\-|ref| command demonstrates the usage of |\caption@sub|\-|type|\-|hook| % which will be called during |\caption|\-|setup{sub|\-|type}|. % \end{background} % % \pagebreak[3] % \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|\-|Caption|\-|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|\-|New|\-|Float|\-|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{background} % |\Declare|\-|Caption|\-|Sub|\-|Type| is an integral part of the \package{caption} % package kernel. % \end{background} % % \pagebreak[3] % \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[3] % \subsection{Beyond this package} % \label{floatrow} % % For a more advanced usage of the sub-caption feature of the % \package{caption} package, please take a look at the \package{floatrow} % package\cite{floatrow} which provides the powerful \texttt{subfloatrow} % environment for typesetting sub-figures. % % \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. % \bibitem{floatrow} % Olga Lapko:\\ % \href{http://tug.ctan.org/tex-archive/macros/latex/contrib/floatrow/}% % {\emph{The floatrow package documentation}}, % 2007/12/24 % \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}} % \changes{v1.0}{2008/03/16}{\cs{subfloat} added} % % \newcommand*\Note[2][Note]{\par{\small\emph{#1:} #2}} % % \iffalse % --------------------------------------------------------------------------- % % \fi % % \clearpage % \section{The implementation} % \iffalse %<*package> % \fi % % \subsection{Identification} % % \begin{macrocode} \NeedsTeXFormat{LaTeX2e}[1994/12/01] \ProvidesPackage{subcaption}[2008/08/31 v1.0b 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|\-|type|\-|list}| % offered by the \package{caption} kernel, so for every caption type % declared with |\Declare|\-|Caption|\-|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} % \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} % 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}}% % \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 % % \fi % % \iffalse % --------------------------------------------------------------------------- % % \fi % % \Finale % \endinput