diff options
author | Norbert Preining <norbert@preining.info> | 2019-09-02 06:32:18 +0000 |
---|---|---|
committer | Norbert Preining <norbert@preining.info> | 2019-09-02 06:32:18 +0000 |
commit | b1f0911e7afee09bb21000ac59dab2a0efc2c1e5 (patch) | |
tree | 4d476b8abbc5b5b2d78d49885644b01306a1bd9a /macros/latex/contrib/caption/newfloat.dtx | |
parent | f14a361bc56a46f4453b22584ae25043e1e83397 (diff) |
CTAN sync 201909020632
Diffstat (limited to 'macros/latex/contrib/caption/newfloat.dtx')
-rw-r--r-- | macros/latex/contrib/caption/newfloat.dtx | 242 |
1 files changed, 199 insertions, 43 deletions
diff --git a/macros/latex/contrib/caption/newfloat.dtx b/macros/latex/contrib/caption/newfloat.dtx index fd283697dc..71484e60bc 100644 --- a/macros/latex/contrib/caption/newfloat.dtx +++ b/macros/latex/contrib/caption/newfloat.dtx @@ -25,7 +25,7 @@ % and the user manuals caption-deu.tex, caption-eng.tex, and caption-rus.tex. % % \fi -% \CheckSum{1397} +% \CheckSum{1605} % % \iffalse %<*driver> @@ -533,7 +533,7 @@ % % \begin{macrocode} \NeedsTeXFormat{LaTeX2e}[1994/12/01] -\ProvidesPackage{newfloat}[2019/08/28 v1.1g Defining new floating environments (AR)] +\ProvidesPackage{newfloat}[2019/09/01 v1.1k Defining new floating environments (AR)] % \end{macrocode} % % \begin{macro}{\newfloat@Info} @@ -548,6 +548,18 @@ % \end{macro} % \end{macro} % +% \begin{macro}{\newfloat@Warning} +% \begin{macro}{\newfloat@WarningNoLine} +% |\newfloat@Warning|\marg{message} +% \begin{macrocode} +\newcommand*\newfloat@Warning[1]{% + \PackageWarning{newfloat}{#1}} +\newcommand*\newfloat@WarningNoLine[1]{% + \newfloat@Warning{#1\@gobble}} +% \end{macrocode} +% \end{macro} +% \end{macro} +% % \begin{macro}{\newfloat@Error} % |\newfloat@Error|\marg{message} % \begin{macrocode} @@ -614,6 +626,7 @@ % \changes{v1.1}{2018/03/04}{Usage of \cs{ifdefined} replaced by \cs{@ifundefined} to improve compatibility with the \package{listings} package} % \changes{v1.1b}{2018/12/26}{Bugfix: Missing curly braces added} % \changes{v1.1c}{2019/01/10}{Bugfix: Support of \cs{autodot} fixed} +% \changes{v1.1k}{2019/09/01}{Adapted to the \class{beamer} document class} % |\DeclareFloatingEnvironment|\oarg{options}\marg{environment}\oarg{name}\oarg{list name} % \begin{macrocode} \newcommand*\DeclareFloatingEnvironment{% @@ -665,9 +678,11 @@ \newfloat@ifundefined{flegtoc#2}{\@namedef{flegtoc#2}##1{}}% % \end{macrocode} % Define the floating environment\par -% (If the \class{tufte} document class is loaded, +% If the \class{tufte} document class is loaded, % |\@tufte@float| and |\end@tufte@float| will be used instead of -% |\@float|, |\end@float|, |\@dblfloat|, and |\end@dblfloat|.) +% |\@float|, |\end@float|, |\@dblfloat|, and |\end@dblfloat|.\par +% If the \class{beamer} document class is loaded, +% |\beamer@float| and |\end@beamer@float| will be used. % \begin{macrocode} \ifcsname @tufte@float\endcsname \newenvironment{#2}[1][htbp]% @@ -677,8 +692,12 @@ {\begin{@tufte@float}[{##1}]{#2}{star}}% {\end{@tufte@float}}% \else - \newenvironment{#2}{\@float{#2}}{\end@float}% - \newenvironment{#2*}{\@dblfloat{#2}}{\end@dblfloat}% + \@ifclassloaded{beamer}{% + \newenvironment{#2}[1][]{\beamer@float{#2}}{\end@beamer@float}% + }{% + \newenvironment{#2}{\@float{#2}}{\end@float}% + \newenvironment{#2*}{\@dblfloat{#2}}{\end@dblfloat}% + }% \fi % \end{macrocode} % Define the listing command |\listof|\meta{type}(|e|)|s| @@ -1185,6 +1204,10 @@ % \begin{macrocode} \providecommand*\@chapterlistsgap{10\p@}% % \end{macrocode} +% If the \package{dgruyter} package is loaded, the default gap is |13pt|. +% \begin{macrocode} + \@ifpackageloaded{dgruyter}{\renewcommand*\@chapterlistsgap{13\p@}}{}% +% \end{macrocode} % \end{macro} % % \begin{macro}{\@addchapterlistsgap} @@ -1333,7 +1356,6 @@ \xdef\newfloat@addtocontents@ext{#1}} % \end{macrocode} % \end{macro} - % % Process the package options: % We use |\setkeys| here instead of |\ProcessOptions|. @@ -1356,6 +1378,7 @@ % % \begin{macro}{\newfloat@replace@chapter} % \changes{v1.1f}{2019/08/25}{Parameter \meta{class name} added to macro} +% \changes{v1.1i}{2019/08/31}{Local definition of \cs{if@chapnum} added} % |\newfloat@replace@chapter|\marg{class name}\marg{original code}\marg{replacement code}\par % tries to patch |\@chapter| so |\@add|\-|chapter|\-|lists|\-|gaps| will be supported. % It checks for |\Hy@org@chapter|, too, since the original code will be stored here @@ -1366,6 +1389,7 @@ \let\if@twocolumn\iffalse \let\if@mainmatter\iffalse \let\if@thema\iffalse + \let\if@chapnum\iffalse \def\@tempa[##1]##2{#2}% \ifx\@tempa\@chapter \newfloat@InfoNoLine{Document class `#1' detected}% @@ -1574,7 +1598,7 @@ \fi} % \end{macrocode} % \begin{macrocode} - % boek(3).cls [2004/06/07 v2.1a NTG LaTeX document class] +% boek(3).cls [2004/06/07 v2.1a NTG LaTeX document class] \newfloat@replace@chapter{boek}{% \ifnum \c@secnumdepth >\m@ne \if@mainmatter @@ -1720,7 +1744,8 @@ \else \@makechapterhead{#2}% \@afterheading - \fi}{% + \fi +}{% \if@chapnum % war mal \ifnum \c@secnumdepth >\m@ne \refstepcounter{chapter}% \if@mainmatter @@ -1744,6 +1769,81 @@ % \end{macrocode} % % \pagebreak[3] +% \subsubsection{The dgruyter package} +% \changes{v1.1j}{2019/08/31}{Extended support of \package{dgruyter} package added} +% +% \begin{macrocode} +% dgruyter.sty [2017/09/19 v2.00 De Gruyter layout] +\newfloat@replace@chapter{dgruyter}{% + \let\thesection\theinchapsection + \let\theequation\theinchapequation + \let\thefigure\theinchapfigure + \let\thetable\theinchaptable + \ifx\bookDOI\@undefined + \else + \@tempcnta\numexpr\componentd@i+\@ne\relax + \xdef\componentd@i{\the\@tempcnta}% + \xdef\@DOI{% + https://doi.org/\bookDOI + -\ifx\thepage\thefrontmatterpage2\else\ifnum\@tempcnta<100 0\fi\fi + \ifnum\@tempcnta<10 0\fi\componentd@i}% + \fi + \ifnum \c@secnumdepth >\m@ne + \if@mainmatter + \refstepcounter{chapter}% + \typeout{\@chapapp\space\thechapter.}% + \addcontentsline{toc}{chapter}{\protect\numberline{\thechapter}#1}% + \else + \addcontentsline{toc}{schapter}{#1}% + \fi + \else + \addcontentsline{toc}{schapter}{#1}% + \fi + \chaptermark{#1}% + \addtocontents{lof}{\protect\addvspace{13\p@}}% + \addtocontents{lot}{\protect\addvspace{13\p@}}% + \if@twocolumn + \@topnewpage[\@makechapterhead{#2}]% + \else + \@makechapterhead{#2}% + \@afterheading + \fi +}{% + \let\thesection\theinchapsection + \let\theequation\theinchapequation + \let\thefigure\theinchapfigure + \let\thetable\theinchaptable + \ifx\bookDOI\@undefined + \else + \@tempcnta\numexpr\componentd@i+\@ne\relax + \xdef\componentd@i{\the\@tempcnta}% + \xdef\@DOI{% + https://doi.org/\bookDOI + -\ifx\thepage\thefrontmatterpage2\else\ifnum\@tempcnta<100 0\fi\fi + \ifnum\@tempcnta<10 0\fi\componentd@i}% + \fi + \ifnum \c@secnumdepth >\m@ne + \if@mainmatter + \refstepcounter{chapter}% + \typeout{\@chapapp\space\thechapter.}% + \addcontentsline{toc}{chapter}{\protect\numberline{\thechapter}#1}% + \else + \addcontentsline{toc}{schapter}{#1}% + \fi + \else + \addcontentsline{toc}{schapter}{#1}% + \fi + \chaptermark{#1}% + \@addchapterlistsgaps + \if@twocolumn + \@topnewpage[\@makechapterhead{#2}]% + \else + \@makechapterhead{#2}% + \@afterheading + \fi} +% \end{macrocode} +% +% \pagebreak[3] % \subsubsection{Compatibility warning} % % \begin{macrocode} @@ -1792,37 +1892,106 @@ % \end{macrocode} % % \pagebreak[3] +% \subsection{Support of document classes} +% +% \subsubsection{The beamer document class} +% +% \begin{macro}{\beamer@float} +% \changes{v1.1k}{2019/09/01}{This macro added} +% Unfortunately the \class{beamer} document class does not offer +% |\beamer@float| and |\end@beamer@float| (yet), so we have to define them +% for ourself. +% (This code was taken from beamerbaselocalstructure.sty [2019/07/23 v3.56] and adapted.) +% \begin{macrocode} +\ifcsname beamer@float\endcsname \else +% \end{macrocode} +% \begin{macrocode} + \def\beamer@float#1{% + \ifcsname caption@settype\endcsname + \caption@settype{#1}% + \else + \def\@captype{#1}% + \fi + \par\nobreak\begin{center}\nobreak} +% \end{macrocode} +% \begin{macrocode} + \def\end@beamer@float{% + \par\nobreak\end{center}} +% \end{macrocode} +% \begin{macrocode} +\fi +% \end{macrocode} +% \end{macro} +% +% \pagebreak[3] % \subsection{Support of other packages} % -% \begin{macro}{\newfloat@ForEachNew} -% \changes{v1.1e}{2019/03/17}{This macro revised; uses \cs{ForEachFloatingEnvironment} now} -% |\newfloat@ForEachNew|\marg{command}\marg{code} +% \begin{macro}{\newfloat@IfPackageLoaded} +% \changes{v1.1e}{2019/03/17}{This macro revised} +% \changes{v1.1h}{2019/08/31}{This macro revised again and renamed from \cs{newfloat@ForEachNew} to \cs{newfloat@IfPackageLoaded}} +% |\newfloat@IfPackageLoaded|\marg{package name}\marg{command}\marg{code} % will execute the given code for every floating environment defined with -% |\Declare|\-|Floating|\-|Environment| if \meta{command} is defined. -% This will be tried |\At|\-|Begin|\-|Document| additionally so the affected -% package could be loaded after \thispackage. +% |\Declare|\-|Floating|\-|Environment| if \meta{command} is not defined yet. +% (If \meta{command} is already defined a warning will be issued.) +% This will be tried |\At|\-|Begin|\-|Document| additionally so the affected package could +% be loaded after \thispackage. +% \begin{macrocode} +\newcommand\newfloat@IfPackageLoaded[3]{% + \@ifpackageloaded{#1}{% + \newfloat@@IfPackageLoaded{#1}{#2}{#3}% + }{% + \AtBeginDocument{% + \@ifpackageloaded{#1}{% + \newfloat@@IfPackageLoaded{#1}{#2}{#3}% + }{}}% + }} +\@onlypreamble\newfloat@IfPackageLoaded +% \end{macrocode} +% \begin{macrocode} +\newcommand\newfloat@@IfPackageLoaded[3]{% + \newfloat@InfoNoLine{`#1' package detected}% + % Execute code for every previous \DeclareFloatingEnvironment + \def\@elt##1{\newfloat@@@IfPackageLoaded{#1}{#2}{#3}}% + \newfloat@@list + \let\@elt\relax + % Execute code for every future \DeclareFloatingEnvironment + \newfloat@addtohook{\newfloat@@@IfPackageLoaded{#1}{#2}{#3}}} +\@onlypreamble\newfloat@@IfPackageLoaded +% \end{macrocode} % \begin{macrocode} -\newcommand\newfloat@ForEachNew[2]{% - \ifcsname#1\endcsname - \ForEachFloatingEnvironment{#2}% +\newcommand\newfloat@@@IfPackageLoaded[3]{% + \ifcsname#2\endcsname + \newfloat@WarningNoLine{% + Command \@backslashchar#2 already defined.\MessageBreak + (`#1' package support)}% \else - \AtBeginDocument{% - \ifcsname#1\endcsname - \ForEachFloatingEnvironment{#2}% - \fi}% - \fi}% -\@onlypreamble\newfloat@ForEachNew + #3% + \fi} +\@onlypreamble\newfloat@@@IfPackageLoaded % \end{macrocode} % \end{macro} % % \pagebreak[3] +% \subsubsection{\package{dgruyter}} +% +% The De Gruyter layout package (for preparing books for Walter de Gruyter GmbH) +% is defining |\plist@figure| and |\plist@table|, and expects this to be +% defined for other floating environments as well. +% (This will be used as prefix for the ``List of''.) +% \begin{macrocode} +\newfloat@IfPackageLoaded{dgruyter}{plist@#1}{% + \expandafter\newcommand\csname plist@#1\endcsname{% + \@nameuse{#1name}\space}} +% \end{macrocode} +% +% \pagebreak[3] % \subsubsection{\package{float}} % % If the \package{float} package is used we fill up |\float@exts| with our file % extensions, too. Since this list will be used for inserting chapters gaps % we only add the ones which are configured for chapters gaps on. -%% \begin{macrocode} -\newfloat@ForEachNew{float@exts}{% +% \begin{macrocode} +\newfloat@IfPackageLoaded{float}{newfloat@undefined}{% \@nameuse{@ifchapterlistsgap@#1}{% if switched on \let\float@do=\relax \edef\@tempa{% @@ -1835,7 +2004,7 @@ % % We define a FP-variant of new floating environments here. % \begin{macrocode} -\newfloat@ForEachNew{FP@floatBegin}{% +\newfloat@IfPackageLoaded{fltpage}{FP#1}{% \newcounter{FP@#1C}% \newenvironment{FP#1}{\FP@floatBegin{#1}}{\FP@floatEnd}} % \end{macrocode} @@ -1857,7 +2026,7 @@ % % We define a sideways-variant of new floating environments here. % \begin{macrocode} -\newfloat@ForEachNew{@rotfloat}{% +\newfloat@IfPackageLoaded{rotating}{sideways#1}{% \newenvironment{sideways#1}{\@rotfloat{#1}}{\end@rotfloat}% \newenvironment{sideways#1*}{\@rotdblfloat{#1}}{\end@rotdblfloat}} % \end{macrocode} @@ -1878,7 +2047,7 @@ \@onlypreamble\newfloat@For@SC % \end{macrocode} % \begin{macrocode} -\newfloat@ForEachNew{SC@float}{% +\newfloat@IfPackageLoaded{sidecap}{SC#1}{% \expandafter\newfloat@For@SC\csname SC@#1@vpos\endcsname{#1}} % \end{macrocode} % \end{macro} @@ -1888,23 +2057,10 @@ % % We define a wrap-variant of new floating environments here. % \begin{macrocode} -\newfloat@ForEachNew{wrapfloat}{% +\newfloat@IfPackageLoaded{wrapfig}{wrap#1}{% \newenvironment{wrap#1}{\wrapfloat{#1}}{\endwrapfloat}} % \end{macrocode} % -% \pagebreak[3] -% \subsubsection{\package{dgruyter}} -% -% The De Gruyter layout package (for preparing books for Walter de Gruyter GmbH) -% is defining |\plist@figure| and |\plist@table|, and expects this to be -% defined for other floating environments as well. -% (This will be used as prefix for the ``List of''.) -% \begin{macrocode} -\newfloat@ForEachNew{plist@figure}{% - \expandafter\newcommand\csname plist@#1\endcsname{% - \@nameuse{#1name}\space}} -% \end{macrocode} -% % \iffalse %</package> % \fi |