From c3e239f00a6acf27533100a75bf08fff3b5ea614 Mon Sep 17 00:00:00 2001 From: Karl Berry Date: Mon, 11 May 2020 20:46:52 +0000 Subject: caption (11may20) git-svn-id: svn://tug.org/texlive/trunk@55099 c570f23f-e606-0410-a88d-b1316a301751 --- Master/texmf-dist/doc/latex/caption/README | 2 +- Master/texmf-dist/source/latex/caption/caption.dtx | 123 +---- .../texmf-dist/source/latex/caption/caption3.dtx | 604 +++++++++++++-------- Master/texmf-dist/tex/latex/caption/caption.sty | 43 +- Master/texmf-dist/tex/latex/caption/caption3.sty | 282 ++++++---- 5 files changed, 553 insertions(+), 501 deletions(-) diff --git a/Master/texmf-dist/doc/latex/caption/README b/Master/texmf-dist/doc/latex/caption/README index fc43fccd45d..317e095646c 100644 --- a/Master/texmf-dist/doc/latex/caption/README +++ b/Master/texmf-dist/doc/latex/caption/README @@ -1,7 +1,7 @@ ========================================================================== The `caption' package bundle -Release 2020-01-22 +Release 2020-05-10 Copyright (C) 1994-2020 Axel Sommerfeldt (axel.sommerfeldt@f-m.fm) License: LPPL = LaTeX Project Public Licence diff --git a/Master/texmf-dist/source/latex/caption/caption.dtx b/Master/texmf-dist/source/latex/caption/caption.dtx index 1c5a196e139..06c2832c700 100644 --- a/Master/texmf-dist/source/latex/caption/caption.dtx +++ b/Master/texmf-dist/source/latex/caption/caption.dtx @@ -28,7 +28,7 @@ % caption-deu.tex, caption-eng.tex, caption-rus.tex. % % \fi -% \CheckSum{3044} +% \CheckSum{2977} % % \iffalse %<*driver> @@ -218,13 +218,13 @@ % % \begin{macrocode} \NeedsTeXFormat{LaTeX2e}[1994/12/01] -\ProvidesPackage{caption}[2020/01/03 v3.4h Customizing captions (AR)] +\ProvidesPackage{caption}[2020/05/10 v3.4j Customizing captions (AR)] % \end{macrocode} % % \section{Loading the kernel} % % \begin{macrocode} -\RequirePackage{caption3}[2020/01/03] % needs v1.8h or newer +\RequirePackage{caption3}[2020/05/10] % needs v1.10 or newer % \end{macrocode} % % \section{Check against unknown document classes} @@ -282,123 +282,6 @@ % % \section{Declaration of options} % -% \subsection{Options for figure and table} -% -% \changes{v3.0a}{2004/01/09}{Options \opt{figureposition} and \opt{tableposition} added} -% \begin{macrocode} -\DeclareCaptionOption{figureposition}{% - \captionsetup*[figure]{position=#1}} -\@onlypreamble@key{caption}{figureposition} -% \end{macrocode} -% \begin{macrocode} -\DeclareCaptionOption{tableposition}{% - \captionsetup*[table]{position=#1}} -\@onlypreamble@key{caption}{tableposition} -% \end{macrocode} -% -% \changes{v3.0d}{2004/08/03}{Options \opt{figurename} and \opt{tablename} added} -% \changes{v3.1}{2007/07/04}{Options \opt{figurename} and \opt{tablename} re-written} -% \changes{v3.1f}{2007/11/18}{Option \opt{name} added} -% \begin{macrocode} -\DeclareCaptionOption{figurename}{\caption@SetName{figure}{#1}} -\@onlypreamble@key{caption}{figurename} -\DeclareCaptionOption{tablename}{\caption@SetName{table}{#1}} -\@onlypreamble@key{caption}{tablename} -% \end{macrocode} -% -% \changes{v3.1g}{2008/02/28}{Options \opt{listfigurename} and \opt{listtablename} added} -% \begin{macrocode} -\DeclareCaptionOption{listfigurename}{\caption@SetName{listfigure}{#1}} -\@onlypreamble@key{caption}{listfigurename} -\DeclareCaptionOption{listtablename}{\caption@SetName{listtable}{#1}} -\@onlypreamble@key{caption}{listtablename} -% \end{macrocode} -% -% \begin{macro}{\caption@SetName} -% \changes{v3.1}{2007/07/04}{This macro added} -% \changes{v3.1f}{2007/11/18}{After-preamble variant added} -% \changes{v3.1g}{2008/02/28}{Renamed from \cs{caption@SetFloatName} to \cs{caption@SetName}} -% \changes{v3.1i}{2008/08/02}{Bugfix: Works now without \cs{addto}, too} -% \changes{v3.2d}{2011/10/29}{Outsourced to \package{newfloat} package} -% \changes{v3.2f}{2012/01/12}{Bugfix: Uses \cs{caption@NewFloat} now} -% |\caption@SetName|\marg{float}\marg{name} -% \begin{macrocode} -\newcommand*\caption@SetName[2]{% - \caption@NewFloat{\newfloat@setname{#1}{#2}}} -\@onlypreamble\caption@SetName -% \end{macrocode} -% \end{macro} -% -% \begin{macrocode} -\DeclareCaptionOption{name}{\caption@setname\@captype{#1}} -% \end{macrocode} -% \begin{macro}{\caption@setname} -% |\caption@setname|\marg{float}\marg{name} -% \begin{macrocode} -\newcommand*\caption@setname[2]{% - \@namedef{#1name}{#2}} -% \end{macrocode} -% \end{macro} -% -% \changes{v3.1f}{2007/12/21}{Options \opt{figurewithin} and \opt{tablewithin} added} -% \changes{v3.1i}{2008/04/13}{Option \opt{within} added} -% \changes{v3.1l}{2010/01/09}{The \opt{within} options are now available within the document, too} -% \changes{v3.1l}{2010/01/09}{The global \opt{within} option will now affect user-defined -% floats declared with \cs{DeclareCaptionType}, too} -% -% \begin{macro}{\caption@DeclareWithinOption} -% \changes{v3.1l}{2010/01/09}{This macro and its usage added} -% |\caption@DeclareWithinOption|\marg{float} -% declares the options \meta{float}\texttt{within} and \meta{float}\texttt{without}, -% e.g. \texttt{figurewithin} and \texttt{figurewithout}. -% \begin{macrocode} -\newcommand*\caption@DeclareWithinOption[1]{% - \DeclareCaptionOption{#1within}{\caption@Within{#1}{##1}}% - \DeclareCaptionOptionNoValue{#1without}{\caption@Within{#1}{none}}} -\@onlypreamble\caption@DeclareWithinOption -% \end{macrocode} -% \end{macro} -% \begin{macrocode} -\caption@DeclareWithinOption{figure} -\caption@DeclareWithinOption{table} -% \end{macrocode} -% \begin{macrocode} -\DeclareCaptionOption{within}{% - \caption@NewFloat{\newfloatsetup{within=#1}}} -\DeclareCaptionOptionNoValue{without}{% - \caption@NewFloat{\newfloatsetup{without}}} -% \end{macrocode} -% \begin{macro}{\caption@Within} -% \changes{v3.1}{2007/12/21}{This macro added} -% \changes{v3.2d}{2011/10/29}{Outsourced to \package{newfloat} package} -% \changes{v3.2f}{2012/01/12}{Bugfix: Uses \cs{caption@NewFloat} now} -% |\caption@Within|\marg{float}\marg{value} -% \begin{macrocode} -\newcommand*\caption@Within[2]{% - \caption@NewFloat{\newfloat@setwithin{#1}{#2}}} -% \end{macrocode} -% \end{macro} -% -% \begin{macro}{\caption@NewFloat} -% \changes{v3.2f}{2012/01/12}{This macro added} -% \changes{v3.4h}{2020/01/03}{Usage of \cs{caption@ifpackageloaded} replaced by \cs{RequirePackage}} -% |\caption@NewFloat|\marg{code} -% loads the \package{newfloat} package and executes the given code afterwards. -% Note: Since the \package{newfloat} package uses the crappy \package{keyval} -% package, too, we need to save \& restore some macros here, otherwise this -% recursion won't work properly. -% {\itshape (TODO: Re-write \package{newfloat} so it uses \package{kvoptions} instead.)} -% \begin{macrocode} -\newcommand*\caption@NewFloat[1]{% - \let\KV@prefix@ORI\KV@prefix - \let\@tempc@ORI\@tempc - \caption@ifdefined\newfloatsetup{}{\RequirePackage{newfloat}}% - #1% - \let\@tempc\@tempc@ORI - \let\KV@prefix\KV@prefix@ORI} -% \end{macrocode} -% \end{macro} -% % \subsection{Miscellaneous options} % % \begin{macrocode} diff --git a/Master/texmf-dist/source/latex/caption/caption3.dtx b/Master/texmf-dist/source/latex/caption/caption3.dtx index 5cd6a8d9eab..7319d178df1 100644 --- a/Master/texmf-dist/source/latex/caption/caption3.dtx +++ b/Master/texmf-dist/source/latex/caption/caption3.dtx @@ -28,7 +28,7 @@ % caption-deu.tex, caption-eng.tex, caption-rus.tex. % % \fi -% \CheckSum{3476} +% \CheckSum{3573} % % \iffalse %<*driver> @@ -191,7 +191,7 @@ % % \begin{macrocode} \NeedsTeXFormat{LaTeX2e}[1994/12/01] -\ProvidesPackage{caption3}[2020/01/03 v1.8h caption3 kernel (AR)] +\ProvidesPackage{caption3}[2020/05/10 v1.11 caption3 kernel (AR)] % \end{macrocode} % % \section{Workaround for bug in package \package{arabtex}} @@ -773,7 +773,6 @@ % \begin{macro}{\caption@checkoptions} % \changes{v1.8h}{2020/01/03}{This macro added} % Check the syntax of the given options by executing them inside a group. -% (This way the \package{ragged2e} package check will be done for these options, too.) % \begin{macrocode} \newcommand*\caption@checkoptions[1]{% \begingroup @@ -781,11 +780,21 @@ \caption@setup{#1}% \endgroup} % \end{macrocode} -% Some caption options depend on the definition of |\@captype|, -% so we set it to |figure| before executing them. % \begin{macrocode} -\newcommand*\caption@prepare@optioncheck{% - \def\@captype{figure}} +\providecommand*\caption@prepare@optioncheck{} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\IfCaptionOptionCheck} +% \changes{v1.10}{2020/05/10}{This macro added} +% |\IfCaptionOptionCheck|\marg{yes-code}\marg{no-code} +% executes the \meta{yes-code} if options are just checked for syntax, and \meta{no-code} if not. +% \begin{macrocode} +\let\IfCaptionOptionCheck\@secondoftwo +% \end{macrocode} +% \begin{macrocode} +\g@addto@macro\caption@prepare@optioncheck{% + \let\IfCaptionOptionCheck\@firstoftwo} % \end{macrocode} % \end{macro} % @@ -1078,17 +1087,17 @@ % will both be mapped to \meta{code} with \meta{package} and \meta{options} % as arguments |#1| and |#2|. (This helps avoiding ``Option clash'' errors.) % \begin{macrocode} -\newcommand*\caption@packagelist{} -\@onlypreamble\caption@packagelist -% \end{macrocode} -% \begin{macrocode} \newcommand\caption@SetupOptions[2]{% \@namedef{caption@setkeys@#1}##1##2{#2}% \expandafter\@onlypreamble\csname caption@setkeys@#1\endcsname - \@cons\caption@packagelist{{#1}}} + \@cons\caption@SetupOptions@list{{#1}}} \@onlypreamble\caption@SetupOptions % \end{macrocode} % \begin{macrocode} +\newcommand*\caption@SetupOptions@list{} +\@onlypreamble\caption@SetupOptions@list +% \end{macrocode} +% \begin{macrocode} \let\caption@onefilewithoptions\@onefilewithoptions \def\@onefilewithoptions#1[#2]{% \begingroup @@ -1104,7 +1113,7 @@ \caption@ExecuteOptions{#1}{#2}% \caption@onefilewithoptions{#1}[]}% \fi} - \caption@packagelist + \caption@SetupOptions@list \@tempa} \@onlypreamble\caption@onefilewithoptions % \end{macrocode} @@ -1891,16 +1900,44 @@ % \changes{v1.0a}{2004/01/22}{Bugfix: Multi token arguments are allowed now} % \changes{v1.1}{2007/05/07}{Internal: Uses \cs{caption@fnt} instead of \cs{caption@temp} now} % \changes{v1.8h}{2020/01/03}{Check for \package{ragged2e} package related options added} -% |\DeclareCaptionFont|\marg{name}\marg{code} +% \changes{v1.10}{2020/05/10}{Optional argument \opt{package} added} +% |\DeclareCaptionFont|\oarg{package}\marg{name}\marg{code} % \begin{macrocode} -\newcommand*\DeclareCaptionFont[2]{% - \define@key{caption@fnt}{#1}[]{\caption@addto@fnt{#2}}} +\newcommand*\DeclareCaptionFont{% + \@ifnextchar[%] + \caption@declare@font + \caption@declarefont} \@onlypreamble\DeclareCaptionFont % \end{macrocode} % \begin{macrocode} -\newcommand*\caption@addto@fnt[1]{% - \caption@check@ragged{#1}% - \l@addto@macro\caption@fnt{#1}} +\def\caption@declare@font[#1]#2{% + \global\@namedef{caption@fnt@#2@package}{#1}% + \caption@@declarefont{#2}} +\@onlypreamble\caption@declare@font +% \end{macrocode} +% \begin{macrocode} +\newcommand*\caption@declarefont[1]{% + \global\@nameundef{caption@fnt@#1@package}% + \caption@@declarefont{#1}} +\@onlypreamble\caption@declarefont +% \end{macrocode} +% \begin{macrocode} +\newcommand*\caption@@declarefont[2]{% + \define@key{caption@fnt}{#1}[]{\caption@addto@fnt{#1}{#2}}% + \caption@@@declarefont{#1}{#2}} +\@onlypreamble\caption@@declarefont +% \end{macrocode} +% \begin{macrocode} +\newcommand*\caption@@@declarefont[2]{}% will be used by \DeclareCaptionJustification +\@onlypreamble\caption@@@declarefont +% \end{macrocode} +% \begin{macrocode} +\newcommand*\caption@addto@fnt[2]{% + \expandafter\let\expandafter\caption@package\csname caption@fnt@#1@package\endcsname + \caption@ifdefined\caption@package + {\caption@requirepackage\caption@package{#1}}% load package, if necessary + {}% + \l@addto@macro\caption@fnt{#2}} % \end{macrocode} % \end{macro} % @@ -2078,26 +2115,8 @@ \DeclareCaptionFont{larger}{\caption@larger} % \end{macrocode} % -% \changes{v1.3}{2011/01/01}{\package{sansmath} package support added} -% \begin{macrocode} -\DeclareCaptionFont{sansmath}{\sansmath} -% \end{macrocode} -% -% \changes{v1.0n}{2007/04/02}{\package{setspace} package support added} -% \changes{v1.2d}{2009/10/09}{Bugfix 09-05-18: \package{setspace} package support revised} -% \begin{macrocode} -\DeclareCaptionFont{singlespacing}{% - \caption@ifdefined\setspace@singlespace{% - \setstretch\setspace@singlespace}{}}% normally 1 -\DeclareCaptionFont{onehalfspacing}{% - \caption@setspace{onehalfspacing}\onehalfspacing\relax} -\DeclareCaptionFont{doublespacing}{% - \caption@setspace{doublespacing}\doublespacing\relax} -\DeclareCaptionFont{stretch}{% - \caption@setspace{stretch}\setstretch\@gobble{#1}} -% \end{macrocode} % \begin{macrocode} -\newcommand*\caption@setspace{\caption@ifpackageloaded{setspace}} +\DeclareCaptionFont{singlespacing}{} % \end{macrocode} % % \begin{macrocode} @@ -2128,9 +2147,11 @@ % \changes{v1.1}{2007/07/03}{Mapped to \cs{DeclareCaptionFont}} % |\DeclareCaptionJustification|\marg{name}\marg{code} % \begin{macrocode} -\newcommand*\DeclareCaptionJustification[2]{% - \global\@namedef{caption@hj@#1}{#2}% for compatibility to v1.0 - \DeclareCaptionFont{#1}{#2}} +\newcommand*\DeclareCaptionJustification{% + \def\caption@@@declarefont##1##2{% + \global\@namedef{caption@hj@##1}{##2}% for compatibility to v1.0, needed by floatrow package + \let\caption@@@declarefont\@gobbletwo}% + \DeclareCaptionFont} \@onlypreamble\DeclareCaptionJustification % \end{macrocode} % \end{macro} @@ -2203,119 +2224,6 @@ % \end{macrocode} % \end{macro} % -% \subsection{The ragged2e package} -% \changes{v1.0b}{2004/05/16}{Improved \package{ragged2e} package support} -% \changes{v1.8h}{2020/01/03}{Revised \package{ragged2e} package support} -% -% We also support the upper-case commands offered by the \package{ragged2e} -% package. -% Note that these just map to their lower-case variants if the -% \package{ragged2e} package is not available. -% \begin{macrocode} -\DeclareCaptionJustification{Centering}{\caption@Centering} -\DeclareCaptionJustification{RaggedLeft}{\caption@RaggedLeft} -\DeclareCaptionJustification{RaggedRight}{\caption@RaggedRight} -% \end{macrocode} -% \begin{macrocode} -\newcommand*\caption@Centering{% - \caption@ragged{Centering}\Centering\centering} -\newcommand*\caption@RaggedLeft{% - \caption@ragged{RaggedLeft}\RaggedLeft\raggedleft} -\newcommand*\caption@RaggedRight{% - \caption@ragged{RaggedRight}\RaggedRight\raggedright} -% \end{macrocode} -% -% \begin{macro}{\caption@ragged} -% \changes{v1.0n}{2007/04/07}{The `ragged2e' package will now only been loaded when needed} -% \changes{v1.0o}{2007/04/11}{Bugfix: Usage of \cs{caption@Info} replaced by \cs{caption@Debug}} -% \changes{v1.1}{2007/04/16}{A different warning will be given on first \LaTeX\ run} -% \changes{v1.4f}{2012/01/12}{Uses \cs{caption@ifpackageloaded} now} -% |\caption@ragged|\marg{yes-code}\marg{no-code} -% executes the \meta{yes-code} if the \package{ragged2e} package is loaded and \meta{no-code} if not. -% \begin{macrocode} -\newcommand*\caption@ragged{\caption@ifpackageloaded{ragged2e}} -% \end{macrocode} -% \end{macro} -% -% \begin{macro}{\caption@ifpackageloaded} -% \changes{v1.4f}{2012/01/12}{This macro added} -% \changes{v1.8h}{2020/01/03}{Does not load the package anymore but issue an error message instead} -% |\caption@ifpackageloaded|\marg{package}\marg{option}\marg{yes-code}\marg{no-code} -% executes the \meta{yes-code} if the given package is loaded and \meta{no-code} if not. -% \begin{macrocode} -\newcommand*\caption@ifpackageloaded[4]{% - \caption@ifdefined#3#3{% - \caption@Error{Option `#2' requires the `#1' package\MessageBreak - (or an alternative definition of \string#3)}% - #4}} -% \end{macrocode} -% \end{macro} -% -% \begin{macro}{\caption@pkg@list} -% \changes{v1.4f}{2012/01/12}{This macro added} -% We use this as list of packages loaded |\AtBeginDocument|. -% (Note: Old |.aux| files could contain |\@cons|\-|\caption@pkg@list|\-|{{|\meta{package}|}}|, -% so this macro should always be defined, even if we change the following code in the future.) -% \begin{macrocode} -\newcommand*\caption@pkg@list{} -% \end{macrocode} -% \begin{macrocode} -\caption@AtBeginDocument{% - \def\caption@tempa{\endgroup}% - \begingroup - \def\@elt#1{% - \g@addto@macro\caption@tempa{% - \caption@InfoNoLine{Load package `#1'}% - \RequirePackage{#1}\relax}}% - \caption@pkg@list - \caption@tempa} -% \end{macrocode} -% \end{macro} -% -% \begin{macro}{\caption@check@ragged} -% \changes{v1.4h}{2020/01/03}{This macro added} -% In the past we tried to load the \package{ragged2e} package automatically if needed. -% But since we have dropped this unreliable code users will get an error message instead. -% To compensate for this change we try to detect the usage of the \package{ragged2e} -% at least within the preamble of the document. -% (Note: Checking the name of the option is not sufficient here since it could have -% been re-defined by the user. So we have to check the option code instead.) -% \begin{macrocode} -\@ifpackageloaded{ragged2e}{\let\caption@check@ragged\@gobble}{% -% \end{macrocode} -% \begin{macrocode} - \newcommand*\caption@check@ragged[1]{% - \begingroup - \def\caption@tempa{#1}% - \caption@check@ragged@{Centering}% - \caption@check@ragged@{RaggedLeft}% - \caption@check@ragged@{RaggedRight}% - \endgroup}% -% \end{macrocode} -% \begin{macrocode} - \newcommand*\caption@check@ragged@[1]{% - \expandafter\def\expandafter\caption@tempb\expandafter{\csname caption@#1\endcsname}% - \ifx\caption@tempa\caption@tempb % our definition of `ragged2e' option? - \@ifundefined{#1}{% - \caption@Info{Usage of `ragged2e' command \expandafter\string\csname #1\endcsname\space detected}% - \@cons\caption@pkg@list{{ragged2e}}% load `ragged2e' package later on - \global\let\caption@check@ragged\@gobble}{}% - \fi - }% -% \end{macrocode} -% \begin{macrocode} - \caption@AtBeginDocument{% - \let\caption@check@ragged\@gobble - \let\caption@check@ragged@\@undefined}} -% \end{macrocode} -% Make the \package{subfig} package documentation compile. -% \begin{macrocode} -%%\@ifl@aded{dtx}{subfig}{\RequirePackage{ragged2e}\relax}{} % not needed -\DeclareCaptionOption{lofdepth}[2]{\caption@ifdefined\c@lofdepth{\setcounter{lofdepth}{#1}}{}} -\DeclareCaptionOption{lotdepth}[2]{\caption@ifdefined\c@lotdepth{\setcounter{lotdepth}{#1}}{}} -% \end{macrocode} -% \end{macro} -% % \section{Vertical spaces before and after captions} % % \begin{macro}{\abovecaptionskip} @@ -2369,6 +2277,17 @@ % \begin{macrocode} \DeclareCaptionOption{position}{\caption@setposition{#1}} % \end{macrocode} +% \changes{v1.0a}{2004/01/09}{Options \opt{figureposition} and \opt{tableposition} added} +% \begin{macrocode} +\DeclareCaptionOption{figureposition}{% + \captionsetup*[figure]{position=#1}} +\@onlypreamble@key{caption}{figureposition} +% \end{macrocode} +% \begin{macrocode} +\DeclareCaptionOption{tableposition}{% + \captionsetup*[table]{position=#1}} +\@onlypreamble@key{caption}{tableposition} +% \end{macrocode} % % \begin{macro}{\caption@setposition} % \changes{v1.0a}{2004/01/22}{Now the positions \opt{t}, \opt{above}, \opt{b}, @@ -3067,6 +2986,312 @@ % % TODO: babel-latvian/latvian.ldf % +% \section{Package support} +% +% \begin{macro}{\caption@xpackage} +% \changes{v1.11}{2020/05/10}{This macro added} +% |\caption@xpackage|\marg{macro}\marg{package}\marg{option} +% expands the given macro if the given package is not loaded. +% (Note: We cannot use |\@ifpackageloaded| here since it's not available after |\AtBeginDocument|.) +% \begin{macrocode} +\newcommand*\caption@xpackage[2]{% + \expandafter\ifx\csname ver@#2.\caption@pkgextension\endcsname\relax + \expandafter\@firstofone + \else + \expandafter\@gobbletwo + \fi + {#1{#2}}} +% \end{macrocode} +% \begin{macrocode} +\let\caption@pkgextension\@pkgextension +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\caption@loadpackage} +% \changes{v1.11}{2020/05/10}{This macro added} +% |\caption@loadpackage|\marg{package}\marg{caption option} +% loads the given package immediately. +% \begin{macrocode} +\newcommand*\caption@loadpackage{% + \caption@xpackage\caption@@loadpackage} +% \end{macrocode} +% \begin{macrocode} +\newcommand*\caption@@loadpackage[2]{% + \caption@Info{Option `#2' requires the `#1' package}% + \RequirePackage{#1}\relax} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\caption@requirepackage} +% \changes{v1.10}{2020/05/10}{This macro added} +% |\caption@requirepackage|\marg{package}\marg{caption option} +% indicates that the given package option needs a package. +% \begin{macrocode} +\newcommand*\caption@requirepackage{% + \caption@xpackage\caption@@requirepackage} +% \end{macrocode} +% \begin{macrocode} +\newcommand*\caption@@requirepackage[2]{% + \@cons\caption@packagelist{{#1}{#2}}}% load package later on +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\caption@pkg@list} +% \changes{v1.4b}{2012/01/12}{This macro added} +% We used this in the past as list of packages loaded |\AtBeginDocument|. +% (Note: Old |.aux| files could contain |\@cons|\-|\caption@pkg@list|\-|{{|\meta{package}|}}|, +% so this macro should always be defined, even if we change the following code in the future.) +% \begin{macrocode} +\newcommand*\caption@pkg@list{} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\caption@packagelist} +% \changes{v1.11}{2020/05/10}{This macro added} +% We use this as list of packages loaded |\AtBeginDocument|. +% \begin{macrocode} +\newcommand*\caption@packagelist{} +\@onlypreamble\caption@packagelist +% \end{macrocode} +% \begin{macrocode} +\caption@AtBeginDocument{% + \def\caption@tempa{\endgroup}% + \begingroup + \def\@elt#1#2{% + \g@addto@macro\caption@tempa{% + \caption@loadpackage{#1}{#2}}}% + \caption@packagelist + \caption@tempa +% \end{macrocode} +% \begin{macrocode} + \renewcommand*\caption@@loadpackage[2]{% + \caption@Error{Option `#2' requires the `#1' package}}% + \let\caption@@requirepackage\caption@@loadpackage + } +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\caption@usepackage} +% \changes{v1.11}{2020/05/10}{This macro added} +% |\caption@usepackage|\marg{package}\marg{option}\marg{code} +% loads the given package and executes the given code. +% (Note: Since the package might use the crappy \package{keyval} +% package, too, we need to save \& restore some macros here, otherwise this +% recursion won't work properly.) +% \begin{macrocode} +\newcommand*\caption@usepackage[3]{% + \IfCaptionOptionCheck + {\caption@requirepackage{#1}{#2}}% + {\let\KV@prefix@ORI\KV@prefix + \let\@tempc@ORI\@tempc + \caption@loadpackage{#1}{#2}% + #3% + \let\@tempc\@tempc@ORI + \let\KV@prefix\KV@prefix@ORI}} +% \end{macro} +% +% \subsection{The newfloat package} +% +% \begin{macro}{\caption@newfloat} +% \changes{v1.4b}{2012/01/12}{This macro added} +% \changes{v1.8h}{2020/01/03}{Usage of \cs{caption@ifpackageloaded} replaced by \cs{RequirePackage}} +% \changes{v1.11}{2020/05/10}{Usage of \cs{RequirePackage} replaced by \cs{caption@usepackage}} +% |\caption@newfloat|\marg{option}\marg{code} +% loads the \package{newfloat} package and executes the given code afterwards. +% \begin{macrocode} +\newcommand*\caption@newfloat{\caption@usepackage{newfloat}} +% \end{macrocode} +% \end{macro} +% +% \changes{v1.0c}{2004/08/03}{Options \opt{figurename} and \opt{tablename} added} +% \changes{v1.1}{2007/07/04}{Options \opt{figurename} and \opt{tablename} re-written} +% \changes{v1.2}{2007/11/18}{Option \opt{name} added} +% \begin{macrocode} +\DeclareCaptionOption{figurename}{\caption@SetName{figure}{#1}} +\@onlypreamble@key{caption}{figurename} +\DeclareCaptionOption{tablename}{\caption@SetName{table}{#1}} +\@onlypreamble@key{caption}{tablename} +% \end{macrocode} +% +% \changes{v1.2a}{2008/02/28}{Options \opt{listfigurename} and \opt{listtablename} added} +% \begin{macrocode} +\DeclareCaptionOption{listfigurename}{\caption@SetName{listfigure}{#1}} +\@onlypreamble@key{caption}{listfigurename} +\DeclareCaptionOption{listtablename}{\caption@SetName{listtable}{#1}} +\@onlypreamble@key{caption}{listtablename} +% \end{macrocode} +% +% \begin{macro}{\caption@SetName} +% \changes{v1.1}{2007/07/04}{This macro added} +% \changes{v1.2}{2007/11/18}{After-preamble variant added} +% \changes{v1.2a}{2008/02/28}{Renamed from \cs{caption@SetFloatName} to \cs{caption@SetName}} +% \changes{v1.2b}{2008/08/02}{Bugfix: Works now without \cs{addto}, too} +% \changes{v1.4a}{2011/10/29}{Outsourced to \package{newfloat} package} +% \changes{v1.4b}{2012/01/12}{Bugfix: Uses \cs{caption@newfloat} now} +% |\caption@SetName|\marg{float}\marg{name} +% \begin{macrocode} +\newcommand*\caption@SetName[2]{% + \caption@newfloat{#1name}{\newfloat@setname{#1}{#2}}} +\@onlypreamble\caption@SetName +% \end{macrocode} +% \end{macro} +% +% \begin{macrocode} +\DeclareCaptionOption{name}{% + \IfCaptionOptionCheck{}{\caption@setname\@captype{#1}}} +% \end{macrocode} +% +% \begin{macro}{\caption@setname} +% |\caption@setname|\marg{float}\marg{name} +% \begin{macrocode} +\newcommand*\caption@setname[2]{% + \@namedef{#1name}{#2}} +% \end{macrocode} +% \end{macro} +% +% \changes{v1.2}{2007/12/21}{Options \opt{figurewithin} and \opt{tablewithin} added} +% \changes{v1.2e}{2010/01/09}{The \opt{within} options are now available within the document, too} +% +% \begin{macrocode} +\DeclareCaptionOption{figurewithin}{\caption@within{figure}{#1}} +\DeclareCaptionOptionNoValue{figurewithout}{\caption@within{figure}{none}} +\DeclareCaptionOption{tablewithin}{\caption@within{table}{#1}} +\DeclareCaptionOptionNoValue{tablewithout}{\caption@within{table}{none}} +% \end{macrocode} +% +% \begin{macro}{\caption@within} +% \changes{v1.2}{2007/12/21}{This macro added} +% \changes{v1.4a}{2011/10/29}{Outsourced to \package{newfloat} package} +% \changes{v1.4b}{2012/01/12}{Bugfix: Uses \cs{caption@newfloat} now} +% |\caption@within|\marg{float}\marg{value} +% \begin{macrocode} +\newcommand*\caption@within[2]{% + \caption@newfloat{#1within}{\newfloat@setwithin{#1}{#2}}} +% \end{macrocode} +% \end{macro} +% +% \changes{v1.2b}{2008/04/13}{Option \opt{within} added} +% \changes{v1.2e}{2010/01/09}{The global \opt{within} option will now affect user-defined floats declared with \cs{DeclareCaptionType}, too} +% +% \begin{macrocode} +\DeclareCaptionOption{within}{% + \caption@newfloat{within}{\newfloatsetup{within=#1}}} +\DeclareCaptionOptionNoValue{without}{% + \caption@newfloat{without}{\newfloatsetup{without}}} +% \end{macrocode} +% +% \subsection{The ragged2e package} +% \changes{v1.0b}{2004/05/16}{Improved \package{ragged2e} package support} +% \changes{v1.8h}{2020/01/03}{Revised \package{ragged2e} package support} +% \changes{v1.9}{2020/05/05}{Enhanced \package{ragged2e} package support} +% \changes{v1.10}{2020/05/10}{Revised \package{ragged2e} package support} +% +% We support the upper-case commands offered by the \package{ragged2e} +% package. +% \begin{macrocode} +\DeclareCaptionJustification[ragged2e]{Justified}{\justifying} +\DeclareCaptionJustification[ragged2e]{Centering}{\Centering} +\DeclareCaptionJustification[ragged2e]{RaggedLeft}{\RaggedLeft} +\DeclareCaptionJustification[ragged2e]{RaggedRight}{\RaggedRight} +% \end{macrocode} +% +% \subsection{The sansmath package} +% \changes{v1.3}{2011/01/01}{\package{sansmath} package support added} +% \changes{v1.10}{2020/05/10}{\package{sansmath} package support revised} +% +% \begin{macrocode} +\DeclareCaptionFont[sansmath]{sansmath}{\sansmath} +% \end{macrocode} +% +% \subsection{The setspace package} +% \changes{v1.0n}{2007/04/02}{\package{setspace} package support added} +% \changes{v1.2d}{2009/10/09}{\package{setspace} package support revised} +% +% \begin{macrocode} +\DeclareCaptionFont{singlespacing}{% + \caption@ifdefined\setspace@singlespace{% + \setstretch\setspace@singlespace}{}}% normally 1 +\DeclareCaptionFont[setspace]{onehalfspacing}{\onehalfspacing} +\DeclareCaptionFont[setspace]{doublespacing}{\doublespacing} +\DeclareCaptionFont[setspace]{stretch}{\setstretch{#1}} +% \end{macrocode} +% +% \subsection{The subfig package} +% \changes{v1.1}{2007/07/07}{Several adaptions to the \package{subfig} package added} +% \changes{v1.4a}{2011/11/01}{Test for the \package{subfig} package revised} +% +% Since the \package{subfig} package is not maintained anymore, +% we have to make several adaptions to \thispackage~\version{1.1} here. +% Please note that we only support the version $1.3$ of the \package{subfig} package here. +% So older versions do not work with this version of \thispackage, and newer +% versions are expected to be adapted. +% \begin{macrocode} +\caption@AtBeginDocument{% + \def\@tempa{2005/06/28 ver: 1.3 subfig package}% + \expandafter\ifx\csname ver@subfig.sty\endcsname\@tempa + \caption@InfoNoLine{subfig package v1.3 is loaded}% +% \end{macrocode} +% \begin{macrocode} + \let\caption@setfloattype\@gobble + \let\@dottedxxxline\sf@NEW@dottedxxxline + \let\sf@subfloat\sf@NEW@subfloat +% \end{macrocode} +% \begin{macrocode} + \fi + \let\sf@NEW@dottedxxxline\@undefined + \let\sf@NEW@subfloat\@undefined} +% \end{macrocode} +% +% \begin{macro}{\@dottedxxxline} +% New version of |\@dottedxxxline| +% \begin{macrocode} +\def\sf@NEW@dottedxxxline#1#2#3#4#5#6#7{% + \begingroup + \caption@setfloattype{#1}% + \caption@setoptions{subfloat}% + \caption@setoptions{sub#1}% + \ifnum #3>\@nameuse{c@#2depth}\else + \@dottedtocline{\z@}{#4}{#5}{#6}{#7}% + \fi + \endgroup} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\sf@subfloat} +% \changes{v1.4b}{2011/12/29}{Bugfix 11-12-23: Usage of \cs{caption@warmup} added} +% New version of |\sf@subfloat| +% \begin{macrocode} +\def\sf@NEW@subfloat{% + \begingroup + \@nameuse{caption@warmup}% + \caption@setfloattype\@captype + \sf@ifpositiontop{% + \maincaptiontoptrue + }{% + \maincaptiontopfalse + }% + \caption@setoptions{subfloat}% + \caption@setoptions{sub\@captype}% + \let\sf@oldlabel=\label + \let\label=\subfloat@label + \ifmaincaptiontop\else + \advance\@nameuse{c@\@captype}\@ne + \fi + \refstepcounter{sub\@captype}% + \setcounter{sub\@captype @save}{\value{sub\@captype}}% + \@ifnextchar [% %] match left bracket + {\sf@@subfloat}% + {\sf@@subfloat[\@empty]}} +% \end{macrocode} +% \end{macro} +% +% Make the \package{subfig} package documentation compile. +% \begin{macrocode} +%%\@ifl@aded{dtx}{subfig}{\caption@loadpackage{ragged2e}{}}{} % not needed +\DeclareCaptionOption{lofdepth}[2]{\caption@ifdefined\c@lofdepth{\setcounter{lofdepth}{#1}}{}} +\DeclareCaptionOption{lotdepth}[2]{\caption@ifdefined\c@lotdepth{\setcounter{lotdepth}{#1}}{}} +% \end{macrocode} +% % \section{Execution of options} % % \begin{macrocode} @@ -3644,7 +3869,7 @@ % |\DeclareCaptionType|\oarg{options}\marg{environment}\oarg{name}\oarg{list name} % \begin{macrocode} \newcommand*\DeclareCaptionType{% - \RequirePackage{newfloat}% + \caption@loadpackage{newfloat}{}% \DeclareFloatingEnvironment} \@onlypreamble\DeclareCaptionType % \end{macrocode} @@ -3882,75 +4107,6 @@ % \end{macrocode} % \end{macro} % -% \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} -% -% Since the \package{subfig} package is not maintained anymore, -% we have to make several adaptions to \thispackage~\version{1.1} here. -% Please note that we only support the version $1.3$ of the \package{subfig} package here. -% So older versions do not work with this version of \thispackage, and newer -% versions are expected to be adapted. -% \begin{macrocode} -\caption@AtBeginDocument{% - \def\@tempa{2005/06/28 ver: 1.3 subfig package}% - \expandafter\ifx\csname ver@subfig.sty\endcsname\@tempa - \caption@InfoNoLine{subfig package v1.3 is loaded}% -% \end{macrocode} -% \begin{macrocode} - \let\caption@setfloattype\@gobble - \let\@dottedxxxline\sf@NEW@dottedxxxline - \let\sf@subfloat\sf@NEW@subfloat -% \end{macrocode} -% \begin{macrocode} - \fi - \let\sf@NEW@dottedxxxline\@undefined - \let\sf@NEW@subfloat\@undefined} -% \end{macrocode} -% -% \begin{macro}{\@dottedxxxline} -% New version of |\@dottedxxxline| -% \begin{macrocode} -\def\sf@NEW@dottedxxxline#1#2#3#4#5#6#7{% - \begingroup - \caption@setfloattype{#1}% - \caption@setoptions{subfloat}% - \caption@setoptions{sub#1}% - \ifnum #3>\@nameuse{c@#2depth}\else - \@dottedtocline{\z@}{#4}{#5}{#6}{#7}% - \fi - \endgroup} -% \end{macrocode} -% \end{macro} -% -% \begin{macro}{\sf@subfloat} -% \changes{v1.4b}{2011/12/29}{Bugfix 11-12-23: Usage of \cs{caption@warmup} added} -% New version of |\sf@subfloat| -% \begin{macrocode} -\def\sf@NEW@subfloat{% - \begingroup - \@nameuse{caption@warmup}% - \caption@setfloattype\@captype - \sf@ifpositiontop{% - \maincaptiontoptrue - }{% - \maincaptiontopfalse - }% - \caption@setoptions{subfloat}% - \caption@setoptions{sub\@captype}% - \let\sf@oldlabel=\label - \let\label=\subfloat@label - \ifmaincaptiontop\else - \advance\@nameuse{c@\@captype}\@ne - \fi - \refstepcounter{sub\@captype}% - \setcounter{sub\@captype @save}{\value{sub\@captype}}% - \@ifnextchar [% %] match left bracket - {\sf@@subfloat}% - {\sf@@subfloat[\@empty]}} -% \end{macrocode} -% \end{macro} -% % \iffalse % % \fi diff --git a/Master/texmf-dist/tex/latex/caption/caption.sty b/Master/texmf-dist/tex/latex/caption/caption.sty index f905114ef8f..71899f9dcc6 100644 --- a/Master/texmf-dist/tex/latex/caption/caption.sty +++ b/Master/texmf-dist/tex/latex/caption/caption.sty @@ -34,8 +34,8 @@ %% caption-deu.tex, caption-eng.tex, caption-rus.tex. %% \NeedsTeXFormat{LaTeX2e}[1994/12/01] -\ProvidesPackage{caption}[2020/01/03 v3.4h Customizing captions (AR)] -\RequirePackage{caption3}[2020/01/03] % needs v1.8h or newer +\ProvidesPackage{caption}[2020/05/10 v3.4j Customizing captions (AR)] +\RequirePackage{caption3}[2020/05/10] % needs v1.10 or newer \caption@ifbool{documentclass}{}{% \caption@WarningNoLine{% Unknown document class (or package),\MessageBreak @@ -58,45 +58,6 @@ \caption@Error{Usage of the `position' option is incompatible\MessageBreak to the `#1' package}}} \@onlypreamble\caption@DisablePositionOption -\DeclareCaptionOption{figureposition}{% - \captionsetup*[figure]{position=#1}} -\@onlypreamble@key{caption}{figureposition} -\DeclareCaptionOption{tableposition}{% - \captionsetup*[table]{position=#1}} -\@onlypreamble@key{caption}{tableposition} -\DeclareCaptionOption{figurename}{\caption@SetName{figure}{#1}} -\@onlypreamble@key{caption}{figurename} -\DeclareCaptionOption{tablename}{\caption@SetName{table}{#1}} -\@onlypreamble@key{caption}{tablename} -\DeclareCaptionOption{listfigurename}{\caption@SetName{listfigure}{#1}} -\@onlypreamble@key{caption}{listfigurename} -\DeclareCaptionOption{listtablename}{\caption@SetName{listtable}{#1}} -\@onlypreamble@key{caption}{listtablename} -\newcommand*\caption@SetName[2]{% - \caption@NewFloat{\newfloat@setname{#1}{#2}}} -\@onlypreamble\caption@SetName -\DeclareCaptionOption{name}{\caption@setname\@captype{#1}} -\newcommand*\caption@setname[2]{% - \@namedef{#1name}{#2}} -\newcommand*\caption@DeclareWithinOption[1]{% - \DeclareCaptionOption{#1within}{\caption@Within{#1}{##1}}% - \DeclareCaptionOptionNoValue{#1without}{\caption@Within{#1}{none}}} -\@onlypreamble\caption@DeclareWithinOption -\caption@DeclareWithinOption{figure} -\caption@DeclareWithinOption{table} -\DeclareCaptionOption{within}{% - \caption@NewFloat{\newfloatsetup{within=#1}}} -\DeclareCaptionOptionNoValue{without}{% - \caption@NewFloat{\newfloatsetup{without}}} -\newcommand*\caption@Within[2]{% - \caption@NewFloat{\newfloat@setwithin{#1}{#2}}} -\newcommand*\caption@NewFloat[1]{% - \let\KV@prefix@ORI\KV@prefix - \let\@tempc@ORI\@tempc - \caption@ifdefined\newfloatsetup{}{\RequirePackage{newfloat}}% - #1% - \let\@tempc\@tempc@ORI - \let\KV@prefix\KV@prefix@ORI} \DeclareCaptionOption*{config}[caption]{% \InputIfFileExists{#1.cfg}% {\typeout{*** Local configuration file #1.cfg used ***}}% diff --git a/Master/texmf-dist/tex/latex/caption/caption3.sty b/Master/texmf-dist/tex/latex/caption/caption3.sty index efc38bb05d3..4bbf4307d66 100644 --- a/Master/texmf-dist/tex/latex/caption/caption3.sty +++ b/Master/texmf-dist/tex/latex/caption/caption3.sty @@ -34,7 +34,7 @@ %% caption-deu.tex, caption-eng.tex, caption-rus.tex. %% \NeedsTeXFormat{LaTeX2e}[1994/12/01] -\ProvidesPackage{caption3}[2020/01/03 v1.8h caption3 kernel (AR)] +\ProvidesPackage{caption3}[2020/05/10 v1.11 caption3 kernel (AR)] \providecommand\caption@FixArabTeX{% \def\caption@tempa##1{}% \ifx\caption@tempa\@gobble @@ -265,8 +265,10 @@ \caption@prepare@optioncheck \caption@setup{#1}% \endgroup} -\newcommand*\caption@prepare@optioncheck{% - \def\@captype{figure}} +\providecommand*\caption@prepare@optioncheck{} +\let\IfCaptionOptionCheck\@secondoftwo +\g@addto@macro\caption@prepare@optioncheck{% + \let\IfCaptionOptionCheck\@firstoftwo} \newcommand*\clearcaptionsetup{% \caption@teststar@\@clearcaptionsetup\@gobble\@firstofone} \newcommand*\@clearcaptionsetup[1]{% @@ -394,13 +396,13 @@ \caption@ExecuteOptions{#2}{\caption@tempa\@ptionlist{\@currname.\@currext}}% \AtEndOfPackage{\let\@unprocessedoptions\relax}} \@onlypreamble\caption@@ProcessOptions -\newcommand*\caption@packagelist{} -\@onlypreamble\caption@packagelist \newcommand\caption@SetupOptions[2]{% \@namedef{caption@setkeys@#1}##1##2{#2}% \expandafter\@onlypreamble\csname caption@setkeys@#1\endcsname - \@cons\caption@packagelist{{#1}}} + \@cons\caption@SetupOptions@list{{#1}}} \@onlypreamble\caption@SetupOptions +\newcommand*\caption@SetupOptions@list{} +\@onlypreamble\caption@SetupOptions@list \let\caption@onefilewithoptions\@onefilewithoptions \def\@onefilewithoptions#1[#2]{% \begingroup @@ -416,7 +418,7 @@ \caption@ExecuteOptions{#1}{#2}% \caption@onefilewithoptions{#1}[]}% \fi} - \caption@packagelist + \caption@SetupOptions@list \@tempa} \@onlypreamble\caption@onefilewithoptions \newdimen\captionmargin @@ -719,12 +721,31 @@ \l@addto@macro\caption@thelabel{[{#1}]}% \caption@@getlabel#2\@nil} \let\caption@thelabel\relax -\newcommand*\DeclareCaptionFont[2]{% - \define@key{caption@fnt}{#1}[]{\caption@addto@fnt{#2}}} +\newcommand*\DeclareCaptionFont{% + \@ifnextchar[%] + \caption@declare@font + \caption@declarefont} \@onlypreamble\DeclareCaptionFont -\newcommand*\caption@addto@fnt[1]{% - \caption@check@ragged{#1}% - \l@addto@macro\caption@fnt{#1}} +\def\caption@declare@font[#1]#2{% + \global\@namedef{caption@fnt@#2@package}{#1}% + \caption@@declarefont{#2}} +\@onlypreamble\caption@declare@font +\newcommand*\caption@declarefont[1]{% + \global\@nameundef{caption@fnt@#1@package}% + \caption@@declarefont{#1}} +\@onlypreamble\caption@declarefont +\newcommand*\caption@@declarefont[2]{% + \define@key{caption@fnt}{#1}[]{\caption@addto@fnt{#1}{#2}}% + \caption@@@declarefont{#1}{#2}} +\@onlypreamble\caption@@declarefont +\newcommand*\caption@@@declarefont[2]{}% will be used by \DeclareCaptionJustification +\@onlypreamble\caption@@@declarefont +\newcommand*\caption@addto@fnt[2]{% + \expandafter\let\expandafter\caption@package\csname caption@fnt@#1@package\endcsname + \caption@ifdefined\caption@package + {\caption@requirepackage\caption@package{#1}}% load package, if necessary + {}% + \l@addto@macro\caption@fnt{#2}} \newcommand*\DeclareCaptionDefaultFont[2]{% \global\@namedef{caption#1@default}{#2}} \@onlypreamble\DeclareCaptionDefaultFont @@ -833,17 +854,7 @@ Try setting it with `size=' explicitly}% \fi\fi\fi\fi\fi\fi\fi\fi\fi\fi} \DeclareCaptionFont{larger}{\caption@larger} -\DeclareCaptionFont{sansmath}{\sansmath} -\DeclareCaptionFont{singlespacing}{% - \caption@ifdefined\setspace@singlespace{% - \setstretch\setspace@singlespace}{}}% normally 1 -\DeclareCaptionFont{onehalfspacing}{% - \caption@setspace{onehalfspacing}\onehalfspacing\relax} -\DeclareCaptionFont{doublespacing}{% - \caption@setspace{doublespacing}\doublespacing\relax} -\DeclareCaptionFont{stretch}{% - \caption@setspace{stretch}\setstretch\@gobble{#1}} -\newcommand*\caption@setspace{\caption@ifpackageloaded{setspace}} +\DeclareCaptionFont{singlespacing}{} \DeclareCaptionFont{normal}{% \caption@font*{% \KV@caption@fnt@normalcolor\@unused @@ -852,9 +863,11 @@ \KV@caption@fnt@singlespacing\@unused}} \DeclareCaptionOption{size}{\caption@setfont{size}{#1}} \DeclareCaptionDefaultFont{size}{} -\newcommand*\DeclareCaptionJustification[2]{% - \global\@namedef{caption@hj@#1}{#2}% for compatibility to v1.0 - \DeclareCaptionFont{#1}{#2}} +\newcommand*\DeclareCaptionJustification{% + \def\caption@@@declarefont##1##2{% + \global\@namedef{caption@hj@##1}{##2}% for compatibility to v1.0, needed by floatrow package + \let\caption@@@declarefont\@gobbletwo}% + \DeclareCaptionFont} \@onlypreamble\DeclareCaptionJustification \newcommand*\DeclareCaptionDefaultJustification[1]{% \global\@namedef{caption@hj@default}{#1}% for compatibility to v1.0 @@ -885,54 +898,6 @@ \leftskip\z@\@plus 1fil% \rightskip\z@\@plus -1fil% \parfillskip\z@\@plus 2fil\relax} -\DeclareCaptionJustification{Centering}{\caption@Centering} -\DeclareCaptionJustification{RaggedLeft}{\caption@RaggedLeft} -\DeclareCaptionJustification{RaggedRight}{\caption@RaggedRight} -\newcommand*\caption@Centering{% - \caption@ragged{Centering}\Centering\centering} -\newcommand*\caption@RaggedLeft{% - \caption@ragged{RaggedLeft}\RaggedLeft\raggedleft} -\newcommand*\caption@RaggedRight{% - \caption@ragged{RaggedRight}\RaggedRight\raggedright} -\newcommand*\caption@ragged{\caption@ifpackageloaded{ragged2e}} -\newcommand*\caption@ifpackageloaded[4]{% - \caption@ifdefined#3#3{% - \caption@Error{Option `#2' requires the `#1' package\MessageBreak - (or an alternative definition of \string#3)}% - #4}} -\newcommand*\caption@pkg@list{} -\caption@AtBeginDocument{% - \def\caption@tempa{\endgroup}% - \begingroup - \def\@elt#1{% - \g@addto@macro\caption@tempa{% - \caption@InfoNoLine{Load package `#1'}% - \RequirePackage{#1}\relax}}% - \caption@pkg@list - \caption@tempa} -\@ifpackageloaded{ragged2e}{\let\caption@check@ragged\@gobble}{% - \newcommand*\caption@check@ragged[1]{% - \begingroup - \def\caption@tempa{#1}% - \caption@check@ragged@{Centering}% - \caption@check@ragged@{RaggedLeft}% - \caption@check@ragged@{RaggedRight}% - \endgroup}% - \newcommand*\caption@check@ragged@[1]{% - \expandafter\def\expandafter\caption@tempb\expandafter{\csname caption@#1\endcsname}% - \ifx\caption@tempa\caption@tempb % our definition of `ragged2e' option? - \@ifundefined{#1}{% - \caption@Info{Usage of `ragged2e' command \expandafter\string\csname #1\endcsname\space detected}% - \@cons\caption@pkg@list{{ragged2e}}% load `ragged2e' package later on - \global\let\caption@check@ragged\@gobble}{}% - \fi - }% - \caption@AtBeginDocument{% - \let\caption@check@ragged\@gobble - \let\caption@check@ragged@\@undefined}} -%%\@ifl@aded{dtx}{subfig}{\RequirePackage{ragged2e}\relax}{} % not needed -\DeclareCaptionOption{lofdepth}[2]{\caption@ifdefined\c@lofdepth{\setcounter{lofdepth}{#1}}{}} -\DeclareCaptionOption{lotdepth}[2]{\caption@ifdefined\c@lotdepth{\setcounter{lotdepth}{#1}}{}} \caption@ifundefined\abovecaptionskip{% \newlength\abovecaptionskip\setlength\abovecaptionskip{10\p@}}{} \caption@ifundefined\belowcaptionskip{% @@ -944,6 +909,12 @@ \newcommand*\caption@hrule{\hrule\@height\z@} \DeclareCaptionOption{rule}[1]{\caption@set@bool\caption@ifrule{#1}} \DeclareCaptionOption{position}{\caption@setposition{#1}} +\DeclareCaptionOption{figureposition}{% + \captionsetup*[figure]{position=#1}} +\@onlypreamble@key{caption}{figureposition} +\DeclareCaptionOption{tableposition}{% + \captionsetup*[table]{position=#1}} +\@onlypreamble@key{caption}{tableposition} \newcommand*\caption@setposition[1]{% \caption@ifinlist{#1}{d,default}{% \let\caption@position\caption@defaultpos @@ -1246,6 +1217,127 @@ }{}} \caption@tempa{hungarian} \caption@tempa{magyar} +\newcommand*\caption@xpackage[2]{% + \expandafter\ifx\csname ver@#2.\caption@pkgextension\endcsname\relax + \expandafter\@firstofone + \else + \expandafter\@gobbletwo + \fi + {#1{#2}}} +\let\caption@pkgextension\@pkgextension +\newcommand*\caption@loadpackage{% + \caption@xpackage\caption@@loadpackage} +\newcommand*\caption@@loadpackage[2]{% + \caption@Info{Option `#2' requires the `#1' package}% + \RequirePackage{#1}\relax} +\newcommand*\caption@requirepackage{% + \caption@xpackage\caption@@requirepackage} +\newcommand*\caption@@requirepackage[2]{% + \@cons\caption@packagelist{{#1}{#2}}}% load package later on +\newcommand*\caption@pkg@list{} +\newcommand*\caption@packagelist{} +\@onlypreamble\caption@packagelist +\caption@AtBeginDocument{% + \def\caption@tempa{\endgroup}% + \begingroup + \def\@elt#1#2{% + \g@addto@macro\caption@tempa{% + \caption@loadpackage{#1}{#2}}}% + \caption@packagelist + \caption@tempa + \renewcommand*\caption@@loadpackage[2]{% + \caption@Error{Option `#2' requires the `#1' package}}% + \let\caption@@requirepackage\caption@@loadpackage + } +\newcommand*\caption@usepackage[3]{% + \IfCaptionOptionCheck + {\caption@requirepackage{#1}{#2}}% + {\let\KV@prefix@ORI\KV@prefix + \let\@tempc@ORI\@tempc + \caption@loadpackage{#1}{#2}% + #3% + \let\@tempc\@tempc@ORI + \let\KV@prefix\KV@prefix@ORI}} +\newcommand*\caption@newfloat{\caption@usepackage{newfloat}} +\DeclareCaptionOption{figurename}{\caption@SetName{figure}{#1}} +\@onlypreamble@key{caption}{figurename} +\DeclareCaptionOption{tablename}{\caption@SetName{table}{#1}} +\@onlypreamble@key{caption}{tablename} +\DeclareCaptionOption{listfigurename}{\caption@SetName{listfigure}{#1}} +\@onlypreamble@key{caption}{listfigurename} +\DeclareCaptionOption{listtablename}{\caption@SetName{listtable}{#1}} +\@onlypreamble@key{caption}{listtablename} +\newcommand*\caption@SetName[2]{% + \caption@newfloat{#1name}{\newfloat@setname{#1}{#2}}} +\@onlypreamble\caption@SetName +\DeclareCaptionOption{name}{% + \IfCaptionOptionCheck{}{\caption@setname\@captype{#1}}} +\newcommand*\caption@setname[2]{% + \@namedef{#1name}{#2}} +\DeclareCaptionOption{figurewithin}{\caption@within{figure}{#1}} +\DeclareCaptionOptionNoValue{figurewithout}{\caption@within{figure}{none}} +\DeclareCaptionOption{tablewithin}{\caption@within{table}{#1}} +\DeclareCaptionOptionNoValue{tablewithout}{\caption@within{table}{none}} +\newcommand*\caption@within[2]{% + \caption@newfloat{#1within}{\newfloat@setwithin{#1}{#2}}} +\DeclareCaptionOption{within}{% + \caption@newfloat{within}{\newfloatsetup{within=#1}}} +\DeclareCaptionOptionNoValue{without}{% + \caption@newfloat{without}{\newfloatsetup{without}}} +\DeclareCaptionJustification[ragged2e]{Justified}{\justifying} +\DeclareCaptionJustification[ragged2e]{Centering}{\Centering} +\DeclareCaptionJustification[ragged2e]{RaggedLeft}{\RaggedLeft} +\DeclareCaptionJustification[ragged2e]{RaggedRight}{\RaggedRight} +\DeclareCaptionFont[sansmath]{sansmath}{\sansmath} +\DeclareCaptionFont{singlespacing}{% + \caption@ifdefined\setspace@singlespace{% + \setstretch\setspace@singlespace}{}}% normally 1 +\DeclareCaptionFont[setspace]{onehalfspacing}{\onehalfspacing} +\DeclareCaptionFont[setspace]{doublespacing}{\doublespacing} +\DeclareCaptionFont[setspace]{stretch}{\setstretch{#1}} +\caption@AtBeginDocument{% + \def\@tempa{2005/06/28 ver: 1.3 subfig package}% + \expandafter\ifx\csname ver@subfig.sty\endcsname\@tempa + \caption@InfoNoLine{subfig package v1.3 is loaded}% + \let\caption@setfloattype\@gobble + \let\@dottedxxxline\sf@NEW@dottedxxxline + \let\sf@subfloat\sf@NEW@subfloat + \fi + \let\sf@NEW@dottedxxxline\@undefined + \let\sf@NEW@subfloat\@undefined} +\def\sf@NEW@dottedxxxline#1#2#3#4#5#6#7{% + \begingroup + \caption@setfloattype{#1}% + \caption@setoptions{subfloat}% + \caption@setoptions{sub#1}% + \ifnum #3>\@nameuse{c@#2depth}\else + \@dottedtocline{\z@}{#4}{#5}{#6}{#7}% + \fi + \endgroup} +\def\sf@NEW@subfloat{% + \begingroup + \@nameuse{caption@warmup}% + \caption@setfloattype\@captype + \sf@ifpositiontop{% + \maincaptiontoptrue + }{% + \maincaptiontopfalse + }% + \caption@setoptions{subfloat}% + \caption@setoptions{sub\@captype}% + \let\sf@oldlabel=\label + \let\label=\subfloat@label + \ifmaincaptiontop\else + \advance\@nameuse{c@\@captype}\@ne + \fi + \refstepcounter{sub\@captype}% + \setcounter{sub\@captype @save}{\value{sub\@captype}}% + \@ifnextchar [% %] match left bracket + {\sf@@subfloat}% + {\sf@@subfloat[\@empty]}} +%%\@ifl@aded{dtx}{subfig}{\caption@loadpackage{ragged2e}{}}{} % not needed +\DeclareCaptionOption{lofdepth}[2]{\caption@ifdefined\c@lofdepth{\setcounter{lofdepth}{#1}}{}} +\DeclareCaptionOption{lotdepth}[2]{\caption@ifdefined\c@lotdepth{\setcounter{lotdepth}{#1}}{}} \captionsetup{style=default,position=default,% list,listformat=default,twoside=\if@twoside 1\else 0\fi} \ProcessOptions* @@ -1493,7 +1585,7 @@ \newcommand*\caption@@par{% \parindent\caption@parindent\hangindent\caption@hangindent}% \newcommand*\DeclareCaptionType{% - \RequirePackage{newfloat}% + \caption@loadpackage{newfloat}{}% \DeclareFloatingEnvironment} \@onlypreamble\DeclareCaptionType \newcommand\caption@ForEachType[1]{% @@ -1613,46 +1705,6 @@ \def\@elt##1{#3}% \@nameuse{caption@#2}% \let\@elt\relax}}% -\caption@AtBeginDocument{% - \def\@tempa{2005/06/28 ver: 1.3 subfig package}% - \expandafter\ifx\csname ver@subfig.sty\endcsname\@tempa - \caption@InfoNoLine{subfig package v1.3 is loaded}% - \let\caption@setfloattype\@gobble - \let\@dottedxxxline\sf@NEW@dottedxxxline - \let\sf@subfloat\sf@NEW@subfloat - \fi - \let\sf@NEW@dottedxxxline\@undefined - \let\sf@NEW@subfloat\@undefined} -\def\sf@NEW@dottedxxxline#1#2#3#4#5#6#7{% - \begingroup - \caption@setfloattype{#1}% - \caption@setoptions{subfloat}% - \caption@setoptions{sub#1}% - \ifnum #3>\@nameuse{c@#2depth}\else - \@dottedtocline{\z@}{#4}{#5}{#6}{#7}% - \fi - \endgroup} -\def\sf@NEW@subfloat{% - \begingroup - \@nameuse{caption@warmup}% - \caption@setfloattype\@captype - \sf@ifpositiontop{% - \maincaptiontoptrue - }{% - \maincaptiontopfalse - }% - \caption@setoptions{subfloat}% - \caption@setoptions{sub\@captype}% - \let\sf@oldlabel=\label - \let\label=\subfloat@label - \ifmaincaptiontop\else - \advance\@nameuse{c@\@captype}\@ne - \fi - \refstepcounter{sub\@captype}% - \setcounter{sub\@captype @save}{\value{sub\@captype}}% - \@ifnextchar [% %] match left bracket - {\sf@@subfloat}% - {\sf@@subfloat[\@empty]}} \endinput %% %% End of file `caption3.sty'. -- cgit v1.2.3