diff options
author | Manuel Pégourié-Gonnard <mpg@elzevir.fr> | 2008-04-07 13:23:56 +0000 |
---|---|---|
committer | Manuel Pégourié-Gonnard <mpg@elzevir.fr> | 2008-04-07 13:23:56 +0000 |
commit | f3293da79b2d98143874b2594dac2dbafa167d1c (patch) | |
tree | 6815bade64d06cf7c97c28304e756fc25bf38035 /Master/texmf-dist/source/latex/caption/subcaption.dtx | |
parent | 41fdc70e57b74afa2a63e751e435055e5dfe7c58 (diff) |
The caption package v3.1h
git-svn-id: svn://tug.org/texlive/trunk@7346 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.dtx | 138 |
1 files changed, 100 insertions, 38 deletions
diff --git a/Master/texmf-dist/source/latex/caption/subcaption.dtx b/Master/texmf-dist/source/latex/caption/subcaption.dtx index 6a8d6b6e17f..defb3b40dae 100644 --- a/Master/texmf-dist/source/latex/caption/subcaption.dtx +++ b/Master/texmf-dist/source/latex/caption/subcaption.dtx @@ -24,12 +24,12 @@ % user manuals caption-deu.tex, caption-eng.tex, and caption-rus.tex. % % \fi -% \CheckSum{144} +% \CheckSum{204} % % \iffalse %<*driver> \NeedsTeXFormat{LaTeX2e}[1994/12/01] -\ProvidesFile{subcaption.drv}[2008/01/12 v0.3 Adds a sub-caption feature to the caption package] +\ProvidesFile{subcaption.drv}[2008/03/30 v0.3 Adds a sub-caption feature to the caption package] \hbadness=9999 \newcount\hbadness \hfuzz=74pt % Make TeX shut up. %\errorcontextlines=3 % @@ -75,13 +75,17 @@ \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}}}} -\newenvironment{info}{\par\bigskip\csname info*\endcsname}{\csname endinfo*\endcsname} -\newenvironment{info*}% - {\small - \MARGINSYM{\vbox to \ht\strutbox{\LARGE\Info}}% - \ignorespaces}% - {\par} +%\newcommand*\NEW[2]{}%\hskip 1sp \marginpar{\footnotesize\sffamily\raggedleft#1\\#2}} % \begin{document} \DocInput{subcaption.dtx} @@ -121,26 +125,30 @@ % \package{caption} package. % \end{abstract} % -% \subsection*{Introduction} -% \begin{info*} -% 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, causing |\caption| to typeset a sub-caption instead of an -% ordinary one.\par +% \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|. -% \end{info*} +% |\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. -% \medskip +% \fi % % \clearpage % \section{The user interface} @@ -256,18 +264,19 @@ % % \bigskip % -% \begin{info} -% Actually the |\subcaption| command is just a simple combination of -% |\caption|\-|setup{sub|\-|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 +% \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.\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} +% 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} @@ -315,13 +324,13 @@ % % \bigskip % -% \begin{info} +% \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{info} +% \end{background} % % \PageBreak % \subsection{The \cs{subcaptionbox} command} @@ -431,11 +440,11 @@ % % \bigskip % -% \begin{info} +% \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{info} +% \end{background} % % \PageBreak % \subsection{The \cs{subref} command} @@ -460,10 +469,10 @@ % the same result. % \end{small} % -% \begin{info} +% \begin{background} % The |\sub|\-|ref| command demonstrates the usage of |\caption@sub|\-|type|\-|hook| % which will be called during |\caption|\-|setup{sub|\-|type}|. -% \end{info} +% \end{background} % % \pagebreak[3] % \subsection{The \cs{DeclareCaptionSubType} command} @@ -520,10 +529,10 @@ % \subcaptionbox{Table two}[3cm][c]{\begin{tabular}{cc}E & F\\ G & H\\ \end{tabular}} % \end{minipage} % -% \begin{info} +% \begin{background} % |\Declare|\-|Caption|\-|Sub|\-|Type| is an integral part of the \package{caption} % package kernel. -% \end{info} +% \end{background} % % \pagebreak[3] % \subsection{Where do hyperlinks jump?} @@ -575,7 +584,7 @@ % \fi % % \pagebreak[3] -% \section{Beyond this package} +% \subsection{Beyond this package} % \label{floatrow} % % For a more advanced usage of the sub-caption feature of the @@ -681,6 +690,7 @@ % \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}} % @@ -698,7 +708,7 @@ % % \begin{macrocode} \NeedsTeXFormat{LaTeX2e}[1994/12/01] -\ProvidesPackage{subcaption}[2007/12/06 v0.3 Adding subcaptions (AR)] +\ProvidesPackage{subcaption}[2008/03/16 v1.0 Adding subcaptions (AR)] % \end{macrocode} % % \subsection{Initial code} @@ -841,6 +851,58 @@ % \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{\hrule\@height\z@}{}% + \csname caption@hj@#3\endcsname + \unhbox\@tempboxa + \caption@iftop{}{\hrule\@height\z@}}}% +% \end{macrocode} +% \end{macro} +% +% \pagebreak[3] % \subsubsection{The \cs{subref} command} % % At |\captionsetup{subtype}|, we redefine |\label|. |