diff options
author | Norbert Preining <norbert@preining.info> | 2019-11-25 03:00:40 +0000 |
---|---|---|
committer | Norbert Preining <norbert@preining.info> | 2019-11-25 03:00:40 +0000 |
commit | 447c94ee79e6bd2ecba4c822e4c07763b492747e (patch) | |
tree | 72623f779390bff0c9af3d3c9e4b2ecdb18ec9e1 /macros/latex/contrib/caption/caption3.dtx | |
parent | 4ce3a0d4729af1865e66c9c1cd967f42b0830d26 (diff) |
CTAN sync 201911250300
Diffstat (limited to 'macros/latex/contrib/caption/caption3.dtx')
-rw-r--r-- | macros/latex/contrib/caption/caption3.dtx | 723 |
1 files changed, 233 insertions, 490 deletions
diff --git a/macros/latex/contrib/caption/caption3.dtx b/macros/latex/contrib/caption/caption3.dtx index bdffdcc66a..59e24f0fc1 100644 --- a/macros/latex/contrib/caption/caption3.dtx +++ b/macros/latex/contrib/caption/caption3.dtx @@ -25,7 +25,7 @@ % and the user manuals caption-deu.tex, caption-eng.tex, and caption-rus.tex. % % \fi -% \CheckSum{3961} +% \CheckSum{3418} % % \iffalse %<*driver> @@ -38,9 +38,6 @@ \setlength\parindent{0pt} \setlength\parskip{\smallskipamount} % -%\let\ORIsubsection\subsection -%\def\subsection{\clearpage\ORIsubsection} -% \makeatletter % make room for subsections like 2.16.14 in the TOC %\newcommand*\l@subsection{\@dottedtocline{2}{1.5em}{2.3em}} \renewcommand*\l@subsection{\@dottedtocline{2}{1.5em}{2.7em}} @@ -57,11 +54,8 @@ \ifpdf\usepackage{hypdestopt}\fi \hypersetup{pdfkeywords={LaTeX, package, caption},pdfstartpage={},pdfstartview={}} % -\usepackage[debug]{caption3}[2018/05/01] +\usepackage{caption3}[2019/09/09] % -\DeclareRobustCommand*\eTeX{\texorpdfstring - {\leavevmode\hbox{$\varepsilon$}-\TeX}% - {e-TeX}} \DeclareRobustCommand*\AmS{\texorpdfstring {{\protect\usefont{OMS}{cmsy}{m}{n}A\kern-.1667em\lower.5ex\hbox{M}\kern-.125emS}}% {AMS}} @@ -90,8 +84,6 @@ % \newcommand*\csoarg[1]{\texttt{\char`\[#1\char`\]}} % \newcommand*\version[2][]{\textit{v#2}} % -% \GetFileInfo{caption3.drv} -% \let\docdate\filedate % \GetFileInfo{caption3.sty} % % \title{The Implementation of @@ -100,7 +92,7 @@ % {the caption kernel}} % \author{Axel Sommerfeldt\\ % \url{https://gitlab.com/axelsommerfeldt/caption}} -% \date{\docdate} +% \date{\filedate} % \maketitle % % \begin{abstract} @@ -187,25 +179,23 @@ % \fi % % \clearpage -% \let\subsubsection\subsection -% \let\subsection\section % % \iffalse %<*package> % \fi % -% \subsection{Identification} +% \section{Identification} % % \begin{macrocode} \NeedsTeXFormat{LaTeX2e}[1994/12/01] -\ProvidesPackage{caption3}[2019/09/01 v1.8d caption3 kernel (AR)] +\ProvidesPackage{caption3}[2019/09/09 v1.8e caption3 kernel (AR)] % \end{macrocode} % -% \subsection{Workaround for bug in package \package{arabtex}} +% \section{Workaround for bug in package \package{arabtex}} % \package{arabtex} re-defines \cs{@gobble} as not-long so the packages of the % \package{caption} package bundle are doomed to fail. % Since this fatal bug won't be fixed in \package{arabtex} but we are dependent on a -% proper definition of \cs{@gobble}, \cs{@firstofone}, \cs{@firstoftwo}, \cs{@secondoftwo} +% proper definition of \cs{@gobble}, \cs{@firstofone}, \cs{@firstoftwo}, \cs{@secondoftwo}, % and so on we fix this here. (Sigh!) % \begin{macrocode} \providecommand\caption@FixArabTeX{% @@ -223,7 +213,7 @@ \let\caption@FixArabTeX\@undefined} % \end{macrocode} % -% \subsection{Generic helpers} +% \section{Generic helpers} % % \begin{macro}{\@nameundef} % This is the opposite to |\@namedef| which is offered by the \LaTeX\ kernel. @@ -286,8 +276,8 @@ % \begin{macro}{\caption@ifundefined} % \changes{v1.3a}{2011/08/12}{This macro added} % \changes{v1.3b}{2011/08/18}{Made expandable} -% Similar to \cs{@ifundefined} offered by the \LaTeX kernel, but does -% not define the undefined macro as \cs{relax}. +% Similar to \cs{@ifundefined} offered by the \LaTeX kernel, +% but takes a macro as argument instead of a macro name. % \begin{macrocode} \newcommand*\caption@ifundefined[1]{% \ifx#1\@undefined @@ -300,6 +290,22 @@ % \end{macrocode} % \end{macro} % +% \begin{macro}{\caption@ifdefined} +% \changes{v1.8e}{2018/05/11}{This macro added} +% Similar to \cs{@ifundefined} offered by the \LaTeX kernel, +% but takes a macro as argument instead of a macro name. +% \begin{macrocode} +\newcommand*\caption@ifdefined[1]{% + \ifx#1\@undefined + \expandafter\@secondoftwo + \else\ifx#1\relax + \expandafter\expandafter\expandafter\@secondoftwo + \else + \expandafter\expandafter\expandafter\@firstoftwo + \fi\fi} +% \end{macrocode} +% \end{macro} +% % \begin{macro}{\caption@ifinlist} % \changes{v1.1}{2007/07/29}{Rewritten} % This helper macro checks if the first argument is in the comma separated @@ -505,53 +511,6 @@ % \end{macrocode} % \end{macro} % -% \begin{macro}{\caption@CheckCommand} -% \changes{v1.1}{2007/04/10}{This macro added} -% \begin{macro}{\caption@IfCheckCommand} -% \changes{v1.1}{2007/04/10}{This macro added} -% \changes{v1.2b}{2008/08/02}{Revised so \cs{next} is no longer used} -% \changes{v1.5}{2012/08/25}{Bugfix: Uses \cs{caption@tempa} instead of \cs{@tempa}} -% |\caption@CheckCommand|\marg{macro}\marg{definition of macro}\par -% checks if a command already exists, with the same definition. -% It can be used more-than-once to check if one of multiple definitions will -% finally match. -% (It redefines itself later on to |\@gobbletwo| if the two commands match -% fine, making further checks harmless.)\par -% |\caption@IfCheckCommand|\marg{true}\marg{false}\par -% will execute the \meta{true} code if one match was finally given, -% the \meta{false} code otherwise. -% (It simply checks if |\caption@CheckCommand| is |\@gobbletwo| and -% restores the starting definition of |\caption@CheckCommand|.) -% \begin{macrocode} -\newcommand\caption@DoCheckCommand[2]{% - \begingroup - \let\caption@tempa#1% - #2% - \ifx\caption@tempa#1% - \endgroup - \let\caption@CheckCommand\@gobbletwo - \else - \endgroup - \fi} -\@onlypreamble\caption@DoCheckCommand -% \end{macrocode} -% \begin{macrocode} -\let\caption@CheckCommand\caption@DoCheckCommand -\@onlypreamble\caption@CheckCommand -% \end{macrocode} -% \begin{macrocode} -\newcommand*\caption@IfCheckCommand{% - \ifx\caption@CheckCommand\@gobbletwo - \let\caption@CheckCommand\caption@DoCheckCommand - \expandafter\@firstoftwo - \else - \expandafter\@secondoftwo - \fi} -\@onlypreamble\caption@IfCheckCommand -% \end{macrocode} -% \end{macro} -% \end{macro} -% % \begin{macro}{\caption@AtBeginDocument} % \changes{v1.1}{2007/04/13}{This macro and its usage added} % \changes{v1.2e}{2010/01/09}{Adapted to the combine document class} @@ -591,7 +550,7 @@ % \end{macrocode} % \end{macro} % -% \subsection{Information, Warnings, and Errors} +% \section{Information, Warnings, and Errors} % % \begin{macro}{\caption@Info} % \changes{v1.3}{2010/10/25}{Moved from package to kernel} @@ -658,7 +617,7 @@ % \end{macrocode} % \end{macro} % -% \subsection{Using the keyval package} +% \section{Using the keyval package} % % We need the \package{keyval} package for option handling, so we load it here. % \begin{macrocode} @@ -1127,7 +1086,7 @@ % \end{macrocode} % \end{macro} % -% \subsection{Margin resp. width} +% \section{Margin resp. width} % \changes{v1.0n}{2007/04/01}{\cs{captionmarginx} renamed to \cs{captionmargin@}} % \changes{v1.0n}{2007/04/03}{Option `twoside' added} % \changes{v1.1}{2007/08/11}{Options `margin*', `minmargin', and `maxmargin' added} @@ -1369,7 +1328,7 @@ % \end{macrocode} % \end{macro} % -% \subsection{Indentions} +% \section{Indentions} % % \begin{macro}{\caption@indent} % \changes{v1.1}{2007/07/29}{Renamed from \cs{captionindent} to \cs{caption@indent}} @@ -1404,59 +1363,7 @@ \l@addto@macro\caption@@par{\setlength\parskip{#1}}} % \end{macrocode} % -% \changes{v1.0f}{2005/08/22}{Increased compatibility to KOMA-Script: -% A special version of options `parindent' and `parskip' added} -% \changes{v1.0g}{2006/01/03}{Bugfix 06-01-03: KOMA-Script variants of -% `parskip' and `parindent' options revised and moved into caption kernel} -% \changes{v1.0h}{2006/02/23}{KOMA-Script variants of `parskip' and -% `parindent' are obsolete now, removed} -% \changes{v1.0m}{2007/03/30}{KOMA-Script variants of `parskip' and -% `parindent' re-added, since they still collide with the current -% version of the subfig package (Sigh!)} -% -% There is an option clash between the \KOMAScript\ document classes -% and the \package{caption} kernel, both define the options |parindent| and -% |parskip| but with different meaning. -% Furthermore the ones defined by the \package{caption} kernel take a -% value as parameter but the \KOMAScript\ ones do not. -% So we need special versions of the options |parindent| and |parskip| here -% which determine if a value is given (and therefore should be treated as -% our option) or not (and therefore should be ignored by us).\footnote{%^^A -% This problem was completely solved due a change of \cs{caption@ProcessOptions} -% in \thispackage\ \version{1.0h}, but we still need this workaround since -% these options would otherwise still collide with the current version $1.3$ -% of the \package{subfig} package (Sigh!)} -% \begin{macrocode} -\providecommand*\caption@ifkomaclass{% - \caption@ifundefined\scr@caption\@gobble\@firstofone} -\@onlypreamble\caption@ifkomaclass -% \end{macrocode} -% \begin{macrocode} -\caption@ifkomaclass{% -% \end{macrocode} -% \begin{macrocode} - \let\caption@KV@parindent\KV@caption@parindent - \DeclareCaptionOption{parindent}[]{% - \ifx,#1,% - \caption@Debug{Option `parindent' ignored}% - \else - \caption@KV@parindent{#1}% - \fi}% -% \end{macrocode} -% \begin{macrocode} - \let\caption@KV@parskip\KV@caption@parskip - \DeclareCaptionOption{parskip}[]{% - \ifx,#1,% - \caption@Debug{Option `parskip' ignored}% - \else - \caption@KV@parskip{#1}% - \fi}% -% \end{macrocode} -% \begin{macrocode} -} -% \end{macrocode} -% -% \subsection{Styles} +% \section{Styles} % % \begin{macro}{\DeclareCaptionStyle} % \changes{v1.0a}{2004/01/17}{Pass through argument \#3 so extra spaces @@ -1564,7 +1471,7 @@ \DeclareCaptionOption{slc}[1]{\KV@caption@singlelinecheck{#1}} % \end{macrocode} % -% \subsection{Boxes} +% \section{Boxes} % % \begin{macro}{\DeclareCaptionBox} % \changes{v1.5}{2012/03/15}{This macro added} @@ -1627,7 +1534,7 @@ \def\caption@box@default{\caption@box@none} % \end{macrocode} % -% \subsection{Formats} +% \section{Formats} % % \begin{macro}{\DeclareCaptionFormat} % \changes{v1.0a}{2004/01/17}{Pass through argument \#3 so extra spaces @@ -1720,7 +1627,7 @@ \DeclareCaptionDefaultFormat{plain} % \end{macrocode} % -% \subsection{Label formats} +% \section{Label formats} % % \begin{macro}{\DeclareCaptionLabelFormat} % \changes{v1.0a}{2004/01/17}{% @@ -1768,7 +1675,7 @@ \def\caption@lfmt@default{\caption@lfmt@simple} % \end{macrocode} % -% \subsection{Label separators} +% \section{Label separators} % % \begin{macro}{\DeclareCaptionLabelSeparator} % \changes{v1.0a}{2004/01/17}{Pass through argument \#2 so extra spaces @@ -1856,7 +1763,7 @@ \caption@set@default@labelsep{colon} % \end{macrocode} % -% \subsection{Text formats} +% \section{Text formats} % % \begin{macro}{\DeclareCaptionTextFormat} % \changes{v1.0j}{2007/02/18}{This macro added} @@ -1953,7 +1860,7 @@ % \end{macrocode} % \end{macro} % -% \subsection{Fonts} +% \section{Fonts} % % \begin{macro}{\DeclareCaptionFont} % \changes{v1.0a}{2004/01/22}{% @@ -2151,8 +2058,8 @@ % \changes{v1.2d}{2009/10/09}{Bugfix 09-05-18: \package{setspace} package support revised} % \begin{macrocode} \DeclareCaptionFont{singlespacing}{% - \caption@ifundefined\setspace@singlespace{}{% - \setstretch\setspace@singlespace}}% normally 1 + \caption@ifdefined\setspace@singlespace{% + \setstretch\setspace@singlespace}{}}% normally 1 \DeclareCaptionFont{onehalfspacing}{\onehalfspacing} \DeclareCaptionFont{doublespacing}{\doublespacing} \DeclareCaptionFont{stretch}{\setstretch{#1}} @@ -2178,7 +2085,7 @@ \DeclareCaptionDefaultFont{size}{} % \end{macrocode} % -% \subsection{Justifications} +% \section{Justifications} % % \begin{macro}{\DeclareCaptionJustification} % \changes{v1.0a}{2004/01/17}{Pass through argument \#2 so extra spaces @@ -2261,7 +2168,7 @@ % \end{macrocode} % \end{macro} % -% \subsubsection{The ragged2e package} +% \subsection{The ragged2e package} % \changes{v1.0b}{2004/05/16}{Improved \package{ragged2e} package support} % % We also support the upper-case commands offered by the \package{ragged2e} @@ -2353,7 +2260,7 @@ % \end{macrocode} % \end{macro} % -% \subsection{Vertical spaces before and after captions} +% \section{Vertical spaces before and after captions} % % \begin{macro}{\abovecaptionskip} % \begin{macro}{\belowcaptionskip} @@ -2392,7 +2299,7 @@ \DeclareCaptionOption{rule}[1]{\caption@set@bool\caption@ifrule{#1}} % \end{macrocode} % -% \subsection{Positioning} +% \section{Positioning} % % These macros handle the right position of the caption. % Note that the position is actually \emph{not} controlled by the @@ -2517,7 +2424,7 @@ % \end{macrocode} % \end{macro} % -% \subsection{Hooks} +% \section{Hooks} % % \begin{macro}{\AtBeginCaption} % \begin{macro}{\AtEndCaption} @@ -2533,7 +2440,7 @@ % \end{macro} % \end{macro} % -% \subsection{Lists} +% \section{Lists} % % \changes{v1.0b}{2004/05/16}{Option \opt{listof=} added} % \changes{v1.2}{2007/11/17}{Option \opt{list=} added} @@ -2642,7 +2549,7 @@ \caption@set@default@listformat{subsimple} % \end{macrocode} % -% \subsection{Debug option} +% \section{Debug option} % \changes{v1.0k}{2007/03/04}{Debug option added} % % \begin{macrocode} @@ -2659,44 +2566,73 @@ \setkeys{caption}{debug=0} % \end{macrocode} % -% \subsection{Document classes \& Babel support} -% -% \subsubsection{The standard \texorpdfstring{\LaTeX{}}{LaTeX} classes} +% \section{Document classes \& Babel support} % +% \begin{macro}{\caption@ifdocumentclass} +% Boolean switch which is set if the document class could be detected successfully, +% i.e. |\caption@document|\-|class| is set to a proper value. +% (If |\caption@document|\-|class| is already set, this flag will also be set.) % \begin{macrocode} -\caption@CheckCommand\@makecaption{% - % article|report|book [2005/09/16 v1.4f Standard LaTeX document class] - \long\def\@makecaption#1#2{% - \vskip\abovecaptionskip - \sbox\@tempboxa{#1: #2}% - \ifdim \wd\@tempboxa >\hsize - #1: #2\par - \else - \global \@minipagefalse - \hb@xt@\hsize{\hfil\box\@tempboxa\hfil}% - \fi - \vskip\belowcaptionskip}} +\caption@setbool{documentclass}{1} % \end{macrocode} +% \end{macro} % -% \subsubsection{The elsarticle classes} -% \changes{v1.5}{2013/01/06}{elsarticle class support added} -% -% \begin{macro}{\caption@ifelsarticleclass} +% \begin{macro}{\caption@documentclass} +% \changes{v1.8e}{2018/05/11}{This macro added} +% Determine document class used. +% Set |\caption@document|\-|class| by good-guessing, if not already set. % \begin{macrocode} -\providecommand*\caption@ifelsarticleclass{% - \@ifclassloaded{elsarticle}\@firstofone\@gobble} -\@onlypreamble\caption@ifelsarticleclass +\caption@ifundefined\caption@documentclass{% +% \end{macrocode} +% \begin{macrocode} + \@ifclassloaded{beamer}{% + \caption@InfoNoLine{beamer document class detected}% + \def\caption@documentclass{beamer}% % \end{macrocode} -% \end{macro} -% % \begin{macrocode} -\caption@ifelsarticleclass{% + }{\@ifclassloaded{elsarticle}{% + \caption@InfoNoLine{elsarticle document class detected}% + \def\caption@documentclass{elsarticle}% % \end{macrocode} % \begin{macrocode} - \caption@CheckCommand\@makecaption{% - % elsarticle.cls,v 1.20 2008-10-13 04:24:12 cvr Exp - \long\def\@makecaption#1#2{% - \vskip\abovecaptionskip\footnotesize + }{\@ifclassloaded{memoir}{% + \caption@InfoNoLine{memoir document class detected}% + \def\caption@documentclass{memoir}% +% \end{macrocode} +% \begin{macrocode} + }{\caption@ifdefined\scr@caption{% + \caption@InfoNoLine{KOMA-Script document class detected}% + \def\caption@documentclass{koma}% +% \end{macrocode} +% If |\@captionheadfont| is defined, we assume it's a AMS or SMF document class. +% \begin{macrocode} + }{\caption@ifdefined\@captionheadfont{% + \caption@InfoNoLine{AMS or SMF document class detected}% + \def\caption@documentclass{ams}% +% \end{macrocode} +% If |\@CaptionFonts| is defined, we assume it's a NTG Dutch document class. +% \begin{macrocode} + }{\caption@ifdefined\CaptionFonts{% + \caption@InfoNoLine{NTG document class detected}% + \def\caption@documentclass{ntg}% +% \end{macrocode} +% If |\cph@font| and |\cpb@font| are defined, we assume it's a NTG Dutch document class. +% \begin{macrocode} + }{\caption@ifdefined\cph@font{% + \caption@ifdefined\cpb@font\@firstoftwo\@secondoftwo + }{% + \@secondoftwo + }{% + \caption@InfoNoLine{thesis document class detected}% + \def\caption@documentclass{thesis}% + }{% +% \end{macrocode} +% If the definition of |\@makecaption| matches the one from the standard \LaTeX\ document classes +% |article|, |report|, or |book|, we assume it's either one of them or is compatible to them. +% \begin{macrocode} + % article|report|book [2005/09/16 v1.4f Standard LaTeX document class] + \long\def\caption@tempa#1#2{% + \vskip\abovecaptionskip \sbox\@tempboxa{#1: #2}% \ifdim \wd\@tempboxa >\hsize #1: #2\par @@ -2705,98 +2641,68 @@ \hb@xt@\hsize{\hfil\box\@tempboxa\hfil}% \fi \vskip\belowcaptionskip}} + \ifx\caption@tempa\@makecaption + \caption@InfoNoLine{Standard document class detected}% + \else % \end{macrocode} +% Otherwise we are clueless and use standard default settings for the captions anyway. +% (And we unset the |document|\-|class| flag to indicate that the content of |\caption@document|\-|class| is not correct.) % \begin{macrocode} - \DeclareCaptionDefaultFont{font}{\footnotesize} + \caption@InfoNoLine{% + Unknown document class (or package),\MessageBreak + standard defaults will be used}% + \caption@InfoNoLine{\string\@makecaption\space=\space\meaning\@makecaption\@gobble}% + \caption@setbool{documentclass}{0}% + \fi + \def\caption@documentclass{base}% + }}}}}}% +}{} % \end{macrocode} +% \end{macro} +% +% \begin{macro}{\caption@ifclassloaded} +% \changes{v1.8e}{2019/09/09}{This macro added} +% |\caption@ifclassloaded|\marg{name}\marg{yes-code}\marg{no-code} % \begin{macrocode} -} +\newcommand*\caption@ifclassloaded[1]{% + \edef\caption@tempa{#1}% + \ifx\caption@tempa\caption@documentclass + \expandafter\@firstoftwo + \else + \expandafter\@secondoftwo + \fi} % \end{macrocode} +% \end{macro} % -% \subsubsection{The \AmS{} \& \SmF{} classes} -% \changes{v1.1}{2007/07/29}{\AmS\ \& \SmF\ classes support added} +% \subsection{The standard \texorpdfstring{\LaTeX{}}{LaTeX} classes} +% +% Since this is the default, there is no extra work to be done here. +% +% \subsection{The elsarticle classes} +% \changes{v1.5}{2013/01/06}{elsarticle class support added} % -% \begin{macro}{\caption@ifamsclass} % \begin{macrocode} -\providecommand*\caption@ifamsclass{% - \caption@ifundefined\@captionheadfont\@gobble\@firstofone} -\@onlypreamble\caption@ifamsclass +\caption@ifclassloaded{elsarticle}{% % \end{macrocode} -% \end{macro} -% % \begin{macrocode} -\caption@ifamsclass{% + \DeclareCaptionDefaultFont{font}{\footnotesize} % \end{macrocode} % \begin{macrocode} - \caption@CheckCommand\@makecaption{% - % amsart|amsproc|amsbook [2004/08/06 v2.20] - \long\def\@makecaption#1#2{% - \setbox\@tempboxa\vbox{\color@setgroup - \advance\hsize-2\captionindent\noindent - \@captionfont\@captionheadfont#1\@xp\@ifnotempty\@xp - {\@cdr#2\@nil}{.\@captionfont\upshape\enspace#2}% - \unskip\kern-2\captionindent\par - \global\setbox\@ne\lastbox\color@endgroup}% - \ifhbox\@ne % the normal case - \setbox\@ne\hbox{\unhbox\@ne\unskip\unskip\unpenalty\unkern}% - \fi - \ifdim\wd\@tempboxa=\z@ % this means caption will fit on one line - \setbox\@ne\hbox to\columnwidth{\hss\kern-2\captionindent\box\@ne\hss}% - \else % tempboxa contained more than one line - \setbox\@ne\vbox{\unvbox\@tempboxa\parskip\z@skip - \noindent\unhbox\@ne\advance\hsize-2\captionindent\par}% - \fi - \ifnum\@tempcnta<64 % if the float IS a figure... - \addvspace\abovecaptionskip - \hbox to\hsize{\kern\captionindent\box\@ne\hss}% - \else % if the float IS NOT a figure... - \hbox to\hsize{\kern\captionindent\box\@ne\hss}% - \nobreak - \vskip\belowcaptionskip - \fi - \relax - }} +}{} % \end{macrocode} +% +% \subsection{The \AmS{} \& \SmF{} classes} +% \changes{v1.1}{2007/07/29}{\AmS\ \& \SmF\ classes support added} +% % \begin{macrocode} - \caption@CheckCommand\@makecaption{% - % smfart|smfbook [1999/11/15 v1.2f Classe LaTeX pour les articles publies par la SMF] - \long\def\@makecaption#1#2{% - \ifdim\captionindent>.1\hsize \captionindent.1\hsize \fi - \setbox\@tempboxa\vbox{\color@setgroup - \advance\hsize-2\captionindent\noindent - \@captionfont\@captionheadfont#1\@xp\@ifnotempty\@xp - {\@cdr#2\@nil}{\@addpunct{.}\@captionfont\upshape\enspace#2}% - \unskip\kern-2\captionindent\par - \global\setbox\@ne\lastbox\color@endgroup}% - \ifhbox\@ne % the normal case - \setbox\@ne\hbox{\unhbox\@ne\unskip\unskip\unpenalty\unkern}% - \fi - \ifdim\wd\@tempboxa=\z@ % this means caption will fit on one line - \setbox\@ne\hbox to\columnwidth{\hss\kern-2\captionindent\box\@ne\hss}% - \@tempdima\wd\@ne\advance\@tempdima-\captionindent - \wd\@ne\@tempdima - \else % tempboxa contained more than one line - \setbox\@ne\vbox{\rightskip=0pt plus\captionindent\relax - \unvbox\@tempboxa\parskip\z@skip - \noindent\unhbox\@ne\advance\hsize-2\captionindent\par}% - \fi - \ifnum\@tempcnta<64 % if the float IS a figure... - \addvspace\abovecaptionskip - \noindent\kern\captionindent\box\@ne - \else % if the float IS NOT a figure... - \noindent\kern\captionindent\box\@ne - \nobreak - \vskip\belowcaptionskip - \fi - \relax - }} +\caption@ifclassloaded{ams}{% % \end{macrocode} % \begin{macrocode} \let\captionmargin\captionindent % set to 3pc by AMS class \begingroup\edef\@tempa{\endgroup \noexpand\caption@g@addto@list\noexpand\caption@sty@default {margin=\the\captionmargin - \caption@ifundefined\smf@makecaption{}{,maxmargin=.1\linewidth}}} + \caption@ifdefined\smf@makecaption{,maxmargin=.1\linewidth}{}}} \@tempa \caption@g@addto@list\caption@sls@default{margin*=.5\captionmargin} \DeclareCaptionLabelSeparator{default}{.\enspace} @@ -2807,10 +2713,10 @@ \captionsetup[table]{position=t} % \end{macrocode} % \begin{macrocode} -} +}{} % \end{macrocode} % -% \subsubsection{The beamer class (Part one)} +% \subsection{The beamer class (Part one)} % \changes{v1.1}{2007/03/10}{\package{beamer} class support added} % \changes{v1.3}{2011/08/06}{\package{beamer} class support revised} % \changes{v1.5}{2013/04/27}{The \package{beamer} template \texttt{caption label separator} will be used now} @@ -2818,33 +2724,8 @@ % \changes{v1.7}{2018/04/15}{Re-definition of label format \texttt{simpleMagyar} revised} % \changes{v1.7}{2018/05/01}{Definition of \package{beamer} default label font revised} % -% \begin{macro}{\caption@ifbeamerclass} -% \begin{macrocode} -\providecommand*\caption@ifbeamerclass{% - \@ifclassloaded{beamer}\@firstofone\@gobble} -\@onlypreamble\caption@ifbeamerclass -% \end{macrocode} -% \end{macro} -% % \begin{macrocode} -\caption@ifbeamerclass{% -% \end{macrocode} -% \begin{macrocode} - \caption@CheckCommand\beamer@makecaption{% - % beamerbaselocalstructure.sty,v 1.53 2007/01/28 20:48:21 tantau - \long\def\beamer@makecaption#1#2{% - \def\insertcaptionname{\csname#1name\endcsname}% - \def\insertcaptionnumber{\csname the#1\endcsname}% - \def\insertcaption{#2}% - \nobreak\vskip\abovecaptionskip\nobreak - \sbox\@tempboxa{\usebeamertemplate**{caption}}% - \ifdim \wd\@tempboxa >\hsize - \usebeamertemplate**{caption}\par - \else - \global \@minipagefalse - \hb@xt@\hsize{\hfil\box\@tempboxa\hfil}% - \fi - \nobreak\vskip\belowcaptionskip\nobreak}} +\caption@ifclassloaded{beamer}{% % \end{macrocode} % % \begin{macro}{\caption@ifbeamertemplate} @@ -2926,38 +2807,14 @@ % \begin{macrocode} % % \begin{macrocode] -} +}{} % \end{macrocode} % -% \subsubsection{The KOMA-Script classes} +% \subsection{The KOMA-Script classes} % \changes{v1.1}{2007/03/31}{\KOMAScript\ classes support added} % -% \begin{macro}{\caption@ifkomaclass} % \begin{macrocode} -\providecommand*\caption@ifkomaclass{% - \caption@ifundefined\scr@caption\@gobble\@firstofone} -\@onlypreamble\caption@ifkomaclass -% \end{macrocode} -% \end{macro} -% -% \begin{macrocode} -\caption@ifkomaclass{% -% \end{macrocode} -% \begin{macrocode} - \caption@CheckCommand\@makecaption{% - % scrartcl|scrreprt|scrbook [2007/03/07 v2.97a KOMA-Script document class] - \long\def\@makecaption#1#2{% - \if@captionabove - \vskip\belowcaptionskip - \else - \vskip\abovecaptionskip - \fi - \@@makecaption\@firstofone{#1}{#2}% - \if@captionabove - \vskip\abovecaptionskip - \else - \vskip\belowcaptionskip - \fi}} +\caption@ifclassloaded{koma}{% % \end{macrocode} % \begin{macrocode} \DeclareCaptionFormat{default}[#1#2#3\par]{% @@ -2981,74 +2838,71 @@ \DeclareCaptionDefaultFont{font}{\scr@fnt@caption} \DeclareCaptionDefaultFont{labelfont}{\scr@fnt@captionlabel} % \end{macrocode} -% \begin{macrocode} -} -% \end{macrocode} % -% \subsubsection{The \NTG{} Dutch classes} -% \changes{v1.1}{2007/04/06}{NTG classes support added} +% \changes{v1.0f}{2005/08/22}{Increased compatibility to KOMA-Script: +% A special version of options `parindent' and `parskip' added} +% \changes{v1.0g}{2006/01/03}{Bugfix 06-01-03: KOMA-Script variants of +% `parskip' and `parindent' options revised and moved into caption kernel} +% \changes{v1.0h}{2006/02/23}{KOMA-Script variants of `parskip' and +% `parindent' are obsolete now, removed} +% \changes{v1.0m}{2007/03/30}{KOMA-Script variants of `parskip' and +% `parindent' re-added, since they still collide with the current +% version of the subfig package (Sigh!)} % -% \begin{macro}{\caption@ifntgclass} +% There is an option clash between the \KOMAScript\ document classes +% and the \package{caption} kernel, both define the options |parindent| and +% |parskip| but with different meaning. +% Furthermore the ones defined by the \package{caption} kernel take a +% value as parameter but the \KOMAScript\ ones do not. +% So we need special versions of the options |parindent| and |parskip| here +% which determine if a value is given (and therefore should be treated as +% our option) or not (and therefore should be ignored by us).\footnote{%^^A +% This problem was completely solved due a change of \cs{caption@ProcessOptions} +% in \thispackage\ \version{1.0h}, but we still need this workaround since +% these options would otherwise still collide with the current version $1.3$ +% of the \package{subfig} package (Sigh!)} % \begin{macrocode} -\providecommand*\caption@ifntgclass{% - \caption@ifundefined\CaptionFonts\@gobble\@firstofone} -\@onlypreamble\caption@ifntgclass + \let\caption@KV@parindent\KV@caption@parindent + \DeclareCaptionOption{parindent}[]{% + \ifx,#1,% + \caption@Debug{Option `parindent' ignored}% + \else + \caption@KV@parindent{#1}% + \fi}% % \end{macrocode} -% \end{macro} -% % \begin{macrocode} -\caption@ifntgclass{% + \let\caption@KV@parskip\KV@caption@parskip + \DeclareCaptionOption{parskip}[]{% + \ifx,#1,% + \caption@Debug{Option `parskip' ignored}% + \else + \caption@KV@parskip{#1}% + \fi}% % \end{macrocode} % \begin{macrocode} - \caption@CheckCommand\@makecaption{% - % artikel|rapport|boek [2004/06/07 v2.1a NTG LaTeX document class] - \long\def\@makecaption#1#2{% - \vskip\abovecaptionskip - \sbox\@tempboxa{{\CaptionLabelFont#1:} \CaptionTextFont#2}% - \ifdim \wd\@tempboxa >\hsize - {\CaptionLabelFont#1:} \CaptionTextFont#2\par - \else - \global \@minipagefalse - \hb@xt@\hsize{\hfil\box\@tempboxa\hfil}% - \fi - \vskip\belowcaptionskip}} +}{} +% \end{macrocode} +% +% \subsection{The \NTG{} Dutch classes} +% \changes{v1.1}{2007/04/06}{NTG classes support added} +% +% \begin{macrocode} +\caption@ifclassloaded{ntg}{% % \end{macrocode} % \begin{macrocode} \DeclareCaptionDefaultFont{labelfont}{\CaptionLabelFont} \DeclareCaptionDefaultFont{textfont}{\CaptionTextFont} % \end{macrocode} % \begin{macrocode} -} +}{} % \end{macrocode} % -% \subsubsection{The thesis class} +% \subsection{The thesis class} % \changes{v1.2a}{2008/01/31}{thesis class support added} % \changes{v1.2e}{2009/11/15}{Bugfix 09-11-14: thesis class support revised} % -% \begin{macro}{\caption@ifthesisclass} % \begin{macrocode} -\providecommand*\caption@ifthesisclass{% - \caption@ifundefined\cph@font - {\@gobble}% - {\caption@ifundefined\cpb@font\@gobble\@firstofone}} -% \end{macrocode} -% \end{macro} -% -% \begin{macrocode} -\caption@ifthesisclass{% -% \end{macrocode} -% \begin{macrocode} - \caption@CheckCommand\@makecaption{% - % thesis.cls 1996/25/01 1.0g LaTeX document class (wm). - \long\def\@makecaption#1#2{% - \vskip\abovecaptionskip - \setbox\@tempboxa\hbox{{\cph@font #1:} {\cpb@font #2}}% - \ifdim \wd\@tempboxa >\hsize - \@hangfrom{\cph@font #1: }{\cpb@font #2\par}% - \else - \hbox to\hsize{\hfil\box\@tempboxa\hfil}% - \fi - \vskip\belowcaptionskip}} +\caption@ifclassloaded{thesis}{% % \end{macrocode} % \begin{macrocode} \DeclareCaptionDefaultFormat{hang} @@ -3056,23 +2910,23 @@ \DeclareCaptionDefaultFont{textfont}{\cpb@font} % \end{macrocode} % \begin{macrocode} -} +}{} % \end{macrocode} % -% \subsubsection{The arabic Babel option} +% \subsection{The arabic Babel option} % \changes{v1.8}{2018/05/20}{\package{arabic} babel package support added} % % \begin{macrocode} -\caption@ifundefined\ArabiCoreLoaded{% +\caption@ifdefined\ArabiCoreLoaded{% % \end{macrocode} +% % \begin{macro}{\caption@rl} % \changes{v1.8}{2018/05/20}{This macro added} % \begin{macrocode} - \let\caption@rl\@firstofone -}{% \newcommand\caption@rl[1]{\if@rl\textRL{#1}\else\textLR{#1}\fi} % \end{macrocode} % \end{macro} +% % \begin{macrocode} \def\fnum@figure{\figurename\nobreakspace\thefigure}% \def\fnum@table{\tablename\nobreakspace\thetable}% @@ -3083,51 +2937,16 @@ \if@rl\caption@lsep@arabi\else\caption@lsep@colon\fi} % \end{macrocode} % \begin{macrocode} - \caption@CheckCommand\@makecaption{% - % arabicore.sty [2006/01/01 v1.0 Arabi Core switching commands (may still change)] - \long\def\@makecaption#1#2{% - \vskip\abovecaptionskip - \sbox\@tempboxa{#1: #2}% - \sbox\@Arabitempboxa{\textRL{#2} : #1}% - \if@rl{ - \ifdim \wd\@Arabitempboxa >\hsize - \textRL{#2} : #1\par - \else - \global \@minipagefalse - \hb@xt@\hsize{\hfil\box\@Arabitempboxa\hfil}% - \fi}\else{ - \ifdim \wd\@tempboxa >\hsize - #1: #2\par - \else - \global \@minipagefalse - \hb@xt@\hsize{\hfil\box\@tempboxa\hfil}% - \fi}\fi - \vskip\belowcaptionskip}} -% \end{macrocode} -% \begin{macrocode} +}{% + \let\caption@rl\@firstofone } % \end{macrocode} % -% \subsubsection{The frenchb Babel option} +% \subsection{The frenchb Babel option} % \changes{v1.1}{2006/05/14}{\package{frenchb} babel package support added} % % \begin{macrocode} -\caption@ifundefined\FB@makecaption{}{% -% \end{macrocode} -% \begin{macrocode} - \caption@CheckCommand\@makecaption{% - % frenchb.ldf [2005/02/06 v1.6g French support from the babel system] - % frenchb.ldf [2007/10/05 v2.0e French support from the babel system] - \long\def\@makecaption#1#2{% - \vskip\abovecaptionskip - \sbox\@tempboxa{#1\CaptionSeparator #2}% - \ifdim \wd\@tempboxa >\hsize - #1\CaptionSeparator #2\par - \else - \global \@minipagefalse - \hb@xt@\hsize{\hfil\box\@tempboxa\hfil}% - \fi - \vskip\belowcaptionskip}} +\caption@ifdefined\FB@makecaption{% % \end{macrocode} % \begin{macrocode} \ifx\@makecaption\STD@makecaption @@ -3145,69 +2964,24 @@ \fi % \end{macrocode} % \begin{macrocode} -} +}{} % \end{macrocode} % -% \subsubsection{The frenchle/pro package} +% \subsection{The frenchle/pro package} % \changes{v1.1}{2006/05/14}{\package{frenchle/pro} package support added} % % \begin{macrocode} -\caption@ifundefined\frenchTeXmods{}{% -% \end{macrocode} -% \begin{macrocode} - \caption@CheckCommand\@makecaption{% - % french(le).sty [2006/10/03 The french(le) package /V5,9991/] - % french(le).sty [2007/06/28 The french(le) package /V5,9994/] - \def\@makecaption#1#2{% - \ifFTY% - \def\@secondofmany##1##2\void{##2}% - \def\@tempa{\@secondofmany#2\void}% - \ifx\@tempa\empty% - \let\captionseparator\empty% - \fi% - \@mcORI{#1}{\relax\captionfont{#2}}% - \else - \@mcORI{#1}{#2}% - \fi}}% -% \end{macrocode} -% \begin{macrocode} - \caption@CheckCommand\@makecaption{% - % french(le).sty [2007/02/11 The french(le) package /V5,9993/] - \def\@makecaption#1#2{% - \ifFTY% - \def\@secondofmany##1##2\void{##2}% - \protected@edef\@tempa{\@secondofmany#2\void}% - \ifx\@tempa\empty% - \let\captionseparator\empty% - \fi% - \@mcORI{#1}{\relax\captionfont{#2}}% - \else - \@mcORI{#1}{#2}% - \fi}}% +\caption@ifdefined\frenchTeXmods{% % \end{macrocode} % \begin{macrocode} \DeclareCaptionDefaultFont{textfont}{\itshape}% \DeclareCaptionLabelSeparator{default}{\captionseparator\space}% % \end{macrocode} % \begin{macrocode} -} -% \end{macrocode} -% -% \subsubsection{The hebrew Babel option} -% \changes{v1.8}{2018/08/26}{\package{hebrew} package support added} -% -% \begin{macrocode} - \caption@CheckCommand\@makecaption{% - % rlbabel.def [2005/03/30 v2.3h Right-to-Left support from the babel system Hebrew language support from the babel system] - \long\def\@makecaption#1#2{% - \vskip\abovecaptionskip% - \begin{center}% - #1: #2% - \end{center} \par% - \vskip\belowcaptionskip}}% +}{} % \end{macrocode} % -% \subsubsection{The hungarian and magyar Babel option} +% \subsection{The hungarian and magyar Babel option} % \changes{v1.3}{2009/03/29}{\package{magyar} package support added} % \changes{v1.3a}{2011/08/12}{\package{magyar} package support revised} % \changes{v1.8b}{2018/08/26}{\package{magyar} package support revised} @@ -3217,22 +2991,6 @@ % \end{macrocode} % % \begin{macrocode} -\caption@ifundefined\hunnewlabel{}{% - \caption@CheckCommand\@makecaption{% - % magyar.ldf [2005/03/30 v1.4j Magyar support from the babel system] - \def\@makecaption#1#2{% - \vskip\abovecaptionskip - \sbox\@tempboxa{#1. #2}% - \ifdim \wd\@tempboxa >\hsize - {#1. #2\csname par\endcsname} - \else - \global \@minipagefalse - \hb@xt@\hsize{\hfil\box\@tempboxa\hfil}% - \fi - \vskip\belowcaptionskip}}} -% \end{macrocode} -% -% \begin{macrocode} \def\caption@tempa#1{% \@ifpackagewith{babel}{#1}{% \caption@InfoNoLine{#1 babel option is loaded}% @@ -3253,22 +3011,7 @@ % % TODO: babel-latvian/latvian.ldf % -% \subsubsection{Unknown document class (or package)} -% \changes{v1.1}{2007/04/10}{Check of document class added} -% -% \begin{macrocode} -\caption@IfCheckCommand{% - \caption@setbool{documentclass}{1}% -}{% - \caption@setbool{documentclass}{0}% - \caption@InfoNoLine{% - Unknown document class (or package),\MessageBreak - standard defaults will be used}% - \caption@Debug{\string\@makecaption\space=\space\meaning\@makecaption\@gobble}% -} -% \end{macrocode} -% -% \subsection{Execution of options} +% \section{Execution of options} % % \begin{macrocode} \captionsetup{style=default,position=default,% @@ -3278,7 +3021,7 @@ \ProcessOptions* % \end{macrocode} % -% \subsection{Making an `List of' entry} +% \section{Making an `List of' entry} % % \begin{macro}{\caption@addcontentsline} % \changes{v1.1}{2007/07/01}{This macro added} @@ -3299,13 +3042,13 @@ \caption@ifcontentsline{#2}{% \begingroup \let\@tempa\@gobble - \caption@ifundefined\caption@listtype - {\edef\caption@listtype{#1}}% + \caption@ifdefined\caption@listtype {\let\@tempa\@firstofone}% - \caption@ifundefined\caption@listtype@ext - {}% + {\edef\caption@listtype{#1}}% + \caption@ifdefined\caption@listtype@ext {\edef\caption@listtype{\caption@listtype\caption@listtype@ext}% \let\@tempa\@firstofone}% + {}% \@tempa {\caption@Debug{addcontentsline: #1 => \caption@listtype}% % \caption@setoptions\caption@listtype @@ -3333,8 +3076,8 @@ % \end{macrocode} % \begin{macrocode} \newcommand*\caption@@@addcontentsline[4]{% -% \caption@ifundefined\main@Arabi@language{}% -% {\addtocontents{#1}{\xstring\select@language{\main@Arabi@language}}}% +% \caption@ifdefined\main@Arabi@language +% {\addtocontents{#1}{\xstring\select@language{\main@Arabi@language}}}{}% \addcontentsline{#1}{#2}{\protect\numberline{#3}{#4}}} % \end{macrocode} % \begin{macrocode} @@ -3356,7 +3099,7 @@ % \end{macrocode} % \end{macro} % -% \subsection{Typesetting the caption} +% \section{Typesetting the caption} % % \begin{macro}{\ifcaption@star} % If the starred form of |\caption| is used, this will be set to |true|. @@ -3833,7 +3576,7 @@ % \end{macrocode} % \end{macro} % -% \subsection{Types \& sub-types} +% \section{Types \& sub-types} % % \begin{macro}{\DeclareCaptionType} % \changes{v1.1}{2007/08/12}{This macro added} @@ -3860,13 +3603,13 @@ % will execute the given code for all (known) floating environments. % \begin{macrocode} \newcommand\caption@ForEachType[1]{% - \caption@ifundefined\ForEachFloatingEnvironment + \caption@ifdefined\ForEachFloatingEnvironment + {\ForEachFloatingEnvironment{#1}}% {\def\@elt##1{#1}% - \caption@ifundefined\c@figure\@gobble\@elt{figure}% - \caption@ifundefined\c@table\@gobble\@elt{table}% + \caption@ifdefined\c@figure\@elt\@gobble{figure}% + \caption@ifdefined\c@table\@elt\@gobble{table}% \let\@elt\relax - \newfloat@addtohook{#1}}% - {\ForEachFloatingEnvironment{#1}}} + \newfloat@addtohook{#1}}} % \end{macrocode} % \begin{macrocode} \providecommand\newfloat@addtohook[1]{% @@ -3920,8 +3663,8 @@ % \end{macrocode} % Support of \package{titletoc} package % \begin{macrocode} - \caption@ifundefined\contentsuse{}{% - \contentsuse{sub#3}{\csname ext@sub#3\endcsname}}% + \caption@ifdefined\contentsuse{% + \contentsuse{sub#3}{\csname ext@sub#3\endcsname}}{}% % \end{macrocode} % \begin{macrocode} \@namedef{sub#3name}{}% @@ -3939,9 +3682,9 @@ % \end{macrocode} % \begin{macrocode} \newcommand*\caption@declaresublistentry{% - \caption@ifundefined\l@chapter - {\caption@@declaresublistentry\l@subsubsection}% - {\caption@@declaresublistentry\l@subsection}} + \caption@ifdefined\l@chapter + {\caption@@declaresublistentry\l@subsection}% + {\caption@@declaresublistentry\l@subsubsection}} \@onlypreamble\caption@declaresublistentry % \end{macrocode} % \begin{macrocode} @@ -4062,7 +3805,7 @@ % \end{macrocode} % \end{macro} % -% \subsection{subfig package adaptions} +% \section{subfig package adaptions} % \changes{v1.1}{2007/07/07}{Several adaptions to the \package{subfig} package added} % \changes{v1.4a}{2011/11/01}{Bugfix 11-11-01: Test for the \package{subfig} package revised} % |